]> source.dussan.org Git - nextcloud-server.git/commitdiff
Throw an exception when a shipped app was not replaced before the update 1973/head
authorJoas Schilling <coding@schilljs.com>
Wed, 2 Nov 2016 08:40:10 +0000 (09:40 +0100)
committerJoas Schilling <coding@schilljs.com>
Wed, 2 Nov 2016 09:00:14 +0000 (10:00 +0100)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/base.php
lib/private/Updater.php

index e7bedb6959631c87cced39ba8ca7ddd91519a3c0..40e482891024eb7f6cc1b6dd38929ac3f0b4cfbf 100644 (file)
@@ -377,6 +377,7 @@ class OC {
                \OCP\Util::addScript('update');
                \OCP\Util::addStyle('update');
 
+               /** @var \OCP\App\IAppManager $appManager */
                $appManager = \OC::$server->getAppManager();
 
                $tmpl = new OC_Template('', 'update.admin', 'guest');
@@ -385,8 +386,17 @@ class OC {
 
                // get third party apps
                $ocVersion = \OCP\Util::getVersion();
+               $incompatibleApps = $appManager->getIncompatibleApps($ocVersion);
+               foreach ($incompatibleApps as $appInfo) {
+                       if ($appManager->isShipped($appInfo['id'])) {
+                               $l = \OC::$server->getL10N('core');
+                               $hint = $l->t('The files of the app "%$1s" (%$2s) were not replaced correctly.', [$appInfo['name'], $appInfo['id']]);
+                               throw new \OC\HintException('The files of the app "' . $appInfo['name'] . '" (' . $appInfo['id'] . ') were not replaced correctly.', $hint);
+                       }
+               }
+
                $tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion));
-               $tmpl->assign('incompatibleAppsList', $appManager->getIncompatibleApps($ocVersion));
+               $tmpl->assign('incompatibleAppsList', $incompatibleApps);
                $tmpl->assign('productName', 'Nextcloud'); // for now
                $tmpl->assign('oldTheme', $oldTheme);
                $tmpl->printPage();
index 646fc031a830597d890d7e3c8096165e32ae7c22..91f24b903b8900df4569612a68a9933f4e42a252 100644 (file)
@@ -381,6 +381,9 @@ class Updater extends BasicEmitter {
                        // check if the app is compatible with this version of ownCloud
                        $info = OC_App::getAppInfo($app);
                        if(!OC_App::isAppCompatible($version, $info)) {
+                               if (OC_App::isShipped($app)) {
+                                       throw new \UnexpectedValueException('The files of the app "' . $app . '" were not correctly replaced before running the update');
+                               }
                                OC_App::disable($app);
                                $this->emit('\OC\Updater', 'incompatibleAppDisabled', array($app));
                        }