mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-17 09:45:29 +00:00
fix: switch updatedAt to datetime_immutable
This commit is contained in:
parent
b4aef61de2
commit
71173306d6
33
migrations/Version20240904162520.php
Normal file
33
migrations/Version20240904162520.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20240904162520 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE domain ALTER updated_at TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
|
||||||
|
$this->addSql('COMMENT ON COLUMN domain.updated_at IS \'(DC2Type:datetime_immutable)\'');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE domain ALTER updated_at TYPE DATE');
|
||||||
|
$this->addSql('COMMENT ON COLUMN domain.updated_at IS \'(DC2Type:date_immutable)\'');
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -54,7 +54,7 @@ class DomainRefreshController extends AbstractController
|
|||||||
if (null !== $domain
|
if (null !== $domain
|
||||||
&& !$domain->getDeleted()
|
&& !$domain->getDeleted()
|
||||||
&& ($domain->getUpdatedAt()->diff(new \DateTimeImmutable('now'))->days < 7)
|
&& ($domain->getUpdatedAt()->diff(new \DateTimeImmutable('now'))->days < 7)
|
||||||
&& !$this->RDAPService::isToBeWatchClosely($domain, $domain->getUpdatedAt())
|
&& !$this->RDAPService::isToBeWatchClosely($domain)
|
||||||
&& !$this->kernel->isDebug()
|
&& !$this->kernel->isDebug()
|
||||||
) {
|
) {
|
||||||
$this->logger->info('It is not necessary to update the information of the domain name {idnDomain} with the RDAP protocol.', [
|
$this->logger->info('It is not necessary to update the information of the domain name {idnDomain} with the RDAP protocol.', [
|
||||||
|
|||||||
@ -90,10 +90,10 @@ class Domain
|
|||||||
private Collection $nameservers;
|
private Collection $nameservers;
|
||||||
|
|
||||||
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
|
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
|
||||||
private ?\DateTimeImmutable $createdAt = null;
|
private ?\DateTimeImmutable $createdAt;
|
||||||
|
|
||||||
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
|
#[ORM\Column(type: Types::DATETIME_IMMUTABLE)]
|
||||||
private ?\DateTimeImmutable $updatedAt = null;
|
private ?\DateTimeImmutable $updatedAt;
|
||||||
|
|
||||||
#[ORM\ManyToOne]
|
#[ORM\ManyToOne]
|
||||||
#[ORM\JoinColumn(referencedColumnName: 'tld', nullable: false)]
|
#[ORM\JoinColumn(referencedColumnName: 'tld', nullable: false)]
|
||||||
|
|||||||
@ -65,7 +65,7 @@ final readonly class UpdateDomainsFromWatchlistHandler
|
|||||||
->filter(fn ($domain) => $domain->getUpdatedAt()
|
->filter(fn ($domain) => $domain->getUpdatedAt()
|
||||||
->diff(
|
->diff(
|
||||||
new \DateTimeImmutable('now'))->days >= 7
|
new \DateTimeImmutable('now'))->days >= 7
|
||||||
|| $this->RDAPService::isToBeWatchClosely($domain, $domain->getUpdatedAt())
|
|| $this->RDAPService::isToBeWatchClosely($domain)
|
||||||
) as $domain
|
) as $domain
|
||||||
) {
|
) {
|
||||||
$updatedAt = $domain->getUpdatedAt();
|
$updatedAt = $domain->getUpdatedAt();
|
||||||
|
|||||||
@ -21,7 +21,7 @@ final readonly class SendNotifWatchListTriggerSchedule implements ScheduleProvid
|
|||||||
{
|
{
|
||||||
return (new Schedule())
|
return (new Schedule())
|
||||||
->add(
|
->add(
|
||||||
RecurringMessage::every('1 day', new ProcessWatchListsTrigger()),
|
RecurringMessage::every('1 hour', new ProcessWatchListsTrigger()),
|
||||||
)
|
)
|
||||||
->stateful($this->cache);
|
->stateful($this->cache);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,7 +99,7 @@ readonly class RDAPService
|
|||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public static function isToBeWatchClosely(Domain $domain, \DateTimeImmutable $updatedAt): bool
|
public static function isToBeWatchClosely(Domain $domain): bool
|
||||||
{
|
{
|
||||||
$status = $domain->getStatus();
|
$status = $domain->getStatus();
|
||||||
if (!empty($status) && count(array_intersect($status, self::IMPORTANT_STATUS))) {
|
if (!empty($status) && count(array_intersect($status, self::IMPORTANT_STATUS))) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user