diff options
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Setup.php | 4 | ||||
-rw-r--r-- | lib/private/Updater.php | 32 | ||||
-rw-r--r-- | lib/private/Updater/VersionCheck.php | 8 |
3 files changed, 18 insertions, 26 deletions
diff --git a/lib/private/Setup.php b/lib/private/Setup.php index 1e42fbfbeb5..0b7780c5cd0 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -62,6 +62,7 @@ use OC\TextProcessing\RemoveOldTasksBackgroundJob; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJobList; use OCP\Defaults; +use OCP\IAppConfig; use OCP\IConfig; use OCP\IGroup; use OCP\IGroupManager; @@ -382,7 +383,8 @@ class Setup { $config = Server::get(IConfig::class); $config->setAppValue('core', 'installedat', (string)microtime(true)); - $config->setAppValue('core', 'lastupdatedat', (string)microtime(true)); + $appConfig = Server::get(IAppConfig::class); + $appConfig->setValueInt('core', 'lastupdatedat', time()); $vendorData = $this->getVendorData(); $config->setAppValue('core', 'vendor', $vendorData['vendor']); diff --git a/lib/private/Updater.php b/lib/private/Updater.php index 7d26fbebc4b..09866273bb3 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -59,6 +59,7 @@ use OCP\App\IAppManager; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventDispatcher; use OCP\HintException; +use OCP\IAppConfig; use OCP\IConfig; use OCP\ILogger; use OCP\Util; @@ -74,19 +75,7 @@ use Psr\Log\LoggerInterface; * - failure(string $message) */ class Updater extends BasicEmitter { - /** @var LoggerInterface */ - private $log; - - /** @var IConfig */ - private $config; - - /** @var Checker */ - private $checker; - - /** @var Installer */ - private $installer; - - private $logLevelNames = [ + private array $logLevelNames = [ 0 => 'Debug', 1 => 'Info', 2 => 'Warning', @@ -94,14 +83,13 @@ class Updater extends BasicEmitter { 4 => 'Fatal', ]; - public function __construct(IConfig $config, - Checker $checker, - ?LoggerInterface $log, - Installer $installer) { - $this->log = $log; - $this->config = $config; - $this->checker = $checker; - $this->installer = $installer; + public function __construct( + private IConfig $config, + private IAppConfig $appConfig, + private Checker $checker, + private ?LoggerInterface $log, + private Installer $installer + ) { } /** @@ -303,7 +291,7 @@ class Updater extends BasicEmitter { $repair->run(); //Invalidate update feed - $this->config->setAppValue('core', 'lastupdatedat', '0'); + $this->appConfig->setValueInt('core', 'lastupdatedat', 0); // Check for code integrity if not disabled if (\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) { diff --git a/lib/private/Updater/VersionCheck.php b/lib/private/Updater/VersionCheck.php index e37024ec2c2..01022067d87 100644 --- a/lib/private/Updater/VersionCheck.php +++ b/lib/private/Updater/VersionCheck.php @@ -27,6 +27,7 @@ namespace OC\Updater; use OCP\Http\Client\IClientService; +use OCP\IAppConfig; use OCP\IConfig; use OCP\IUserManager; use OCP\Support\Subscription\IRegistry; @@ -37,6 +38,7 @@ class VersionCheck { public function __construct( private IClientService $clientService, private IConfig $config, + private IAppConfig $appConfig, private IUserManager $userManager, private IRegistry $registry, private LoggerInterface $logger, @@ -56,13 +58,13 @@ class VersionCheck { } // Look up the cache - it is invalidated all 30 minutes - if (((int)$this->config->getAppValue('core', 'lastupdatedat') + 1800) > time()) { + if (($this->appConfig->getValueInt('core', 'lastupdatedat') + 1800) > time()) { return json_decode($this->config->getAppValue('core', 'lastupdateResult'), true); } $updaterUrl = $this->config->getSystemValueString('updater.server.url', 'https://updates.nextcloud.com/updater_server/'); - $this->config->setAppValue('core', 'lastupdatedat', (string)time()); + $this->appConfig->setValueInt('core', 'lastupdatedat', time()); if ($this->config->getAppValue('core', 'installedat', '') === '') { $this->config->setAppValue('core', 'installedat', (string)microtime(true)); @@ -70,7 +72,7 @@ class VersionCheck { $version = Util::getVersion(); $version['installed'] = $this->config->getAppValue('core', 'installedat'); - $version['updated'] = $this->config->getAppValue('core', 'lastupdatedat'); + $version['updated'] = $this->appConfig->getValueInt('core', 'lastupdatedat'); $version['updatechannel'] = \OC_Util::getChannel(); $version['edition'] = ''; $version['build'] = \OC_Util::getBuild(); |