diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2012-09-08 13:09:34 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2012-09-08 13:09:34 -0500 |
commit | b59463552644ca4afd9e8ca7edd761ae382fc8ed (patch) | |
tree | 5251e7b695431cb2e0af93a9655cfa25a0dbcc08 /phpBB/includes/notifications/method/base.php | |
parent | 32a966b21da7051def3bd2ae608f3f2457d22476 (diff) | |
download | forums-b59463552644ca4afd9e8ca7edd761ae382fc8ed.tar forums-b59463552644ca4afd9e8ca7edd761ae382fc8ed.tar.gz forums-b59463552644ca4afd9e8ca7edd761ae382fc8ed.tar.bz2 forums-b59463552644ca4afd9e8ca7edd761ae382fc8ed.tar.xz forums-b59463552644ca4afd9e8ca7edd761ae382fc8ed.zip |
[ticket/11103] Add tables to the database updater and installer
PHPBB3-11103
Diffstat (limited to 'phpBB/includes/notifications/method/base.php')
-rw-r--r-- | phpBB/includes/notifications/method/base.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/phpBB/includes/notifications/method/base.php b/phpBB/includes/notifications/method/base.php index 1c223df045..dbf851a059 100644 --- a/phpBB/includes/notifications/method/base.php +++ b/phpBB/includes/notifications/method/base.php @@ -27,6 +27,13 @@ abstract class phpbb_notifications_method_base implements phpbb_notifications_me protected $db; protected $user; + /** + * Queue of messages to be sent + * + * @var array + */ + protected $queue = array(); + public function __construct(ContainerBuilder $phpbb_container, $data = array()) { // phpBB Container @@ -36,4 +43,29 @@ abstract class phpbb_notifications_method_base implements phpbb_notifications_me $this->db = $phpbb_container->get('dbal.conn'); $this->user = $phpbb_container->get('user'); } + + /** + * Add a notification to the queue + * + * @param phpbb_notifications_type_interface $notification + */ + public function add_to_queue(phpbb_notifications_type_interface $notification) + { + $this->queue[] = $notification; + } + + /** + * Basic run queue function. + * Child methods should override this function if there are more efficient methods to mass-notification + */ + public function run_queue() + { + foreach ($this->queue as $notification) + { + $this->notify($notification); + } + + // Empty queue + $this->queue = array(); + } } |