mirror of
https://github.com/nextcloud/server.git
synced 2026-02-27 18:37:17 +01:00
fix: Use only enabled applications versions in the cache prefix
This makes sure the cached routes are updated after enabling a previously disabled application Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
@@ -18,6 +18,7 @@ use OCP\Collaboration\AutoComplete\IManager as IAutoCompleteManager;
|
||||
use OCP\Collaboration\Collaborators\ISearch as ICollaboratorSearch;
|
||||
use OCP\Diagnostics\IEventLogger;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\IAppConfig;
|
||||
use OCP\ICacheFactory;
|
||||
use OCP\IConfig;
|
||||
use OCP\IGroup;
|
||||
@@ -134,7 +135,7 @@ class AppManager implements IAppManager {
|
||||
*/
|
||||
private function getEnabledAppsValues(): array {
|
||||
if (!$this->enabledAppsCache) {
|
||||
$values = $this->getAppConfig()->getValues(false, 'enabled');
|
||||
$values = $this->getAppConfig()->searchValues('enabled', false, IAppConfig::VALUE_STRING);
|
||||
|
||||
$alwaysEnabledApps = $this->getAlwaysEnabledApps();
|
||||
foreach ($alwaysEnabledApps as $appId) {
|
||||
@@ -784,8 +785,8 @@ class AppManager implements IAppManager {
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function getAppInstalledVersions(): array {
|
||||
return $this->getAppConfig()->getAppInstalledVersions();
|
||||
public function getAppInstalledVersions(bool $onlyEnabled = false): array {
|
||||
return $this->getAppConfig()->getAppInstalledVersions($onlyEnabled);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1670,11 +1670,18 @@ class AppConfig implements IAppConfig {
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function getAppInstalledVersions(): array {
|
||||
public function getAppInstalledVersions(bool $onlyEnabled = false): array {
|
||||
if ($this->appVersionsCache === null) {
|
||||
/** @var array<string, string> */
|
||||
$this->appVersionsCache = $this->searchValues('installed_version', false, IAppConfig::VALUE_STRING);
|
||||
}
|
||||
if ($onlyEnabled) {
|
||||
return array_filter(
|
||||
$this->appVersionsCache,
|
||||
fn (string $app): bool => $this->getValueString($app, 'enabled', 'no') !== 'no',
|
||||
ARRAY_FILTER_USE_KEY
|
||||
);
|
||||
}
|
||||
return $this->appVersionsCache;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ class AppConfig implements IAppConfig {
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function getAppInstalledVersions(): array {
|
||||
return $this->appConfig->getAppInstalledVersions();
|
||||
public function getAppInstalledVersions(bool $onlyEnabled = false): array {
|
||||
return $this->appConfig->getAppInstalledVersions($onlyEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -605,7 +605,7 @@ class Server extends ServerContainer implements IServerContainer {
|
||||
$prefixClosure = function () use ($logQuery, $serverVersion): ?string {
|
||||
if (!$logQuery) {
|
||||
try {
|
||||
$v = \OCP\Server::get(IAppConfig::class)->getAppInstalledVersions();
|
||||
$v = \OCP\Server::get(IAppConfig::class)->getAppInstalledVersions(true);
|
||||
} catch (\Doctrine\DBAL\Exception $e) {
|
||||
// Database service probably unavailable
|
||||
// Probably related to https://github.com/nextcloud/server/issues/37424
|
||||
|
||||
@@ -201,7 +201,7 @@ class TemplateLayout {
|
||||
|
||||
if ($this->config->getSystemValueBool('installed', false)) {
|
||||
if (empty(self::$versionHash)) {
|
||||
$v = $this->appManager->getAppInstalledVersions();
|
||||
$v = $this->appManager->getAppInstalledVersions(true);
|
||||
$v['core'] = implode('.', $this->serverVersion->getVersion());
|
||||
self::$versionHash = substr(md5(implode(',', $v)), 0, 8);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ interface IAppManager {
|
||||
* @return array<string, string>
|
||||
* @since 32.0.0
|
||||
*/
|
||||
public function getAppInstalledVersions(): array;
|
||||
public function getAppInstalledVersions(bool $onlyEnabled = false): array;
|
||||
|
||||
/**
|
||||
* Returns the app icon or null if none is found
|
||||
|
||||
@@ -514,5 +514,5 @@ interface IAppConfig {
|
||||
* @return array<string, string>
|
||||
* @since 32.0.0
|
||||
*/
|
||||
public function getAppInstalledVersions(): array;
|
||||
public function getAppInstalledVersions(bool $onlyEnabled = false): array;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user