diff options
author | Georg Ehrke <ownclouddev@georgswebsite.de> | 2011-11-20 11:41:58 +0100 |
---|---|---|
committer | Georg Ehrke <ownclouddev@georgswebsite.de> | 2011-11-20 11:41:58 +0100 |
commit | 6c4692380fa0bd220610306bee1aa425a2c324b7 (patch) | |
tree | 6c70e3bbb60c08a443868cb9850e25f241adcd56 /lib | |
parent | 3d498002d040603778efbbd558a4d25c6d6734a4 (diff) | |
parent | 7df9d934caecfdbc6e316d79e37d37ebd52bdda6 (diff) | |
download | nextcloud-server-6c4692380fa0bd220610306bee1aa425a2c324b7.tar.gz nextcloud-server-6c4692380fa0bd220610306bee1aa425a2c324b7.zip |
Merge branch 'master' of gitorious.org:owncloud/owncloud into fullcalendar
Diffstat (limited to 'lib')
-rw-r--r-- | lib/config.php | 1 | ||||
-rw-r--r-- | lib/setup.php | 2 | ||||
-rw-r--r-- | lib/updater.php | 91 |
3 files changed, 93 insertions, 1 deletions
diff --git a/lib/config.php b/lib/config.php index 2c82036257f..8d03271b3ea 100644 --- a/lib/config.php +++ b/lib/config.php @@ -94,7 +94,6 @@ class OC_Config{ // Write changes self::writeData(); - return true; } diff --git a/lib/setup.php b/lib/setup.php index e2d56ddaf4a..8afe0070e9b 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -77,6 +77,8 @@ class OC_Setup { OC_Config::setValue('datadirectory', $datadir); OC_Config::setValue('dbtype', $dbtype); OC_Config::setValue('version',implode('.',OC_Util::getVersion())); + OC_Config::setValue('installedat',microtime(true)); + OC_Config::setValue('lastupdatedat',microtime(true)); if($dbtype == 'mysql') { $dbuser = $options['dbuser']; $dbpass = $options['dbpass']; diff --git a/lib/updater.php b/lib/updater.php new file mode 100644 index 00000000000..e4db719a62c --- /dev/null +++ b/lib/updater.php @@ -0,0 +1,91 @@ +<?php +/** + * ownCloud + * + * @author Frank Karlitschek + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * Class that handels autoupdating of ownCloud + */ +class OC_Updater{ + + /** + * Check if a new version is available + */ + public static function check(){ + OC_Config::setValue('lastupdatedat',microtime(true)); + + $updaterurl='http://apps.owncloud.com/updater.php'; + $version=OC_Util::getVersion(); + $version['installed']=OC_Config::getValue( "installedat"); + $version['updated']=OC_Config::getValue( "lastupdatedat"); + $version['updatechannel']='stable'; + $versionstring=implode('x',$version); + + //fetch xml data from updater + $url=$updaterurl.'?version='.$versionstring; + $xml=@file_get_contents($url); + if($xml==FALSE){ + return array(); + } + $data=@simplexml_load_string($xml); + + $tmp=array(); + $tmp['version'] = $data->version; + $tmp['versionstring'] = $data->versionstring; + $tmp['url'] = $data->url; + $tmp['web'] = $data->web; + + + return $tmp; + + } + + + + public static function ShowUpdatingHint(){ + $data=OC_Updater::check(); + if(isset($data['version']) and $data['version']<>'') { + $txt='<span style="color:#AA0000; font-weight:bold;">'.$data['versionstring'].' is available. Please click <a href="'.$data['web'].'">here</a> for more information</span>'; + }else{ + $txt='Your ownCloud is up to date'; + } + return($txt); + + } + + + /** + * do ownCloud update + */ + public static function doUpdate(){ + + //update ownCloud core + + //update all apps + + //update version in config + + } + +} + + + +?> |