Skip to content
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
15 changes: 15 additions & 0 deletions changelog/unreleased/39108
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Bugfix: Update appinfo cache only if the app version is newer

Previously, in case there were multiple copies of the same app with different
versions, the information being cached was the latest one found based on the
locations defined in the config.php file, which might not be the one from the
latest app version. This might be a problem in some scenarios specially checking
the version of the app. Note that the code used was the one from the latest app
version found.

Now, the information cached is always from the latest version found. In the
weird case that both versions are the same, the information from the first one
will be kept. This shouldn't be a problem because the information is expected
to be the same.

https://github.com/owncloud/core/pull/39108
6 changes: 5 additions & 1 deletion lib/private/App/AppManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,11 @@ public function getAppInfoByPath($path, $etag = null) {
];

// cache results for a day
$this->appInfo->set($appId, $data, 86400);
$appIdData = $this->appInfo->get($appId);
if ($appIdData === null || \version_compare($appIdData['info']['version'], $info['version']) === -1) {
// if no data is cached for the appId or the new one has a higher version, update cache
$this->appInfo->set($appId, $data, 86400);
}
$this->appInfo->set($file, $data, 86400);

return $info;
Expand Down