1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 16:56:44 +02:00

[ticket/11103] Add tables to the database updater and installer

PHPBB3-11103
This commit is contained in:
Nathan Guse
2012-09-08 13:09:34 -05:00
parent 32a966b21d
commit b594635526
5 changed files with 140 additions and 19 deletions

View File

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

View File

@@ -21,4 +21,5 @@ if (!defined('IN_PHPBB'))
*/
interface phpbb_notifications_method_interface
{
public function notify($notification);
}

View File

@@ -33,25 +33,6 @@ class phpbb_notifications_service
*/
protected $users;
/**
* Desired notifications
* unique by (type, type_id, user_id, method)
* if multiple methods are desired, multiple rows will exist.
*
* method of "none" will over-ride any other options
*
* type
* type_id
* user_id
* method
* none (will never receive notifications)
* standard (listed in notifications window
* popup?
* email
* jabber
* sms?
*/
public function __construct(ContainerBuilder $phpbb_container)
{
$this->phpbb_container = $phpbb_container;
@@ -140,6 +121,25 @@ class phpbb_notifications_service
$notification_objects = $notification_methods = array();
$new_rows = array();
/**
* Desired notifications
* unique by (type, type_id, user_id, method)
* if multiple methods are desired, multiple rows will exist.
*
* method of "none" will over-ride any other options
*
* item_type
* item_id
* user_id
* method
* none (will never receive notifications)
* standard (listed in notifications window
* popup?
* email
* jabber
* sms?
*/
// find out which users want to receive this type of notification
$sql = 'SELECT user_id FROM ' . USERS_TABLE . '
WHERE ' . $this->db->sql_in_set('user_id', array(2));