diff options
author | Victor Dubiniuk <victor.dubiniuk@gmail.com> | 2014-12-10 01:13:38 +0300 |
---|---|---|
committer | Victor Dubiniuk <victor.dubiniuk@gmail.com> | 2014-12-10 01:13:38 +0300 |
commit | c9fd3c9d2960c6457440427513f04a4f338a23d5 (patch) | |
tree | 81166aeedd483ced13863347820233e3491ea8f0 /lib | |
parent | 81d571241991926f8820c43020a0250eb305a0b0 (diff) | |
download | nextcloud-server-c9fd3c9d2960c6457440427513f04a4f338a23d5.tar.gz nextcloud-server-c9fd3c9d2960c6457440427513f04a4f338a23d5.zip |
Inject config
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/templatelayout.php | 2 | ||||
-rw-r--r-- | lib/private/updater.php | 26 |
2 files changed, 17 insertions, 11 deletions
diff --git a/lib/private/templatelayout.php b/lib/private/templatelayout.php index aefb93ec266..fa025721e53 100644 --- a/lib/private/templatelayout.php +++ b/lib/private/templatelayout.php @@ -44,7 +44,7 @@ class OC_TemplateLayout extends OC_Template { // Update notification if($this->config->getSystemValue('updatechecker', true) === true && OC_User::isAdminUser(OC_User::getUser())) { - $updater = new \OC\Updater(\OC::$server->getHTTPHelper()); + $updater = new \OC\Updater(\OC::$server->getHTTPHelper(), \OC::$server->getAppConfig()); $data = $updater->check(); if(isset($data['version']) && $data['version'] != '' and $data['version'] !== Array()) { diff --git a/lib/private/updater.php b/lib/private/updater.php index 266cf9cc89f..6272f77cfc2 100644 --- a/lib/private/updater.php +++ b/lib/private/updater.php @@ -30,6 +30,11 @@ class Updater extends BasicEmitter { * @var \OC\HTTPHelper $helper; */ private $httpHelper; + + /** + * @var \OCP\IAppConfig; + */ + private $config; private $simulateStepEnabled; @@ -38,9 +43,10 @@ class Updater extends BasicEmitter { /** * @param \OC\Log $log */ - public function __construct($httpHelper, $log = null) { + public function __construct($httpHelper, $config, $log = null) { $this->httpHelper = $httpHelper; $this->log = $log; + $this->config = $config; $this->simulateStepEnabled = true; $this->updateStepEnabled = true; } @@ -75,23 +81,23 @@ class Updater extends BasicEmitter { public function check($updaterUrl = null) { // Look up the cache - it is invalidated all 30 minutes - if ((\OC_Appconfig::getValue('core', 'lastupdatedat') + 1800) > time()) { - return json_decode(\OC_Appconfig::getValue('core', 'lastupdateResult'), true); + if (($this->config->getValue('core', 'lastupdatedat') + 1800) > time()) { + return json_decode($this->config->getValue('core', 'lastupdateResult'), true); } if (is_null($updaterUrl)) { $updaterUrl = 'https://apps.owncloud.com/updater.php'; } - \OC_Appconfig::setValue('core', 'lastupdatedat', time()); + $this->config->setValue('core', 'lastupdatedat', time()); - if (\OC_Appconfig::getValue('core', 'installedat', '') == '') { - \OC_Appconfig::setValue('core', 'installedat', microtime(true)); + if ($this->config->getValue('core', 'installedat', '') == '') { + $this->config->setValue('core', 'installedat', microtime(true)); } $version = \OC_Util::getVersion(); - $version['installed'] = \OC_Appconfig::getValue('core', 'installedat'); - $version['updated'] = \OC_Appconfig::getValue('core', 'lastupdatedat'); + $version['installed'] = $this->config->getValue('core', 'installedat'); + $version['updated'] = $this->config->getValue('core', 'lastupdatedat'); $version['updatechannel'] = \OC_Util::getChannel(); $version['edition'] = \OC_Util::getEditionString(); $version['build'] = \OC_Util::getBuild(); @@ -119,7 +125,7 @@ class Updater extends BasicEmitter { } // Cache the result - \OC_Appconfig::setValue('core', 'lastupdateResult', json_encode($data)); + $this->config->setValue('core', 'lastupdateResult', json_encode($data)); return $tmp; } @@ -219,7 +225,7 @@ class Updater extends BasicEmitter { $repair->run(); //Invalidate update feed - \OC_Appconfig::setValue('core', 'lastupdatedat', 0); + $this->config->setValue('core', 'lastupdatedat', 0); // only set the final version if everything went well \OC_Config::setValue('version', implode('.', \OC_Util::getVersion())); |