Skip to content

Commit

Permalink
Merge pull request #11634 from owncloud/loadapps-encapsulaterequire
Browse files Browse the repository at this point in the history
Encapsulate require_once to avoid name space bleedind
  • Loading branch information
LukasReschke committed Oct 17, 2014
2 parents 2e875bc + 27c22f0 commit 439b33e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/private/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static function loadApp($app, $checkUpgrade = true) {
if ($checkUpgrade and self::shouldUpgrade($app)) {
throw new \OC\NeedsUpdateException();
}
require_once $app . '/appinfo/app.php';
self::requireAppFile($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
Expand All @@ -103,6 +103,16 @@ public static function loadApp($app, $checkUpgrade = true) {
}
}

/**
* Load app.php from the given app
*
* @param string $app app name
*/
private static function requireAppFile($app) {
// encapsulated here to avoid variable scope conflicts
require_once $app . '/appinfo/app.php';
}

/**
* check if an app is of a specific type
*
Expand Down

0 comments on commit 439b33e

Please sign in to comment.