diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-09-12 16:38:35 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-09-13 10:08:44 +0200 |
commit | 76f2bc0bfc86a9d1ed34d37c574c7e7a327c0fab (patch) | |
tree | 74bb396c0324eca612b1cec1ec2f0c20a77fb942 /lib/private/App/AppManager.php | |
parent | 7ed583cb8ee64f77696b0e23f79d8d1b4038bcbc (diff) | |
download | nextcloud-server-76f2bc0bfc86a9d1ed34d37c574c7e7a327c0fab.tar.gz nextcloud-server-76f2bc0bfc86a9d1ed34d37c574c7e7a327c0fab.zip |
fix: Replace OC_App::getAllApps with a method in AppManager
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/App/AppManager.php')
-rw-r--r-- | lib/private/App/AppManager.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index 974545cfe92..4ffddef98c3 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -156,6 +156,37 @@ class AppManager implements IAppManager { } /** + * Get a list of all apps in the apps folder + * + * @return list<string> an array of app names (string IDs) + */ + public function getAllAppsInAppsFolders(): array { + $apps = []; + + foreach (\OC::$APPSROOTS as $apps_dir) { + if (!is_readable($apps_dir['path'])) { + $this->logger->warning('unable to read app folder : ' . $apps_dir['path'], ['app' => 'core']); + continue; + } + $dh = opendir($apps_dir['path']); + + if (is_resource($dh)) { + while (($file = readdir($dh)) !== false) { + if ( + $file[0] != '.' && + is_dir($apps_dir['path'] . '/' . $file) && + is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml') + ) { + $apps[] = $file; + } + } + } + } + + return array_values(array_unique($apps)); + } + + /** * List all apps enabled for a user * * @param \OCP\IUser $user |