diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2015-01-20 23:32:36 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2015-01-20 23:32:36 +0100 |
commit | b566686b5161e699f8376b0463960a9ffb3812b6 (patch) | |
tree | 9392b221794a7bac17102b20f64f33fa009c31c2 /phpBB/phpbb/event | |
parent | c71e8ffb29e0b3774395b9fbfa3b3faff0095413 (diff) | |
parent | a5fae1b1f09358f8a24ff32fc5192395cd314244 (diff) | |
download | forums-b566686b5161e699f8376b0463960a9ffb3812b6.tar forums-b566686b5161e699f8376b0463960a9ffb3812b6.tar.gz forums-b566686b5161e699f8376b0463960a9ffb3812b6.tar.bz2 forums-b566686b5161e699f8376b0463960a9ffb3812b6.tar.xz forums-b566686b5161e699f8376b0463960a9ffb3812b6.zip |
Merge branch 'develop-ascraeus' into develop
Conflicts:
phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php
phpBB/phpbb/db/migration/profilefield_base_migration.php
phpBB/phpbb/db/migrator.php
Diffstat (limited to 'phpBB/phpbb/event')
-rw-r--r-- | phpBB/phpbb/event/dispatcher.php | 35 | ||||
-rw-r--r-- | phpBB/phpbb/event/dispatcher_interface.php | 10 |
2 files changed, 45 insertions, 0 deletions
diff --git a/phpBB/phpbb/event/dispatcher.php b/phpBB/phpbb/event/dispatcher.php index 9a786022c2..1c4abeb108 100644 --- a/phpBB/phpbb/event/dispatcher.php +++ b/phpBB/phpbb/event/dispatcher.php @@ -14,6 +14,7 @@ namespace phpbb\event; use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher; +use Symfony\Component\EventDispatcher\Event; /** * Extension of the Symfony2 EventDispatcher @@ -32,6 +33,11 @@ use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher; class dispatcher extends ContainerAwareEventDispatcher implements dispatcher_interface { /** + * @var bool + */ + protected $disabled = false; + + /** * {@inheritdoc} */ public function trigger_event($eventName, $data = array()) @@ -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; + } } diff --git a/phpBB/phpbb/event/dispatcher_interface.php b/phpBB/phpbb/event/dispatcher_interface.php index 50a3ef9101..c66aa98260 100644 --- a/phpBB/phpbb/event/dispatcher_interface.php +++ b/phpBB/phpbb/event/dispatcher_interface.php @@ -37,4 +37,14 @@ interface dispatcher_interface extends \Symfony\Component\EventDispatcher\EventD * @return mixed */ public function trigger_event($eventName, $data = array()); + + /** + * Disable the event dispatcher. + */ + public function disable(); + + /** + * Enable the event dispatcher. + */ + public function enable(); } |