From c7cd00d0f893fa520b5d889c890ce00e069fa32d Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 28 Aug 2017 10:22:50 +0200 Subject: [PATCH 1/2] Improve market upgrade messages + new switch Improve market upgrade messages. Added switch to disable automatic app updates during occ upgrade. --- config/config.sample.php | 5 +++++ lib/private/Repair/Apps.php | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/config/config.sample.php b/config/config.sample.php index e142816231c9..20b7a55d226f 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -1370,6 +1370,11 @@ */ 'upgrade.disable-web' => false, +/** + * Automatic update of market apps, set to "false" to disable. + */ +'upgrade.automatic-app-update' => true, + /** * Set this ownCloud instance to debugging mode * diff --git a/lib/private/Repair/Apps.php b/lib/private/Repair/Apps.php index a512ac0c377c..5c52dbb7a56c 100644 --- a/lib/private/Repair/Apps.php +++ b/lib/private/Repair/Apps.php @@ -114,6 +114,7 @@ public function run(IOutput $output) { $link = $this->defaults->buildDocLinkToKey('admin-marketplace-apps'); $output->info('No internet connection available - no app updates will be taken from the marketplace.'); $output->info("How to update apps in such situation please see $link"); + $this->appManager->disableApp('market'); return; } $appsToUpgrade = $this->getAppsToUpgrade(); @@ -124,6 +125,14 @@ public function run(IOutput $output) { // fix market app state $shallContactMarketplace = $this->fixMarketAppState($output); + + // market might be enabled but admin does not want to automatically update apps through it + // (they might want to manually click through the updates in the web UI so keeping the + // market enabled here is a legitimate use case) + if ($this->config->getSystemValue('upgrade.automatic-app-update', true) !== true) { + $shallContactMarketplace = false; + } + if ($shallContactMarketplace) { // Check if we can use the marketplace to update apps as needed? if ($this->appManager->isEnabledForUser('market')) { @@ -167,7 +176,8 @@ public function run(IOutput $output) { } } else { // No market available, output error and continue attempt - $output->warning('Market app is unavailable for updating of apps. Enable with: occ app:enable market'); + $link = $this->defaults->buildDocLinkToKey('admin-marketplace-apps'); + $output->warning("Market app is unavailable for updating of apps. Please update manually, see $link"); } } @@ -178,9 +188,11 @@ public function run(IOutput $output) { // fail $output->warning('You have incompatible or missing apps enabled that could not be found or updated via the marketplace.'); $output->warning( - 'please install app manually with tarball or disable them with:' + 'Please install or update the following apps manually or disable them with:' . $this->getOccDisableMessage(array_merge($failedIncompatibleApps, $failedMissingApps)) ); + $link = $this->defaults->buildDocLinkToKey('admin-marketplace-apps'); + $output->warning("For manually updating, see $link"); throw new RepairException('Upgrade is not possible'); } elseif ($hasNotUpdatedCompatibleApps) { @@ -314,6 +326,7 @@ private function fixMarketAppState(IOutput $output) { $output->info("Please note that the market app is not recommended for clustered setups - see $link"); return false; } + // Then we need to enable the market app to support app updates / downloads during upgrade $output->info('Enabling market app to assist with update'); $this->appManager->enableApp('market'); From e3a5eec7f566185a55d9e3807e9212032890a59d Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 28 Aug 2017 10:39:25 +0200 Subject: [PATCH 2/2] Always check incompatible apps on update Even if no internet connection is available, we still need to verify that there are no incompatible apps on upgrade and show an appropriate message. --- lib/private/Repair/Apps.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/private/Repair/Apps.php b/lib/private/Repair/Apps.php index 5c52dbb7a56c..3bca4de0fcd7 100644 --- a/lib/private/Repair/Apps.php +++ b/lib/private/Repair/Apps.php @@ -115,7 +115,6 @@ public function run(IOutput $output) { $output->info('No internet connection available - no app updates will be taken from the marketplace.'); $output->info("How to update apps in such situation please see $link"); $this->appManager->disableApp('market'); - return; } $appsToUpgrade = $this->getAppsToUpgrade(); $failedCompatibleApps = [];