diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-12-11 22:08:01 +0100 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2012-01-08 01:57:53 +0100 |
commit | fea68e08b4f0aa52ebd051e4428ff5abd8284f5c (patch) | |
tree | 22294cff607c893e0e53a5d11948b31b3bf66089 /lib/app.php | |
parent | 001d06f2ff4a641ff76b4d67a3a33cbdbf5b2bb5 (diff) | |
download | nextcloud-server-fea68e08b4f0aa52ebd051e4428ff5abd8284f5c.tar.gz nextcloud-server-fea68e08b4f0aa52ebd051e4428ff5abd8284f5c.zip |
update apps when their version number increases
Diffstat (limited to 'lib/app.php')
-rw-r--r-- | lib/app.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/app.php b/lib/app.php index 1873e1136cd..6b35cdffec9 100644 --- a/lib/app.php +++ b/lib/app.php @@ -371,4 +371,33 @@ class OC_App{ } return $apps; } + + /** + * check if any apps need updating and update those + */ + public static function updateApps(){ + // The rest comes here + $apps = OC_Appconfig::getApps(); + foreach( $apps as $app ){ + $installedVersion=OC_Appconfig::getValue($app,'installed_version'); + $appInfo=OC_App::getAppInfo($app); + $currentVersion=$appInfo['version']; + if (version_compare($currentVersion, $installedVersion, '>')) { + OC_App::updateApp($app); + } + } + } + + /** + * update the database for the app and call the update script + * @param string appid + */ + public static function updateApp($appid){ + if(file_exists(OC::$SERVERROOT.'/apps/'.$file.'/appinfo/database.xml')){ + OC_DB::updateDbFromStructure(OC::$SERVERROOT.'/apps/'.$file.'/appinfo/database.xml'); + } + if(file_exists(OC::$SERVERROOT.'/apps/'.$file.'/appinfo/update.php')){ + include OC::$SERVERROOT.'/apps/'.$file.'/appinfo/update.php'; + } + } } |