Skip to content
Snippets Groups Projects
Commit 897bfa88 authored by Frank Karlitschek's avatar Frank Karlitschek
Browse files

finally fix the updater. next is an automatic updater. but this is a bit more tricky.

parent d065b2d2
No related branches found
No related tags found
No related merge requests found
...@@ -74,6 +74,9 @@ $CONFIG = array( ...@@ -74,6 +74,9 @@ $CONFIG = array(
/* Check 3rdparty apps for malicious code fragments */ /* Check 3rdparty apps for malicious code fragments */
"appcodechecker" => "", "appcodechecker" => "",
/* Check if ownCloud is up to date */
"updatechecker" => true,
/* Place to log to, can be owncloud and syslog (owncloud is log menu item in admin menu) */ /* Place to log to, can be owncloud and syslog (owncloud is log menu item in admin menu) */
"log_type" => "owncloud", "log_type" => "owncloud",
......
...@@ -30,11 +30,12 @@ class OC_Updater{ ...@@ -30,11 +30,12 @@ class OC_Updater{
*/ */
public static function check(){ public static function check(){
OC_Appconfig::setValue('core', 'lastupdatedat',microtime(true)); OC_Appconfig::setValue('core', 'lastupdatedat',microtime(true));
if(OC_Appconfig::getValue('core', 'installedat','')=='') OC_Appconfig::setValue('core', 'installedat',microtime(true));
$updaterurl='http://apps.owncloud.com/updater.php'; $updaterurl='http://apps.owncloud.com/updater.php';
$version=OC_Util::getVersion(); $version=OC_Util::getVersion();
$version['installed']=OC_Config::getValue('installedat'); $version['installed']=OC_Appconfig::getValue('core', 'installedat');
$version['updated']=OC_Appconfig::getValue('core', 'lastupdatedat', OC_Config::getValue( 'lastupdatedat')); $version['updated']=OC_Appconfig::getValue('core', 'lastupdatedat');
$version['updatechannel']='stable'; $version['updatechannel']='stable';
$version['edition']=OC_Util::getEditionString(); $version['edition']=OC_Util::getEditionString();
$versionstring=implode('x',$version); $versionstring=implode('x',$version);
...@@ -57,12 +58,16 @@ class OC_Updater{ ...@@ -57,12 +58,16 @@ class OC_Updater{
} }
public static function ShowUpdatingHint(){ public static function ShowUpdatingHint(){
if(OC_Config::getValue('updatechecker', true)==true){
$data=OC_Updater::check(); $data=OC_Updater::check();
if(isset($data['version']) and $data['version']<>'') { if(isset($data['version']) and $data['version']<>'') {
$txt='<span style="color:#AA0000; font-weight:bold;">'.$data['versionstring'].' is available. Get <a href="'.$data['web'].'">more information</a></span>'; $txt='<span style="color:#AA0000; font-weight:bold;">'.$data['versionstring'].' is available. Get <a href="'.$data['web'].'">more information</a></span>';
}else{ }else{
$txt='up to date'; $txt='up to date';
} }
}else{
$txt='updates check is disabled';
}
return($txt); return($txt);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment