diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2013-04-24 18:47:38 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2013-04-24 18:47:38 +0200 |
commit | d41b6007254fcd5edaa7c4001a11cd8d2597ec9a (patch) | |
tree | 7c56f2d0e2d4320d4af6ba31e74d699fa3902099 /lib/updater.php | |
parent | dd1c876009df15c97602f99b45e3c6e9cbcbf8af (diff) | |
download | nextcloud-server-d41b6007254fcd5edaa7c4001a11cd8d2597ec9a.tar.gz nextcloud-server-d41b6007254fcd5edaa7c4001a11cd8d2597ec9a.zip |
Add an update notification on every page for admin users
Diffstat (limited to 'lib/updater.php')
-rw-r--r-- | lib/updater.php | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/lib/updater.php b/lib/updater.php index e7d33ac2bb9..9081bfc4be8 100644 --- a/lib/updater.php +++ b/lib/updater.php @@ -29,7 +29,14 @@ class OC_Updater{ * Check if a new version is available */ public static function check() { - OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true)); + + // 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); + } + + OC_Appconfig::setValue('core', 'lastupdatedat', time()); + if(OC_Appconfig::getValue('core', 'installedat', '')=='') { OC_Appconfig::setValue('core', 'installedat', microtime(true)); } @@ -65,38 +72,9 @@ class OC_Updater{ $tmp['url'] = $data->url; $tmp['web'] = $data->web; - return $tmp; - } - - public static function ShowUpdatingHint() { - $l = OC_L10N::get('lib'); - - if(OC_Config::getValue('updatechecker', true)==true) { - $data=OC_Updater::check(); - if(isset($data['version']) and $data['version']<>'') { - $txt='<span style="color:#AA0000; font-weight:bold;">' - .$l->t('%s is available. Get <a href="%s">more information</a>', - array($data['versionstring'], $data['web'])).'</span>'; - }else{ - $txt=$l->t('up to date'); - } - }else{ - $txt=$l->t('updates check is disabled'); - } - return($txt); - } - - - /** - * do ownCloud update - */ - public static function doUpdate() { - - //update ownCloud core - - //update all apps - - //update version in config + // Cache the result + OC_Appconfig::setValue('core', 'lastupdateResult', json_encode($data)); + return $tmp; } -} +}
\ No newline at end of file |