Re-enable apps that got automatically disabled while updating

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2018-02-15 16:49:42 +01:00 committed by John Molakvoæ (skjnldsv)
parent dfbc21d806
commit 4b49f810b7
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
2 changed files with 10 additions and 1 deletions

View File

@ -250,6 +250,7 @@ class Updater extends BasicEmitter {
// upgrade appstore apps // upgrade appstore apps
$this->upgradeAppStoreApps(\OC::$server->getAppManager()->getInstalledApps()); $this->upgradeAppStoreApps(\OC::$server->getAppManager()->getInstalledApps());
$this->upgradeAppStoreApps(\OC_App::$autoDisabledApps, true);
// install new shipped apps on upgrade // install new shipped apps on upgrade
OC_App::loadApps(['authentication']); OC_App::loadApps(['authentication']);
@ -430,9 +431,10 @@ class Updater extends BasicEmitter {
/** /**
* @param array $disabledApps * @param array $disabledApps
* @param bool $reenable
* @throws \Exception * @throws \Exception
*/ */
private function upgradeAppStoreApps(array $disabledApps) { private function upgradeAppStoreApps(array $disabledApps, $reenable = false) {
foreach($disabledApps as $app) { foreach($disabledApps as $app) {
try { try {
$this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]); $this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]);
@ -441,6 +443,11 @@ class Updater extends BasicEmitter {
$this->installer->updateAppstoreApp($app); $this->installer->updateAppstoreApp($app);
} }
$this->emit('\OC\Updater', 'checkAppStoreApp', [$app]); $this->emit('\OC\Updater', 'checkAppStoreApp', [$app]);
if ($reenable) {
$ocApp = new \OC_App();
$ocApp->enable($app);
}
} catch (\Exception $ex) { } catch (\Exception $ex) {
$this->log->logException($ex, ['app' => 'core']); $this->log->logException($ex, ['app' => 'core']);
} }

View File

@ -70,6 +70,7 @@ class OC_App {
static private $loadedApps = []; static private $loadedApps = [];
static private $altLogin = []; static private $altLogin = [];
static private $alreadyRegistered = []; static private $alreadyRegistered = [];
static public $autoDisabledApps = [];
const officialApp = 200; const officialApp = 200;
/** /**
@ -156,6 +157,7 @@ class OC_App {
if (!\OC::$server->getAppManager()->isShipped($app)) { if (!\OC::$server->getAppManager()->isShipped($app)) {
// Only disable apps which are not shipped // Only disable apps which are not shipped
\OC::$server->getAppManager()->disableApp($app); \OC::$server->getAppManager()->disableApp($app);
self::$autoDisabledApps[] = $app;
} }
} }
\OC::$server->getEventLogger()->end('load_app_' . $app); \OC::$server->getEventLogger()->end('load_app_' . $app);