From 8ccc110e8db4ccc65205636a2ec02781e684775a Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 14 Mar 2024 18:37:03 +0100 Subject: [PATCH] fix(upgrade): exception when upgrading from 27 to 28 - the Application class is loaded before replacing the files - therefore old code is execute, incompatible with 28, which has to be loaded in the constructor as we cannot move to IBootstrap yet - deprecated components are replaced so that an upgrade will not break again on 28 Signed-off-by: Arthur Schiwon --- lib/AppInfo/Application.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 49a3ffc38..011b38125 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -21,12 +21,18 @@ namespace OCA\User_SAML\AppInfo; +use OCA\Files\Event\LoadAdditionalScriptsEvent; use OCA\User_SAML\DavPlugin; use OCA\User_SAML\Middleware\OnlyLoggedInMiddleware; use OCA\User_SAML\SAMLSettings; use OCP\AppFramework\App; use OCP\AppFramework\IAppContainer; +use OCP\EventDispatcher\IEventDispatcher; +use OCP\IConfig; +use OCP\ISession; +use OCP\IUserSession; use OCP\SabrePluginEvent; +use OCP\Server; class Application extends App { public function __construct(array $urlParams = []) { @@ -68,14 +74,12 @@ public function registerDavAuth() { } private function timezoneHandling() { - $container = $this->getContainer(); - - $userSession = $container->getServer()->getUserSession(); - $session = $container->getServer()->getSession(); - $config = $container->getServer()->getConfig(); + $userSession = Server::get(IUserSession::class); + $session = Server::get(ISession::class); + $config = Server::get(IConfig::class); + $dispatcher = Server::get(IEventDispatcher::class); - $dispatcher = $container->getServer()->getEventDispatcher(); - $dispatcher->addListener('OCA\Files::loadAdditionalScripts', function () use ($session, $config, $userSession) { + $dispatcher->addListener(LoadAdditionalScriptsEvent::class, function () use ($session, $config, $userSession) { if (!$userSession->isLoggedIn()) { return; }