Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1324,11 +1324,6 @@
<code><![CDATA[$this->fastCache[$app][$key] ?? $default]]></code>
</NullableReturnStatement>
</file>
<file src="lib/private/AppFramework/Bootstrap/Coordinator.php">
<InvalidPropertyAssignmentValue>
<code><![CDATA[$this->bootedApps]]></code>
</InvalidPropertyAssignmentValue>
</file>
<file src="lib/private/AppFramework/Bootstrap/FunctionInjector.php">
<UndefinedMethod>
<code><![CDATA[getName]]></code>
Expand Down
51 changes: 5 additions & 46 deletions lib/private/App/AppManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

use OC\AppConfig;
use OC\AppFramework\Bootstrap\Coordinator;
use OC\ServerNotAvailableException;
use OCP\Activity\IManager as IActivityManager;
use OCP\App\AppPathNotFoundException;
use OCP\App\Events\AppDisableEvent;
Expand Down Expand Up @@ -251,7 +250,7 @@ public function loadApps(array $types = []): bool {
}
}

// prevent app.php from printing output
// prevent app loading from printing output
ob_start();
foreach ($apps as $app) {
if (!$this->isAppLoaded($app) && ($types === [] || $this->isType($app, $types))) {
Expand Down Expand Up @@ -452,43 +451,13 @@ public function loadApp(string $app): void {
// in case someone calls loadApp() directly
\OC_App::registerAutoloading($app, $appPath);

/** @var Coordinator $coordinator */
$coordinator = \OC::$server->get(Coordinator::class);
$isBootable = $coordinator->isBootable($app);

$hasAppPhpFile = is_file($appPath . '/appinfo/app.php');

if ($isBootable && $hasAppPhpFile) {
$this->logger->error('/appinfo/app.php is not loaded when \OCP\AppFramework\Bootstrap\IBootstrap on the application class is used. Migrate everything from app.php to the Application class.', [
if (is_file($appPath . '/appinfo/app.php')) {
$this->logger->error('/appinfo/app.php is not supported anymore, use \OCP\AppFramework\Bootstrap\IBootstrap on the application class instead.', [
'app' => $app,
]);
} elseif ($hasAppPhpFile) {
$eventLogger->start("bootstrap:load_app:$app:app.php", "Load legacy app.php app $app");
$this->logger->debug('/appinfo/app.php is deprecated, use \OCP\AppFramework\Bootstrap\IBootstrap on the application class instead.', [
'app' => $app,
]);
try {
self::requireAppFile($appPath);
} catch (\Throwable $ex) {
if ($ex instanceof ServerNotAvailableException) {
throw $ex;
}
if (!$this->isShipped($app) && !$this->isType($app, ['authentication'])) {
$this->logger->error("App $app threw an error during app.php load and will be disabled: " . $ex->getMessage(), [
'exception' => $ex,
]);

// Only disable apps which are not shipped and that are not authentication apps
$this->disableApp($app, true);
} else {
$this->logger->error("App $app threw an error during app.php load: " . $ex->getMessage(), [
'exception' => $ex,
]);
}
}
$eventLogger->end("bootstrap:load_app:$app:app.php");
}

$coordinator = \OCP\Server::get(Coordinator::class);
$coordinator->bootApp($app);

$eventLogger->start("bootstrap:load_app:$app:info", "Load info.xml for $app and register any services defined in it");
Expand Down Expand Up @@ -560,6 +529,7 @@ public function loadApp(string $app): void {

$eventLogger->end("bootstrap:load_app:$app");
}

/**
* Check if an app is loaded
* @param string $app app id
Expand All @@ -569,17 +539,6 @@ public function isAppLoaded(string $app): bool {
return isset($this->loadedApps[$app]);
}

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

/**
* Enable an app for every user
*
Expand Down
4 changes: 2 additions & 2 deletions lib/private/AppFramework/Bootstrap/Coordinator.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class Coordinator {
/** @var RegistrationContext|null */
private $registrationContext;

/** @var string[] */
private $bootedApps = [];
/** @var array<string,true> */
private array $bootedApps = [];

public function __construct(
private IServerContainer $serverContainer,
Expand Down
2 changes: 0 additions & 2 deletions lib/public/AppFramework/Bootstrap/IBootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ public function register(IRegistrationContext $context): void;
* At this stage you can assume that all services are registered and the DI
* container(s) are ready to be queried.
*
* This is also the state where an optional `appinfo/app.php` was loaded.
*
* @param IBootContext $context
*
* @since 20.0.0
Expand Down
Loading