Skip to content

Commit

Permalink
Fixes owncloud/openidconnect#112 for all apps
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDiver1975 committed Oct 26, 2020
1 parent 5711a60 commit 7df84e7
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions lib/private/legacy/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
use OC\App\DependencyAnalyzer;
use OC\App\Platform;
use OC\Installer;
use OC\NeedsUpdateException;
use OC\Repair;

/**
Expand Down Expand Up @@ -168,7 +169,7 @@ public static function loadApps($types = null) {
*
* @param string $app
* @param bool $checkUpgrade whether an upgrade check should be done
* @throws \OC\NeedsUpdateException
* @throws NeedsUpdateException
*/
public static function loadApp($app, $checkUpgrade = true) {
self::$loadedApps[] = $app;
Expand All @@ -184,10 +185,24 @@ public static function loadApp($app, $checkUpgrade = true) {

if (\is_file($appPath . '/appinfo/app.php')) {
\OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app);
if ($checkUpgrade and self::shouldUpgrade($app)) {
throw new \OC\NeedsUpdateException();
if ($checkUpgrade && self::shouldUpgrade($app)) {
throw new NeedsUpdateException();
}
try {
self::requireAppFile($app);
} catch (Exception $ex) {
\OC::$server->getLogger()->logException($ex);
$blacklist = \OC::$server->getAppManager()->getAlwaysEnabledApps();
if (!\in_array($app, $blacklist)) {
if (!self::isType($app, ['authentication', 'filesystem'])) {
\OC::$server->getLogger()->warning('Could not load app "' . $app . '", it will be disabled', ['app' => 'core']);
self::disable($app);
} else {
\OC::$server->getLogger()->warning('Could not load app "' . $app . '", see exception above', ['app' => 'core']);
}
}
throw $ex;
}
self::requireAppFile($app);
if (self::isType($app, ['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 Down Expand Up @@ -234,22 +249,8 @@ public static function registerAutoloading($app, $path) {
* @param string $app app name
*/
private static function requireAppFile($app) {
try {
// encapsulated here to avoid variable scope conflicts
require_once self::getAppPath($app) . '/appinfo/app.php';
} catch (Exception $ex) {
\OC::$server->getLogger()->logException($ex);
$blacklist = \OC::$server->getAppManager()->getAlwaysEnabledApps();
if (!\in_array($app, $blacklist)) {
if (!self::isType($app, ['authentication', 'filesystem'])) {
\OC::$server->getLogger()->warning('Could not load app "' . $app . '", it will be disabled', ['app' => 'core']);
self::disable($app);
} else {
\OC::$server->getLogger()->warning('Could not load app "' . $app . '", see exception above', ['app' => 'core']);
}
}
throw $ex;
}
// encapsulated here to avoid variable scope conflicts
require_once self::getAppPath($app) . '/appinfo/app.php';
}

/**
Expand Down Expand Up @@ -1010,7 +1011,7 @@ public static function updateApp($appId) {
/**
* @param string $appId
* @param string[] $steps
* @throws \OC\NeedsUpdateException
* @throws NeedsUpdateException
*/
public static function executeRepairSteps($appId, array $steps) {
if (empty($steps)) {
Expand Down

0 comments on commit 7df84e7

Please sign in to comment.