diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-02-15 15:47:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-15 15:47:22 +0100 |
commit | e97ae9aac5e9fbd1001c5f528d803fa89b0f2dee (patch) | |
tree | f6e3f551150736ef09e61ace14565a7226d0f7a5 | |
parent | b7ee624988c4d0e39da884834ef51b2be4350fbc (diff) | |
parent | f36e8313ff0c174332ecb71ba19167f1a002450a (diff) | |
download | nextcloud-server-e97ae9aac5e9fbd1001c5f528d803fa89b0f2dee.tar.gz nextcloud-server-e97ae9aac5e9fbd1001c5f528d803fa89b0f2dee.zip |
Merge pull request #8372 from nextcloud/encapsulate-app-require
Properly encapsulate require_once for app.php
-rw-r--r-- | lib/private/legacy/app.php | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index b19d63f560e..9384582bac3 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -133,6 +133,7 @@ class OC_App { * load a single app * * @param string $app + * @throws Exception */ public static function loadApp($app) { self::$loadedApps[] = $app; @@ -146,7 +147,15 @@ class OC_App { if (is_file($appPath . '/appinfo/app.php')) { \OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app); - self::requireAppFile($app); + try { + self::requireAppFile($app); + } catch (Error $ex) { + \OC::$server->getLogger()->logException($ex); + if (!\OC::$server->getAppManager()->isShipped($app)) { + // Only disable apps which are not shipped + self::disable($app); + } + } if (self::isType($app, array('authentication'))) { // since authentication apps affect the "is app enabled for group" check, // the enabled apps cache needs to be cleared to make sure that the @@ -248,18 +257,11 @@ class OC_App { * Load app.php from the given app * * @param string $app app name + * @throws Error */ private static function requireAppFile($app) { - try { - // encapsulated here to avoid variable scope conflicts - require_once $app . '/appinfo/app.php'; - } catch (Error $ex) { - \OC::$server->getLogger()->logException($ex); - if (!\OC::$server->getAppManager()->isShipped($app)) { - // Only disable apps which are not shipped - self::disable($app); - } - } + // encapsulated here to avoid variable scope conflicts + require_once $app . '/appinfo/app.php'; } /** |