Skip to content

Commit

Permalink
fix(upgrade): exception when upgrading from 27 to 28
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
  • Loading branch information
blizzz committed Mar 14, 2024
1 parent a3dd3d7 commit 8ccc110
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []) {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 8ccc110

Please sign in to comment.