Skip to content
Snippets Groups Projects
Commit 3ab241f1 authored by Sebastian Kehr's avatar Sebastian Kehr :rowboat_tone2: Committed by Dorian Merz
Browse files

refs #16452 [fid] clean up error listener and prepare for debugging purposes

parent 3c97b28c
Branches
Tags
No related merge requests found
......@@ -126,7 +126,7 @@ $config = [
],
'factories' => [
Client::class => ClientFactory::class,
ErrorListener::class => ErrorListenerFactory:: class,
ErrorListener::class => InvokableFactory:: class,
ILSAuthenticator::class => ILSAuthenticatorFactory::class,
LocaleListener::class => InvokableFactory::class,
],
......
......@@ -21,12 +21,9 @@
namespace fid\Listener;
use fid\Service\ClientException;
use VuFind\Auth\Manager;
use Zend\EventManager\AbstractListenerAggregate;
use Zend\EventManager\EventInterface;
use Zend\EventManager\EventManagerInterface;
use Zend\Mvc\Controller\Plugin\Redirect;
use Zend\Mvc\MvcEvent;
class ErrorListener extends AbstractListenerAggregate
......@@ -37,22 +34,6 @@ class ErrorListener extends AbstractListenerAggregate
MvcEvent::EVENT_RENDER_ERROR,
];
/**
* @var Manager
*/
protected $manager;
/**
* @var Redirect
*/
protected $redirect;
public function __construct(Manager $manager, Redirect $redirect)
{
$this->manager = $manager;
$this->redirect = $redirect;
}
public function attach(EventManagerInterface $events, $priority = 20000)
{
foreach (static::ERROR_EVENTS as $event) {
......@@ -61,20 +42,10 @@ class ErrorListener extends AbstractListenerAggregate
}
/**
* TODO: Do we still need this listener?
*
* @param EventInterface|MvcEvent $event
*/
public function onError(EventInterface $event): void
{
// $exception = $event->getParam('exception');
// $logoutAndRefresh = $exception instanceof ClientException;
// // && $exception->getCode() === 401;
//
// if ($logoutAndRefresh) {
// $this->manager->logout(null, true);
// $event->setResponse($this->redirect->refresh());
// $event->stopPropagation();
// }
return;
}
}
\ No newline at end of file
<?php
/**
* Copyright (C) 2019 Leipzig University Library
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* @author Sebastian Kehr <kehr@ub.uni-leipzig.de>
* @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
*/
namespace fid\Listener;
use ProxyManager\Factory\LazyLoadingValueHolderFactory;
use Psr\Container\ContainerInterface;
use VuFind\Auth\Manager as AuthManager;
use Zend\Mvc\Controller\Plugin\Redirect;
use Zend\Mvc\Controller\PluginManager;
class ErrorListenerFactory
{
public function __invoke(ContainerInterface $container)
{
/** @var AuthManager $manager */
$manager = $container->get(AuthManager::class);
$factory = new LazyLoadingValueHolderFactory();
/** @var Redirect $redirect */
$redirect = $factory->createProxy(Redirect::class,
function (&$instance, $proxy, $method, $params, &$initializer)
use ($container) {
$initializer = null;
$instance = $container->get(PluginManager::class)
->get(Redirect::class);
});
return new ErrorListener($manager, $redirect);
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment