Merge pull request #2464 from nextcloud/backport-1973-dont-disable-shipped-apps-but-throw-instead
[stable10] Throw an exception when a shipped app was not replaced before the update
This commit is contained in:
commit
d739dfb8cb
17
lib/base.php
17
lib/base.php
|
@ -382,6 +382,7 @@ class OC {
|
|||
\OCP\Util::addScript('update');
|
||||
\OCP\Util::addStyle('update');
|
||||
|
||||
/** @var \OC\App\AppManager $appManager */
|
||||
$appManager = \OC::$server->getAppManager();
|
||||
|
||||
$tmpl = new OC_Template('', 'update.admin', 'guest');
|
||||
|
@ -390,8 +391,22 @@ class OC {
|
|||
|
||||
// get third party apps
|
||||
$ocVersion = \OCP\Util::getVersion();
|
||||
$incompatibleApps = $appManager->getIncompatibleApps($ocVersion);
|
||||
$incompatibleShippedApps = [];
|
||||
foreach ($incompatibleApps as $appInfo) {
|
||||
if ($appManager->isShipped($appInfo['id'])) {
|
||||
$incompatibleShippedApps[] = $appInfo['name'] . ' (' . $appInfo['id'] . ')';
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($incompatibleShippedApps)) {
|
||||
$l = \OC::$server->getL10N('core');
|
||||
$hint = $l->t('The files of the app %$1s were not replaced correctly. Make sure it is a version compatible with the server.', [implode(', ', $incompatibleShippedApps)]);
|
||||
throw new \OC\HintException('The files of the app ' . implode(', ', $incompatibleShippedApps) . ' were not replaced correctly. Make sure it is a version compatible with the server.', $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();
|
||||
|
|
|
@ -434,6 +434,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));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue