Skip to content

Commit

Permalink
Merge pull request #818 from nextcloud/fix/811/upgrade-27-to-28
Browse files Browse the repository at this point in the history
[stable-5.2] fix(upgrade): exception when upgrading from 27 to 28
  • Loading branch information
blizzz authored Mar 20, 2024
2 parents a3dd3d7 + 7a51b44 commit 8d34267
Show file tree
Hide file tree
Showing 2 changed files with 19 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
8 changes: 8 additions & 0 deletions tests/stub.phpstub
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace OCA\Files\Event {
use OCP\EventDispatcher\Event;
class LoadAdditionalScriptsEvent extends Event {
}
}

0 comments on commit 8d34267

Please sign in to comment.