]> source.dussan.org Git - nextcloud-server.git/commitdiff
Move app upgrade check to loading of apps
authorBart Visscher <bartv@thisnet.nl>
Tue, 26 Jun 2012 18:41:11 +0000 (20:41 +0200)
committerBart Visscher <bartv@thisnet.nl>
Tue, 26 Jun 2012 23:05:12 +0000 (01:05 +0200)
lib/app.php
lib/base.php

index b337c55ec605864f09c1d906fa48fc337983267d..be17beeacc513038bb2106b82f87e7843c4e51c0 100755 (executable)
@@ -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));
                        }
                }
        }
index b4da6434e2531c29e6d18138c9548a41d8b13580..11e63e208eb81c7dea76578b55c606f7ee4a15ba 100644 (file)
@@ -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();
                }
        }