diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-02-17 15:22:00 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-02-17 15:27:43 +0100 |
commit | edee243b27f7d042998fd840d0b0f75548e3c489 (patch) | |
tree | 8df7b5c25badad8e00a12f8e0479c7f9d1650f30 | |
parent | 2a2833e30fcc2b330ff603aae8cf8a8ed298a89b (diff) | |
download | nextcloud-server-edee243b27f7d042998fd840d0b0f75548e3c489.tar.gz nextcloud-server-edee243b27f7d042998fd840d0b0f75548e3c489.zip |
OC_App::loadApps now only accepts an array as type list
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
-rw-r--r-- | apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php | 2 | ||||
-rw-r--r-- | lib/private/Updater.php | 4 | ||||
-rw-r--r-- | lib/private/legacy/app.php | 15 |
3 files changed, 9 insertions, 12 deletions
diff --git a/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php b/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php index 32dfb72d9c1..764c14bafe7 100644 --- a/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php +++ b/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php @@ -96,7 +96,7 @@ class ExceptionOnLostConnection { */ public function setUp() { require_once __DIR__ . '/../../../../lib/base.php'; - \OC_App::loadApps('user_ldap'); + \OC_App::loadApps(['user_ldap']); $ch = $this->getCurl(); $proxyInfoJson = curl_exec($ch); diff --git a/lib/private/Updater.php b/lib/private/Updater.php index 43096e7c1f8..727147e0905 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -250,7 +250,7 @@ class Updater extends BasicEmitter { $this->upgradeAppStoreApps(\OC::$server->getAppManager()->getInstalledApps()); // install new shipped apps on upgrade - OC_App::loadApps('authentication'); + OC_App::loadApps(['authentication']); $errors = Installer::installShippedApps(true); foreach ($errors as $appId => $exception) { /** @var \Exception $exception */ @@ -346,7 +346,7 @@ class Updater extends BasicEmitter { if(!isset($stacks[$type])) { $stacks[$type] = array(); } - if (\OC_App::isType($appId, $type)) { + if (\OC_App::isType($appId, [$type])) { $stacks[$type][] = $appId; $priorityType = true; break; diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index c0794cdfa8d..f04310041ac 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -93,16 +93,16 @@ class OC_App { /** * loads all apps * - * @param string[] | string | null $types + * @param string[] $types * @return bool * * This function walks through the ownCloud directory and loads all apps * it can find. A directory contains an app if the file /appinfo/info.xml * exists. * - * if $types is set, only apps of those types will be loaded + * if $types is set to non-empty array, only apps of those types will be loaded */ - public static function loadApps($types = null) { + public static function loadApps(array $types = []): bool { if (\OC::$server->getSystemConfig()->getValue('maintenance', false)) { return false; } @@ -120,7 +120,7 @@ class OC_App { // prevent app.php from printing output ob_start(); foreach ($apps as $app) { - if ((is_null($types) or self::isType($app, $types)) && !in_array($app, self::$loadedApps)) { + if (($types === [] or self::isType($app, $types)) && !in_array($app, self::$loadedApps)) { self::loadApp($app); } } @@ -268,13 +268,10 @@ class OC_App { * check if an app is of a specific type * * @param string $app - * @param string|array $types + * @param array $types * @return bool */ - public static function isType($app, $types) { - if (is_string($types)) { - $types = array($types); - } + public static function isType(string $app, array $types): bool { $appTypes = self::getAppTypes($app); foreach ($types as $type) { if (array_search($type, $appTypes) !== false) { |