Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve market upgrade messages + new switch #28812

Merged
merged 2 commits into from
Aug 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,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
*
Expand Down
18 changes: 15 additions & 3 deletions lib/private/Repair/Apps.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +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");
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will likely change the behaviour. Is it fine?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is intended. We should not return directly because even if we don't attempt contacting the marketplace, we should still check if there is any incompatible app or app missing code blocking the update. Returning here would bypass the check and result in a broken OC in such scenarios.

$this->appManager->disableApp('market');
}
$appsToUpgrade = $this->getAppsToUpgrade();
$failedCompatibleApps = [];
Expand All @@ -124,6 +124,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')) {
Expand Down Expand Up @@ -167,7 +175,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");
}
}

Expand All @@ -178,9 +187,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) {
Expand Down Expand Up @@ -314,6 +325,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');
Expand Down