aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2025-04-14 14:30:00 +0200
committerCôme Chilliet <come.chilliet@nextcloud.com>2025-04-14 14:30:00 +0200
commit92038229fa8d911166aee15c10ec5ee4554fb690 (patch)
tree2dd495e8de9bd289b28a2db660541cb156c2a1e7
parent988da9622c56bf9bd00ceb22c7b11acc8f6242c8 (diff)
downloadnextcloud-server-92038229fa8d911166aee15c10ec5ee4554fb690.tar.gz
nextcloud-server-92038229fa8d911166aee15c10ec5ee4554fb690.zip
fix: Remove support for app.php loading
It has been deprecated for a long time, and the last known active application to use it (user_saml) is now migrated the modern API. Presence of the file is still checked in order to log an error. This behavior may be removed as well in a few versions. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r--lib/private/App/AppManager.php51
-rw-r--r--lib/private/AppFramework/Bootstrap/Coordinator.php4
-rw-r--r--lib/public/AppFramework/Bootstrap/IBootstrap.php2
3 files changed, 7 insertions, 50 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php
index 740da31770d..f6494fa946d 100644
--- a/lib/private/App/AppManager.php
+++ b/lib/private/App/AppManager.php
@@ -8,7 +8,6 @@ namespace OC\App;
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;
@@ -251,7 +250,7 @@ class AppManager implements IAppManager {
}
}
- // 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))) {
@@ -452,43 +451,13 @@ class AppManager implements IAppManager {
// 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");
@@ -560,6 +529,7 @@ class AppManager implements IAppManager {
$eventLogger->end("bootstrap:load_app:$app");
}
+
/**
* Check if an app is loaded
* @param string $app app id
@@ -570,17 +540,6 @@ class AppManager implements IAppManager {
}
/**
- * 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
*
* @param string $appId
diff --git a/lib/private/AppFramework/Bootstrap/Coordinator.php b/lib/private/AppFramework/Bootstrap/Coordinator.php
index 4e78450fa04..2b04d291730 100644
--- a/lib/private/AppFramework/Bootstrap/Coordinator.php
+++ b/lib/private/AppFramework/Bootstrap/Coordinator.php
@@ -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,
diff --git a/lib/public/AppFramework/Bootstrap/IBootstrap.php b/lib/public/AppFramework/Bootstrap/IBootstrap.php
index 81c34524191..7260d2b77a1 100644
--- a/lib/public/AppFramework/Bootstrap/IBootstrap.php
+++ b/lib/public/AppFramework/Bootstrap/IBootstrap.php
@@ -25,8 +25,6 @@ interface IBootstrap {
* 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