summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-12-11 23:57:53 +0100
committerRobin Appelman <icewind1991@gmail.com>2011-12-11 23:57:53 +0100
commitc67c933d3fbc0fbf0b594fb4c2236118bed10e21 (patch)
tree6478ebaaf890151331db0352789955e49751db04 /lib
parent9fdd1bafdc2aafcf27b939ba259818830f2df25e (diff)
parenta8148fa94a6805ca7c6585e136905d5ec155a102 (diff)
downloadnextcloud-server-c67c933d3fbc0fbf0b594fb4c2236118bed10e21.tar.gz
nextcloud-server-c67c933d3fbc0fbf0b594fb4c2236118bed10e21.zip
Merge branch 'database' into filesystem
Diffstat (limited to 'lib')
-rw-r--r--lib/app.php29
-rw-r--r--lib/base.php2
2 files changed, 31 insertions, 0 deletions
diff --git a/lib/app.php b/lib/app.php
index b1aa8ba354d..2e03db6c8d2 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -362,4 +362,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';
+ }
+ }
}
diff --git a/lib/base.php b/lib/base.php
index cce2a608e1e..f1303c298e0 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -134,6 +134,8 @@ class OC{
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
}
+ OC_App::updateApps();
+
ini_set('session.cookie_httponly','1;');
session_start();