mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
fix: intensify on last day
This commit is contained in:
@@ -48,7 +48,7 @@ class RegisterDomainCommand extends Command
|
||||
|
||||
try {
|
||||
if (null !== $domain && !$force) {
|
||||
if (!$domain->isToBeUpdated()) {
|
||||
if (!$domain->isToBeUpdated(true, true)) {
|
||||
$io->warning('The domain name is already present in the database and does not need to be updated at this time.');
|
||||
|
||||
return Command::SUCCESS;
|
||||
|
||||
@@ -54,7 +54,7 @@ class DomainRefreshController extends AbstractController
|
||||
// If the domain name exists in the database, recently updated and not important, we return the stored Domain
|
||||
if (null !== $domain
|
||||
&& !$domain->getDeleted()
|
||||
&& !$domain->isToBeUpdated()
|
||||
&& !$domain->isToBeUpdated(true, true)
|
||||
&& !$this->kernel->isDebug()
|
||||
&& true !== filter_var($request->get('forced', false), FILTER_VALIDATE_BOOLEAN)
|
||||
) {
|
||||
|
||||
@@ -379,7 +379,7 @@ class Domain
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function isToBeUpdated(bool $fromUser = true): bool
|
||||
public function isToBeUpdated(bool $fromUser = true, bool $intensifyLastDay = false): bool
|
||||
{
|
||||
$updatedAtDiff = $this->getUpdatedAt()->diff(new \DateTimeImmutable());
|
||||
|
||||
@@ -393,7 +393,7 @@ class Domain
|
||||
|
||||
$expiresIn = $this->getExpiresInDays();
|
||||
|
||||
if (0 === $expiresIn || 1 === $expiresIn) {
|
||||
if ($intensifyLastDay && (0 === $expiresIn || 1 === $expiresIn)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ final readonly class UpdateDomainsFromWatchlistHandler
|
||||
*/
|
||||
|
||||
/** @var Domain $domain */
|
||||
foreach ($watchList->getDomains()->filter(fn ($domain) => $domain->isToBeUpdated(false)) as $domain
|
||||
foreach ($watchList->getDomains()->filter(fn ($domain) => $domain->isToBeUpdated(false, null !== $watchList->getConnector())) as $domain
|
||||
) {
|
||||
$updatedAt = $domain->getUpdatedAt();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user