diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2023-01-26 10:38:20 -0100 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2023-02-01 16:18:50 +0000 |
commit | 68cda6ee1d71b49220a35a4cf57398a11cac5721 (patch) | |
tree | 772473fce8146eb08a2002a99f807359c89566c2 /lib | |
parent | 8c19ef21a8b35d3f2326a4f31cf4d84955137f6e (diff) | |
download | nextcloud-server-68cda6ee1d71b49220a35a4cf57398a11cac5721.tar.gz nextcloud-server-68cda6ee1d71b49220a35a4cf57398a11cac5721.zip |
refresh cached app folder on install/upgrade
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/legacy/OC_App.php | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index f5e4780a25f..916cfee363d 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -478,16 +478,17 @@ class OC_App { * search for an app in all app-directories * * @param string $appId + * @param bool $ignoreCache ignore cache and rebuild it * @return false|string */ - public static function findAppInDirectories(string $appId) { + public static function findAppInDirectories(string $appId, bool $ignoreCache = false) { $sanitizedAppId = self::cleanAppId($appId); if ($sanitizedAppId !== $appId) { return false; } static $app_dir = []; - if (isset($app_dir[$appId])) { + if (isset($app_dir[$appId]) && !$ignoreCache) { return $app_dir[$appId]; } @@ -528,15 +529,16 @@ class OC_App { * @psalm-taint-specialize * * @param string $appId + * @param bool $refreshAppPath should be set to true only during install/upgrade * @return string|false * @deprecated 11.0.0 use \OC::$server->getAppManager()->getAppPath() */ - public static function getAppPath(string $appId) { + public static function getAppPath(string $appId, bool $refreshAppPath = false) { if ($appId === null || trim($appId) === '') { return false; } - if (($dir = self::findAppInDirectories($appId)) != false) { + if (($dir = self::findAppInDirectories($appId, $refreshAppPath)) != false) { return $dir['path'] . '/' . $appId; } return false; @@ -974,7 +976,9 @@ class OC_App { * @return bool */ public static function updateApp(string $appId): bool { - $appPath = self::getAppPath($appId); + // for apps distributed with core, we refresh app path in case the downloaded version + // have been installed in custom apps and not in the default path + $appPath = self::getAppPath($appId, true); if ($appPath === false) { return false; } |