diff --git a/apps/updatenotification/lib/BackgroundJob/ResetToken.php b/apps/updatenotification/lib/BackgroundJob/ResetToken.php index 9e700bc93acb1..f0fc992546b79 100644 --- a/apps/updatenotification/lib/BackgroundJob/ResetToken.php +++ b/apps/updatenotification/lib/BackgroundJob/ResetToken.php @@ -43,7 +43,17 @@ protected function run($argument) { return; } - $secretCreated = $this->appConfig->getValueInt('core', 'updater.secret.created'); + $secretCreated = $this->appConfig->getValueInt('core', 'updater.secret.created', 0); + + if ($secretCreated === 0) { + if ($this->config->getSystemValueString('updater.secret') !== '') { + $this->logger->error('Cleared old `updater.secret` with unknown creation date', ['app' => 'updatenotification']); + $this->config->deleteSystemValue('updater.secret'); + } + $this->logger->debug('Skipping `updater.secret` reset since there is none', ['app' => 'updatenotification']); + return; + } + // Delete old tokens after 2 days and also tokens without any created date $secretCreatedDiff = $this->time->getTime() - $secretCreated; if ($secretCreatedDiff >= 172800) {