]> source.dussan.org Git - nextcloud-server.git/commitdiff
Port of #14041 to master
authorArthur Schiwon <blizzz@owncloud.com>
Tue, 3 Feb 2015 18:02:25 +0000 (19:02 +0100)
committerArthur Schiwon <blizzz@owncloud.com>
Thu, 19 Feb 2015 13:38:22 +0000 (14:38 +0100)
on ownCloud upgrade: upgrade all apps in order, load important ones

Fix "other" app update stack

lib/private/updater.php

index fb41e2d36f0f992fcd8d4bbafe4cf175c9a36076..c120d55b6f73c4ba3f86ae767c49f65f423826c9 100644 (file)
@@ -291,13 +291,47 @@ class Updater extends BasicEmitter {
                include \OC_App::getAppPath($appId) . '/appinfo/preupdate.php';
        }
 
+
+       /**
+        * upgrades all apps within a major ownCloud upgrade. Also loads "priority"
+        * (types authentication, filesystem, logging, in that order) afterwards.
+        *
+        * @throws NeedsUpdateException
+        */
        protected function doAppUpgrade() {
                $apps = \OC_App::getEnabledApps();
+               $priorityTypes = array('authentication', 'filesystem', 'logging');
+               $pseudoOtherType = 'other';
+               $stacks = array($pseudoOtherType => array());
 
                foreach ($apps as $appId) {
-                       if (\OC_App::shouldUpgrade($appId)) {
-                               \OC_App::updateApp($appId);
-                               $this->emit('\OC\Updater', 'appUpgrade', array($appId, \OC_App::getAppVersion($appId)));
+                       $priorityType = false;
+                       foreach ($priorityTypes as $type) {
+                               if(!isset($stacks[$type])) {
+                                       $stacks[$type] = array();
+                               }
+                               if (\OC_App::isType($appId, $type)) {
+                                       $stacks[$type][] = $appId;
+                                       $priorityType = true;
+                                       break;
+                               }
+                       }
+                       if (!$priorityType) {
+                               $stacks[$pseudoOtherType][] = $appId;
+                       }
+               }
+               foreach ($stacks as $type => $stack) {
+                       foreach ($stack as $appId) {
+                               if (\OC_App::shouldUpgrade($appId)) {
+                                       \OC_App::updateApp($appId);
+                                       $this->emit('\OC\Updater', 'appUpgrade', array($appId, \OC_App::getAppVersion($appId)));
+                               }
+                               if($type !== $pseudoOtherType) {
+                                       // load authentication, filesystem and logging apps after
+                                       // upgrading them. Other apps my need to rely on modifying
+                                       // user and/or filesystem aspects.
+                                       \OC_App::loadApp($appId, false);
+                               }
                        }
                }
        }