Small cleanups for AppManager

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2023-02-08 13:29:57 +01:00
parent 78c1716818
commit 13c71ed24a
No known key found for this signature in database
GPG key ID: A3E2F658B28C760A
3 changed files with 6 additions and 3 deletions

View file

@ -237,7 +237,7 @@ class AppManager implements IAppManager {
public function isType(string $app, array $types): bool {
$appTypes = $this->getAppTypes($app);
foreach ($types as $type) {
if (array_search($type, $appTypes) !== false) {
if (in_array($type, $appTypes, true)) {
return true;
}
}
@ -253,7 +253,7 @@ class AppManager implements IAppManager {
private function getAppTypes(string $app): array {
//load the cache
if (count($this->appTypes) === 0) {
$this->appTypes = \OC::$server->getAppConfig()->getValues(false, 'types');
$this->appTypes = $this->appConfig->getValues(false, 'types') ?: [];
}
if (isset($this->appTypes[$app])) {

View file

@ -98,6 +98,7 @@ class OC_App {
*
* @param string $app
* @return bool
* @deprecated 26.0.0 use IAppManager::isAppLoaded
*/
public static function isAppLoaded(string $app): bool {
return \OC::$server->get(IAppManager::class)->isAppLoaded($app);
@ -128,6 +129,7 @@ class OC_App {
*
* @param string $app
* @throws Exception
* @deprecated 26.0.0 use IAppManager::loadApp
*/
public static function loadApp(string $app): void {
\OC::$server->get(IAppManager::class)->loadApp($app);
@ -169,7 +171,7 @@ class OC_App {
* @param string $app
* @param array $types
* @return bool
* @deprecated 26.0.0 call \OC::$server->get(IAppManager::class)->isType($app, $types)
* @deprecated 26.0.0 use IAppManager::isType
*/
public static function isType(string $app, array $types): bool {
return \OC::$server->get(IAppManager::class)->isType($app, $types);

View file

@ -207,6 +207,7 @@ interface IAppManager {
* exists.
*
* if $types is set to non-empty array, only apps of those types will be loaded
* @since 26.0.0
*/
public function loadApps(array $types = []): bool;