diff options
-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 |