From 64820546d758b34720888311d0abffcf95609436 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 4 Oct 2012 13:40:40 -0500 Subject: [ticket/11103] Move notification files to includes/notification/ PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 92 +++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 phpBB/includes/notification/method/base.php (limited to 'phpBB/includes/notification/method/base.php') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php new file mode 100644 index 0000000000..b502d3afd0 --- /dev/null +++ b/phpBB/includes/notification/method/base.php @@ -0,0 +1,92 @@ +phpbb_container = $phpbb_container; + + // Service + $this->service = $phpbb_container->get('notifications'); + + // Some common things we're going to use + $this->db = $phpbb_container->get('dbal.conn'); + $this->user = $phpbb_container->get('user'); + + $this->phpbb_root_path = $phpbb_container->getParameter('core.root_path'); + $this->php_ext = $phpbb_container->getParameter('core.php_ext'); + } + + /** + * Add a notification to the queue + * + * @param phpbb_notification_type_interface $notification + */ + public function add_to_queue(phpbb_notification_type_interface $notification) + { + $this->queue[] = $notification; + } + + /** + * Empty the queue + */ + protected function empty_queue() + { + $this->queue = array(); + } +} -- cgit v1.2.1 From cea94d89848a806f449610ddb2a7df7b7eec1328 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 4 Oct 2012 14:27:43 -0500 Subject: [ticket/11103] Use dependency injection instead of phpbb_container PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 30 +++++++++++------------------ 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'phpBB/includes/notification/method/base.php') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index b502d3afd0..ced85e2582 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -23,12 +23,7 @@ if (!defined('IN_PHPBB')) */ abstract class phpbb_notification_method_base implements phpbb_notification_method_interface { - protected $phpbb_container; - protected $service; - protected $db; - protected $user; - protected $phpbb_root_path; - protected $php_ext; + protected $notification_manager, $db, $cache, $template, $extension_manager, $user, $auth, $config, $phpbb_root_path, $php_ext = null; /** * Desired notifications @@ -56,20 +51,17 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth */ protected $queue = array(); - public function __construct(ContainerBuilder $phpbb_container) + public function __construct(dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, phpbb_extension_manager $extension_manager, phpbb_user $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) { - // phpBB Container - $this->phpbb_container = $phpbb_container; - - // Service - $this->service = $phpbb_container->get('notifications'); - - // Some common things we're going to use - $this->db = $phpbb_container->get('dbal.conn'); - $this->user = $phpbb_container->get('user'); - - $this->phpbb_root_path = $phpbb_container->getParameter('core.root_path'); - $this->php_ext = $phpbb_container->getParameter('core.php_ext'); + $this->db = $db; + $this->cache = $cache; + $this->template = $template; + $this->extension_manager = $extension_manager; + $this->user = $user; + $this->auth = $auth; + $this->config = $config; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; } /** -- cgit v1.2.1 From ff136cc96a62147bc7468b716b86a30f12754e77 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 4 Oct 2012 15:21:07 -0500 Subject: [ticket/11103] Do not use Symfony\...\ContainerBuilder; It's no longer needed PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/includes/notification/method/base.php') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index ced85e2582..d95a65fa72 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -7,7 +7,6 @@ * */ -use Symfony\Component\DependencyInjection\ContainerBuilder; /** * @ignore -- cgit v1.2.1 From ceb56da965f12245bca6b735cb71f3bbaf505307 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 4 Oct 2012 21:39:17 -0500 Subject: [ticket/11103] Fixing a few bugs from the previous changes PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/notification/method/base.php') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index d95a65fa72..9f1db6d9f5 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -50,8 +50,9 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth */ protected $queue = array(); - public function __construct(dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, phpbb_extension_manager $extension_manager, phpbb_user $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) + public function __construct(phpbb_notification_manager $notification_manager, dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, phpbb_extension_manager $extension_manager, phpbb_user $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) { + $this->notification_manager = $notification_manager; $this->db = $db; $this->cache = $cache; $this->template = $template; -- cgit v1.2.1 From 3f2e3ad633930744e1ed92cc529ca473ccfa09e0 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 5 Oct 2012 00:07:48 -0500 Subject: [ticket/11103] Working on test case Fixing extension type/method naming scheme so they can be autoloaded. Other bugs PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/notification/method/base.php') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index 9f1db6d9f5..6410b1f519 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -50,7 +50,7 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth */ protected $queue = array(); - public function __construct(phpbb_notification_manager $notification_manager, dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, phpbb_extension_manager $extension_manager, phpbb_user $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) + public function __construct(phpbb_notification_manager $notification_manager, dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, phpbb_extension_manager $extension_manager, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) { $this->notification_manager = $notification_manager; $this->db = $db; -- cgit v1.2.1 From 2d69707a88fdb618730243cbe65ebc055cf68bae Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 5 Oct 2012 00:23:14 -0500 Subject: [ticket/11103] Remove extra line break in the header Was introduced with ff136cc96a62147bc7468b716b86a30f12754e77 PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/includes/notification/method/base.php') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index 6410b1f519..5457ca99b2 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -7,7 +7,6 @@ * */ - /** * @ignore */ -- cgit v1.2.1 From eb07b3ad9cfb37fd2943088170e380bff2db94a3 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 18 Oct 2012 18:45:43 -0500 Subject: [ticket/11103] Expand class vars and use docblocks for phpBB classes PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 47 +++++++++++++++++------------ 1 file changed, 28 insertions(+), 19 deletions(-) (limited to 'phpBB/includes/notification/method/base.php') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index 5457ca99b2..88ec2674be 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -21,26 +21,35 @@ if (!defined('IN_PHPBB')) */ abstract class phpbb_notification_method_base implements phpbb_notification_method_interface { - protected $notification_manager, $db, $cache, $template, $extension_manager, $user, $auth, $config, $phpbb_root_path, $php_ext = null; + /** @var phpbb_notification_manager */ + protected $notification_manager = null; - /** - * 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? - */ + /** @var dbal */ + protected $db = null; + + /** @var phpbb_cache_service */ + protected $cache = null; + + /** @var phpbb_template */ + protected $template = null; + + /** @var phpbb_extension_manager */ + protected $extension_manager = null; + + /** @var phpbb_user */ + protected $user = null; + + /** @var phpbb_auth */ + protected $auth = null; + + /** @var phpbb_config */ + protected $config = null; + + /** @var string */ + protected $phpbb_root_path = null; + + /** @var string */ + protected $php_ext = null; /** * Queue of messages to be sent -- cgit v1.2.1 From 2afb8b9df873c3f9572a32ab7a62ea8ba8d8a45b Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Tue, 20 Nov 2012 18:14:48 -0600 Subject: [ticket/11103] Create user loader class, update for DIC Create a very basic user loader class to handle querying/storing user data in a centralized location. Use DIC collection service for notification types/methods. Cleanup unused dependencies. Fix some other issues. PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/notification/method/base.php') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index 88ec2674be..3f85d62a09 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -24,6 +24,9 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth /** @var phpbb_notification_manager */ protected $notification_manager = null; + /** @var phpbb_user_loader */ + protected $user_loader = null; + /** @var dbal */ protected $db = null; @@ -58,13 +61,11 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth */ protected $queue = array(); - public function __construct(phpbb_notification_manager $notification_manager, dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, phpbb_extension_manager $extension_manager, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) + public function __construct(phpbb_user_loader $user_loader, dbal $db, phpbb_cache_driver_interface $cache, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) { - $this->notification_manager = $notification_manager; + $this->user_loader = $user_loader; $this->db = $db; $this->cache = $cache; - $this->template = $template; - $this->extension_manager = $extension_manager; $this->user = $user; $this->auth = $auth; $this->config = $config; @@ -72,6 +73,11 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth $this->php_ext = $php_ext; } + public function set_notification_manager(phpbb_notification_manager $notification_manager) + { + $this->notification_manager = $notification_manager; + } + /** * Add a notification to the queue * -- cgit v1.2.1 From ddd874ba76366cebe3cc30df6daa1974e29f34d1 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 13 Dec 2012 19:46:32 -0600 Subject: [ticket/11103] dbal -> phpbb_db_driver PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/notification/method/base.php') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index 3f85d62a09..f37e7e7845 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -27,7 +27,7 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth /** @var phpbb_user_loader */ protected $user_loader = null; - /** @var dbal */ + /** @var phpbb_db_driver */ protected $db = null; /** @var phpbb_cache_service */ @@ -61,7 +61,7 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth */ protected $queue = array(); - public function __construct(phpbb_user_loader $user_loader, dbal $db, phpbb_cache_driver_interface $cache, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) + public function __construct(phpbb_user_loader $user_loader, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) { $this->user_loader = $user_loader; $this->db = $db; -- cgit v1.2.1 From 07282a30ae077825ea81a4e26839ac0473dc97b7 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Tue, 15 Jan 2013 12:10:07 -0600 Subject: [ticket/11103] Fix some various issues, better comments PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 40 +++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'phpBB/includes/notification/method/base.php') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index f37e7e7845..c4c0a64ae0 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -22,37 +22,37 @@ if (!defined('IN_PHPBB')) abstract class phpbb_notification_method_base implements phpbb_notification_method_interface { /** @var phpbb_notification_manager */ - protected $notification_manager = null; + protected $notification_manager; /** @var phpbb_user_loader */ - protected $user_loader = null; + protected $user_loader; /** @var phpbb_db_driver */ - protected $db = null; + protected $db; /** @var phpbb_cache_service */ - protected $cache = null; + protected $cache; /** @var phpbb_template */ - protected $template = null; + protected $template; /** @var phpbb_extension_manager */ - protected $extension_manager = null; + protected $extension_manager; /** @var phpbb_user */ - protected $user = null; + protected $user; /** @var phpbb_auth */ - protected $auth = null; + protected $auth; /** @var phpbb_config */ - protected $config = null; + protected $config; /** @var string */ - protected $phpbb_root_path = null; + protected $phpbb_root_path; /** @var string */ - protected $php_ext = null; + protected $php_ext; /** * Queue of messages to be sent @@ -61,6 +61,19 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth */ protected $queue = array(); + /** + * Notification Method Base Constructor + * + * @param phpbb_user_loader $user_loader + * @param phpbb_db_driver $db + * @param phpbb_cache_driver_interface $cache + * @param mixed $user + * @param phpbb_auth $auth + * @param phpbb_config $config + * @param mixed $phpbb_root_path + * @param mixed $php_ext + * @return phpbb_notification_method_base + */ public function __construct(phpbb_user_loader $user_loader, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) { $this->user_loader = $user_loader; @@ -73,6 +86,11 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth $this->php_ext = $php_ext; } + /** + * Set notification manager (required) + * + * @param phpbb_notification_manager $notification_manager + */ public function set_notification_manager(phpbb_notification_manager $notification_manager) { $this->notification_manager = $notification_manager; -- cgit v1.2.1 From bd499425522a61ddd617e9ac4cfed9a7859bf949 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Tue, 15 Jan 2013 12:54:39 -0600 Subject: [ticket/11103] Correcting constructor comments PHPBB3-11103 --- phpBB/includes/notification/method/base.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/notification/method/base.php') diff --git a/phpBB/includes/notification/method/base.php b/phpBB/includes/notification/method/base.php index c4c0a64ae0..22418c9be8 100644 --- a/phpBB/includes/notification/method/base.php +++ b/phpBB/includes/notification/method/base.php @@ -67,11 +67,11 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth * @param phpbb_user_loader $user_loader * @param phpbb_db_driver $db * @param phpbb_cache_driver_interface $cache - * @param mixed $user + * @param phpbb_user $user * @param phpbb_auth $auth * @param phpbb_config $config - * @param mixed $phpbb_root_path - * @param mixed $php_ext + * @param string $phpbb_root_path + * @param string $php_ext * @return phpbb_notification_method_base */ public function __construct(phpbb_user_loader $user_loader, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) -- cgit v1.2.1