Merge pull request #8631 from nextcloud/stable13-8372

[13] Properly encapsulate require_once for app.php
This commit is contained in:
Joas Schilling 2018-03-05 12:35:50 +01:00 committed by GitHub
commit 479b9465c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 11 deletions

View File

@ -136,6 +136,7 @@ class OC_App {
* load a single app * load a single app
* *
* @param string $app * @param string $app
* @throws Exception
*/ */
public static function loadApp($app) { public static function loadApp($app) {
self::$loadedApps[] = $app; self::$loadedApps[] = $app;
@ -149,7 +150,15 @@ class OC_App {
if (is_file($appPath . '/appinfo/app.php')) { if (is_file($appPath . '/appinfo/app.php')) {
\OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app); \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'))) { if (self::isType($app, array('authentication'))) {
// since authentication apps affect the "is app enabled for group" check, // since authentication apps affect the "is app enabled for group" check,
// the enabled apps cache needs to be cleared to make sure that the // the enabled apps cache needs to be cleared to make sure that the
@ -229,18 +238,11 @@ class OC_App {
* Load app.php from the given app * Load app.php from the given app
* *
* @param string $app app name * @param string $app app name
* @throws Error
*/ */
private static function requireAppFile($app) { private static function requireAppFile($app) {
try { // encapsulated here to avoid variable scope conflicts
// encapsulated here to avoid variable scope conflicts require_once $app . '/appinfo/app.php';
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);
}
}
} }
/** /**