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

Fix app management not providing updates for apps which got disabled #10508

Merged
merged 3 commits into from
Aug 2, 2018
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
2 changes: 1 addition & 1 deletion lib/private/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public function isUpdateAvailable($appId) {
if($app['id'] === $appId) {
$currentVersion = OC_App::getAppVersion($appId);
$newestVersion = $app['releases'][0]['version'];
if (version_compare($newestVersion, $currentVersion, '>')) {
if ($currentVersion !== '0' && version_compare($newestVersion, $currentVersion, '>')) {
Copy link
Member

Choose a reason for hiding this comment

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

when will it be '0'?

Copy link
Member

Choose a reason for hiding this comment

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

Ah I should read the commit messages

Copy link
Member Author

Choose a reason for hiding this comment

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

if(!$useCache || !isset($this->appVersions[$appId])) {
$appInfo = \OC::$server->getAppManager()->getAppInfo($appId);
$this->appVersions[$appId] = ($appInfo !== null && isset($appInfo['version'])) ? $appInfo['version'] : '0';
}

When the app is not "available". so basically when it's only in the response of the appstore but can not be found locally

return $newestVersion;
} else {
return false;
Expand Down
4 changes: 2 additions & 2 deletions settings/Controller/AppSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private function fetchApps() {
if (!array_key_exists($app['id'], $this->allApps)) {
$this->allApps[$app['id']] = $app;
} else {
$this->allApps[$app['id']] = array_merge($this->allApps[$app['id']], $app);
$this->allApps[$app['id']] = array_merge($app, $this->allApps[$app['id']]);
}
}

Expand Down Expand Up @@ -256,7 +256,7 @@ public function listApps(): JSONResponse {
$appData['category'] = $appstoreData['categories'];

$newVersion = $this->installer->isUpdateAvailable($appData['id']);
if($newVersion && $this->appManager->isInstalled($appData['id'])) {
if($newVersion) {
$appData['update'] = $newVersion;
}

Expand Down