1
0
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:
Tristan Darricau
2015-01-14 11:04:42 +01:00
parent a415a4ec2b
commit c99ed64473
3 changed files with 91 additions and 6 deletions

View File

@@ -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;
}
}