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

This commit is contained in:
Frank Karlitschek 2012-06-09 17:56:23 +02:00
parent 642e7ce110
commit 061938cbb5
2 changed files with 13 additions and 6 deletions

View File

@ -30,6 +30,7 @@ $CONFIG = array(
"logfile" => "", "logfile" => "",
"loglevel" => "", "loglevel" => "",
"passwordsalt" => "", "passwordsalt" => "",
"updatechecker" => true,
// "datadirectory" => "" // "datadirectory" => ""
); );
?> ?>

View File

@ -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,15 +58,20 @@ class OC_Updater{
} }
public static function ShowUpdatingHint(){ public static function ShowUpdatingHint(){
$data=OC_Updater::check(); if(OC_Config::getValue('updatechecker', true)==true){
if(isset($data['version']) and $data['version']<>'') { $data=OC_Updater::check();
$txt='<span style="color:#AA0000; font-weight:bold;">'.$data['versionstring'].' is available. Get <a href="'.$data['web'].'">more information</a></span>'; 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>';
}else{
$txt='up to date';
}
}else{ }else{
$txt='up to date'; $txt='updates check is disabled';
} }
return($txt); return($txt);
} }
/** /**
* do ownCloud update * do ownCloud update
*/ */