diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2025-03-24 17:02:50 +0100 |
---|---|---|
committer | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2025-03-25 14:12:17 +0100 |
commit | 32c1e3e677a117501e51f27731d4b6e7f0484e14 (patch) | |
tree | 220d089d940dfc0e66d54becb0b7b41358fae466 | |
parent | d1383602c767bd925c00b7642d062c06aa4012a3 (diff) | |
download | nextcloud-server-32c1e3e677a117501e51f27731d4b6e7f0484e14.tar.gz nextcloud-server-32c1e3e677a117501e51f27731d4b6e7f0484e14.zip |
feat: Add a replacement for OC_App::getAppVersions is IAppManager
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r-- | lib/private/App/AppManager.php | 16 | ||||
-rw-r--r-- | lib/private/legacy/OC_App.php | 4 | ||||
-rw-r--r-- | lib/public/App/IAppManager.php | 8 |
3 files changed, 26 insertions, 2 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index 067cc89d674..d7fd0c33a30 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -19,6 +19,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; @@ -812,6 +813,21 @@ class AppManager implements IAppManager { } /** + * Returns the installed versions of all apps + * + * @return array<string, string> + */ + public function getAppInstalledVersions(): array { + static $versions; + + if (!$versions) { + /** @var array<string, string> */ + $versions = $this->getAppConfig()->searchValues('installed_version', false, IAppConfig::VALUE_STRING); + } + return $versions; + } + + /** * Returns a list of apps incompatible with the given version * * @param string $version Nextcloud version as array of version components diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index 7fee946b776..8f3284b0955 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -456,10 +456,9 @@ class OC_App { /** * List all supported apps * - * @return array + * @deprecated 32.0.0 Use \OCP\Support\Subscription\IRegistry::delegateGetSupportedApps instead */ public function getSupportedApps(): array { - /** @var \OCP\Support\Subscription\IRegistry $subscriptionRegistry */ $subscriptionRegistry = \OCP\Server::get(\OCP\Support\Subscription\IRegistry::class); $supportedApps = $subscriptionRegistry->delegateGetSupportedApps(); return $supportedApps; @@ -643,6 +642,7 @@ class OC_App { /** * get the installed version of all apps + * @deprecated 32.0.0 Use IAppManager::getAppInstalledVersions instead */ public static function getAppVersions() { static $versions; diff --git a/lib/public/App/IAppManager.php b/lib/public/App/IAppManager.php index fa35819b779..67ef2d796be 100644 --- a/lib/public/App/IAppManager.php +++ b/lib/public/App/IAppManager.php @@ -52,6 +52,14 @@ interface IAppManager { public function getAppVersion(string $appId, bool $useCache = true): string; /** + * Returns the installed version of all apps + * + * @return array<string, string> + * @since 32.0.0 + */ + public function getAppInstalledVersions(): array; + + /** * Returns the app icon or null if none is found * * @param string $appId |