summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-06-26 20:41:11 +0200
committerBart Visscher <bartv@thisnet.nl>2012-06-27 01:05:12 +0200
commit2f0b4983e9019bb4a129f5578cf0a3ced1dab4d7 (patch)
tree727e385b552385b4e9190b68c13517ccf574e364 /lib
parenta25ae4b4b66e54e627912e5691f01da998f17029 (diff)
downloadnextcloud-server-2f0b4983e9019bb4a129f5578cf0a3ced1dab4d7.tar.gz
nextcloud-server-2f0b4983e9019bb4a129f5578cf0a3ced1dab4d7.zip
Move app upgrade check to loading of apps
Diffstat (limited to 'lib')
-rwxr-xr-xlib/app.php24
-rw-r--r--lib/base.php4
2 files changed, 12 insertions, 16 deletions
diff --git a/lib/app.php b/lib/app.php
index b337c55ec60..be17beeacc5 100755
--- a/lib/app.php
+++ b/lib/app.php
@@ -84,6 +84,7 @@ class OC_App{
*/
public static function loadApp($app){
if(is_file(self::getAppPath($app).'/appinfo/app.php')){
+ self::checkUpgrade($app);
require_once( $app.'/appinfo/app.php' );
}
}
@@ -526,22 +527,17 @@ class OC_App{
}
/**
- * check if any apps need updating and update those
+ * check if the app need updating and update when needed
*/
- public static function updateApps(){
+ public static function checkUpgrade($app) {
$versions = self::getAppVersions();
- //ensure files app is installed for upgrades
- if(!isset($versions['files'])){
- $versions['files']='0';
- }
- foreach( $versions as $app=>$installedVersion ){
- $currentVersion=OC_App::getAppVersion($app);
- if ($currentVersion) {
- if (version_compare($currentVersion, $installedVersion, '>')) {
- OC_Log::write($app, 'starting app upgrade from '.$installedVersion.' to '.$currentVersion,OC_Log::DEBUG);
- OC_App::updateApp($app);
- OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app));
- }
+ $currentVersion=OC_App::getAppVersion($app);
+ if ($currentVersion) {
+ $installedVersion = $versions[$app];
+ if (version_compare($currentVersion, $installedVersion, '>')) {
+ OC_Log::write($app, 'starting app upgrade from '.$installedVersion.' to '.$currentVersion,OC_Log::DEBUG);
+ OC_App::updateApp($app);
+ OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app));
}
}
}
diff --git a/lib/base.php b/lib/base.php
index b4da6434e25..11e63e208eb 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -208,9 +208,9 @@ class OC{
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
OC_App::checkAppsRequirements();
+ // load all apps to also upgrade enabled apps
+ OC_App::loadApps();
}
-
- OC_App::updateApps();
}
}