mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/13489] Disable the event dispatcher in the migrator
PHPBB3-13489
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
namespace phpbb\event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* Extension of the Symfony2 EventDispatcher
|
||||
@@ -31,6 +32,11 @@ use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher;
|
||||
*/
|
||||
class dispatcher extends ContainerAwareEventDispatcher implements dispatcher_interface
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $disabled = false;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -40,4 +46,33 @@ class dispatcher extends ContainerAwareEventDispatcher implements dispatcher_int
|
||||
$this->dispatch($eventName, $event);
|
||||
return $event->get_data_filtered(array_keys($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function dispatch($eventName, Event $event = null)
|
||||
{
|
||||
if ($this->disabled)
|
||||
{
|
||||
return $event;
|
||||
}
|
||||
|
||||
return parent::dispatch($eventName, $event);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function disable()
|
||||
{
|
||||
$this->disabled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function enable()
|
||||
{
|
||||
$this->disabled = false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user