[ticket/17135] Refactor messenger code to services

PHPBB3-17135
This commit is contained in:
rxu 2023-06-08 21:17:01 +07:00
parent f95816cbe3
commit a7b5369138
No known key found for this signature in database
GPG key ID: 955F0567380E586A
22 changed files with 191 additions and 149 deletions

View file

@ -20,23 +20,28 @@ services:
- '@request'
- '@user'
- '@messenger.queue'
- '@path_helper'
- '@ext.manager'
- '@template.twig.extensions.collection'
- '@template.twig.lexer'
- '%core.template.cache_path%'
messenger.method.email:
class: phpbb\messenger\method\email
class: phpbb\messenger\method\phpbb_email
shared: false
parent: messenger.method.base
calls:
- [init, []]
- [reset, []]
- [set_transport, []]
tags:
- { name: messenger.method }
messenger.method.jabber:
class: phpbb\messenger\method\jabber
class: phpbb\messenger\method\phpbb_jabber
shared: false
parent: messenger.method.base
calls:
- [init, []]
- [reset, []]
tags:
- { name: messenger.method }

View file

@ -23,6 +23,7 @@ services:
- '@installer.helper.container_factory'
- '@installer.helper.config'
- '@installer.helper.iohandler'
- '%core.root_path%'
tags:
- { name: install_finish, order: 3 }

View file

@ -459,7 +459,7 @@ class ucp_register
if ($config['email_enable'])
{
$messenger = $phpbb_container->get('messenger.method_collection');
$email = $this->messenger->offsetGet('messenger.method.email');
$email = $messenger->offsetGet('messenger.method.email');
$email->set_use_queue(false);
$email->template($email_template, $data['lang']);
$email->to($data['email'], $data['username']);

View file

@ -325,6 +325,7 @@ class add extends command
'U_ACTIVATE' => generate_board_url() . "/ucp.{$this->php_ext}?mode=activate&u=$user_id&k=$user_actkey",
]);
$email->send();
}
/**
* Get user activation key

View file

@ -13,8 +13,7 @@
namespace phpbb\cron\task\core;
use \phpbb\config\config;
use \phpbb\messenger\queue;
use phpbb\config\config;
/**
* Queue cron task. Sends email and jabber messages queued by other scripts.
@ -24,7 +23,7 @@ class queue extends \phpbb\cron\task\base
/** var config */
protected $config;
/** var queue */
/** var \phpbb\messenger\queue */
protected $queue;
/** var string */
@ -35,9 +34,9 @@ class queue extends \phpbb\cron\task\base
*
* @param config $config The config
* @param string $queue_cache_file The messenger file queue cache filename
* @param queue $queue The messenger file queue object
* @param \phpbb\messenger\queue $queue The messenger file queue object
*/
public function __construct(config $config, queue $queue, $queue_cache_file)
public function __construct(config $config, \phpbb\messenger\queue $queue, $queue_cache_file)
{
$this->config = $config;
$this->queue = $queue;

View file

@ -42,6 +42,9 @@ class notify_user extends \phpbb\install\task_base
/** @var log_interface */
protected $log;
/** @var string */
protected $phpbb_root_path;
/** @var user */
protected $user;
@ -54,8 +57,9 @@ class notify_user extends \phpbb\install\task_base
* @param container_factory $container
* @param config $install_config
* @param iohandler_interface $iohandler
* @param string $phpbb_root_path
*/
public function __construct(container_factory $container, config $install_config, iohandler_interface $iohandler)
public function __construct(container_factory $container, config $install_config, iohandler_interface $iohandler, $phpbb_root_path)
{
$this->install_config = $install_config;
$this->iohandler = $iohandler;
@ -64,6 +68,7 @@ class notify_user extends \phpbb\install\task_base
$this->log = $container->get('log');
$this->user = $container->get('user');
$this->messenger = $container->get('messenger.method_collection');
$this->phpbb_root_path = $phpbb_root_path;
// We need to reload config for cases when it doesn't have all values
/** @var \phpbb\cache\driver\driver_interface $cache */

View file

@ -85,7 +85,7 @@ class admin_form extends form
/**
* {inheritDoc}
*/
public function submit(\messenger $messenger)
public function submit(\phpbb\di\service_collection $messenger)
{
if (!$this->subject)
{

View file

@ -108,7 +108,7 @@ class topic_form extends form
/**
* {inheritDoc}
*/
public function submit(\messenger $messenger)
public function submit(\phpbb\di\service_collection $messenger)
{
if (!$this->recipient_address || !preg_match('/^' . get_preg_expression('email') . '$/i', $this->recipient_address))
{

View file

@ -96,7 +96,7 @@ class user_form extends form
/**
* {inheritDoc}
*/
public function submit(\messenger $messenger)
public function submit(\phpbb\di\service_collection $messenger)
{
if (!$this->subject)
{

View file

@ -14,12 +14,16 @@
namespace phpbb\messenger\method;
use phpbb\config\config;
use phpbb\di\service_collection;
use phpbb\event\dispatcher;
use phpbb\extension\manager;
use phpbb\language\language;
use phpbb\log\log_interface;
use phpbb\path_helper;
use phpbb\request\request;
use phpbb\messenger\queue;
use phpbb\template\template;
use phpbb\template\twig\lexer;
use phpbb\user;
/**
@ -36,6 +40,9 @@ abstract class base
/** @var dispatcher */
protected $dispatcher;
/** @var manager */
protected $ext_manager;
/** @var language */
protected $language;
@ -48,6 +55,9 @@ abstract class base
/** @var queue */
protected $queue;
/** @var path_helper */
protected $path_helper;
/** @var request */
protected $request;
@ -57,6 +67,15 @@ abstract class base
/** @var template */
protected $template;
/** @var string */
protected $template_cache_path;
/** @var service_collection */
protected $twig_extensions_collection;
/** @var lexer */
protected $twig_lexer;
/** @var bool */
protected $use_queue = true;
@ -73,8 +92,26 @@ abstract class base
* @param request $request
* @param user $user
* @param queue $queue
* @param path_helper $path_helper
* @param manager $ext_manager
* @param service_collection $twig_extensions_collection
* @param lexer $twig_lexer
* @param string $template_cache_path
*/
function __construct(config $config, dispatcher $dispatcher, language $language, log_interface $log, request $request, user $user, queue $queue)
function __construct(
config $config,
dispatcher $dispatcher,
language $language,
log_interface $log,
request $request,
user $user,
queue $queue,
path_helper $path_helper,
manager $ext_manager,
service_collection $twig_extensions_collection,
lexer $twig_lexer,
$template_cache_path
)
{
$this->config = $config;
$this->dispatcher = $dispatcher;
@ -83,6 +120,11 @@ abstract class base
$this->request = $request;
$this->user = $user;
$this->queue = $queue;
$this->path_helper = $path_helper;
$this->ext_manager = $ext_manager;
$this->twig_extensions_collection = $twig_extensions_collection;
$this->twig_lexer = $twig_lexer;
$this->template_cache_path = $template_cache_path;
$this->set_use_queue();
}
@ -91,19 +133,7 @@ abstract class base
* Get messenger method id
* @return mixed
*/
abstract public function get_id()
{
return;
}
/**
* get messenger method fie queue object name
* @return string
*/
abstract public function get_queue_object_name($user)
{
return '';
}
abstract public function get_id();
/**
* Sets the use of messenger queue flag
@ -120,13 +150,7 @@ abstract class base
*
* @return void
*/
abstract public function reset()
{
$this->subject = $this->additional_headers = [];
$this->msg = '';
$this->use_queue = true;
unset($this->template);
}
abstract public function reset();
/**
* Set addresses for to/im as available
@ -134,9 +158,13 @@ abstract class base
* @param array $user User row
* @return void
*/
abstract public function set_addresses($user)
{
}
abstract public function set_addresses($user);
/**
* Get messenger method fie queue object name
* @return string
*/
abstract public function get_queue_object_name();
/**
* Set up subject for mail
@ -152,8 +180,8 @@ abstract class base
/**
* Adds antiabuse headers
*
* @param \phpbb\config\config $config Config object
* @param \phpbb\user $user User object
* @param config $config Config object
* @param user $user User object
* @return void
*/
public function anti_abuse_headers($config, $user)
@ -185,9 +213,7 @@ abstract class base
* Send out messages
* @return bool
*/
abstract protected function send()
{
}
abstract protected function send();
/**
* Send messages from the queue
@ -195,9 +221,7 @@ abstract class base
* @param array $queue_data Queue data array
* @return void
*/
abstract public function process_queue(&$queue_data)
{
}
abstract public function process_queue(&$queue_data);
/**
* Set email template to use
@ -336,8 +360,8 @@ abstract class base
* Event to modify the template before parsing
*
* @event core.modify_notification_template
* @var string subject The message subject
* @var \phpbb\template\template template The (readonly) template object
* @var string subject The message subject
* @var template template The (readonly) template object
* @since 3.2.4-RC1
* @changed 4.0.0-a1 Removed vars: method, break.
*/
@ -395,11 +419,10 @@ abstract class base
/**
* Add error message to log
*
* @param string $type Error type: EMAIL / etc
* @param string $msg Error message text
* @return void
*/
public function error($type, $msg)
public function error($msg)
{
// Session doesn't exist, create it
if (!isset($this->user->session_id) || $this->user->session_id === '')
@ -407,6 +430,7 @@ abstract class base
$this->user->session_begin();
}
$type = strtoupper($this->get_queue_object_name());
$calling_page = html_entity_decode($this->request->server('PHP_SELF'), ENT_COMPAT);
$message = '<strong>' . $type . '</strong><br><em>' . htmlspecialchars($calling_page, ENT_COMPAT) . '</em><br><br>' . $msg . '<br>';
$this->log->add('critical', $this->user->data['user_id'], $this->user->ip, 'LOG_ERROR_' . $type, false, [$message]);
@ -431,32 +455,32 @@ abstract class base
*/
protected function setup_template()
{
if ($this->template instanceof \phpbb\template\template)
if (isset($this->template) && $this->template instanceof template)
{
return;
}
$template_environment = new \phpbb\template\twig\environment(
$this->config,
$this->phpbb_container->get('filesystem'),
$this->phpbb_container->get('path_helper'),
$this->phpbb_container->getParameter('core.template.cache_path'),
$this->phpbb_container->get('ext.manager'),
new \phpbb\filesystem\filesystem(),
$this->path_helper,
$this->template_cache_path,
$this->ext_manager,
new \phpbb\template\twig\loader(),
$this->dispatcher,
[]
);
$template_environment->setLexer($this->phpbb_container->get('template.twig.lexer'));
$template_environment->setLexer($this->twig_lexer);
$this->template = new \phpbb\template\twig\twig(
$this->phpbb_container->get('path_helper'),
$this->path_helper,
$this->config,
new \phpbb\template\context(),
$template_environment,
$this->phpbb_container->getParameter('core.template.cache_path'),
$this->template_cache_path,
$this->user,
$this->phpbb_container->get('template.twig.extensions.collection'),
$this->phpbb_container->get('ext.manager')
$this->twig_extensions_collection,
$this->ext_manager
);
}

View file

@ -22,7 +22,7 @@ use Symfony\Component\Mime\Header\Headers;
/**
* Messenger class
*/
class email extends base
class phpbb_email extends base
{
/** @var array */
private const PRIORITY_MAP = [
@ -58,7 +58,7 @@ class email extends base
/** @var string */
protected $from;
/** @var Symfony\Component\Mime\Header\Headers */
/** @var Headers */
protected $headers;
/**
@ -79,13 +79,11 @@ class email extends base
/** @var string */
protected $replyto = '';
/** @var Symfony\Component\Mailer\Transport */
/** @var Transport */
protected $transport;
/**
* Get messenger method id
*
* @return int
* {@inheritDoc}
*/
public function get_id()
{
@ -93,10 +91,9 @@ class email extends base
}
/**
* get messenger method fie queue object name
* @return string
* {@inheritDoc}
*/
abstract public function get_queue_object_name($user)
public function get_queue_object_name()
{
return 'email';
}
@ -111,9 +108,7 @@ class email extends base
}
/**
* Inits/resets the data to default
*
* @return void
* {@inheritDoc}
*/
public function reset()
{
@ -122,7 +117,10 @@ class email extends base
$this->msg = $this->replyto = $this->from = '';
$this->mail_priority = Email::PRIORITY_NORMAL;
parent::reset();
$this->subject = $this->additional_headers = [];
$this->msg = '';
$this->use_queue = true;
unset($this->template);
}
/**
@ -136,10 +134,7 @@ class email extends base
}
/**
* Set address as available
*
* @param array $user User row
* @return void
* {@inheritDoc}
*/
public function set_addresses($user)
{
@ -251,8 +246,8 @@ class email extends base
*/
public function header($header_name, $header_value)
{
$header_name = trim($header_name);
$header_value = trim($header_value);
$header_name = $header_name;
$header_value = $header_value;
// addMailboxListHeader() requires value to be array
if ($this->get_header_method($header_name) == 'addMailboxListHeader')
@ -295,18 +290,6 @@ class email extends base
$this->email->priority($priority);
}
/**
* Add error message to log
*
* @param string $msg Error message text
* @return void
*/
public function error($msg)
{
$type = 'EMAIL/' . ($this->config['smtp_delivery']) ? 'SMTP' : 'PHP/mail()';
parent::error($type, $msg);
}
/**
* Detect proper Header class method to add header
*
@ -448,15 +431,12 @@ class email extends base
}
/**
* Send messages from the queue
*
* @param array $queue_data Queue data array
* @return void
* {@inheritDoc}
*/
public function process_queue(&$queue_data)
{
$queue_object_name = $this->get_queue_object_name();
$messages_count = count($queue_data[$queue_object_name]['data'];
$messages_count = count($queue_data[$queue_object_name]['data']);
if (!$this->is_enabled() || !$messages_count)
{
@ -480,8 +460,8 @@ class email extends base
* Event to send message via external transport
*
* @event core.notification_message_process
* @var bool break Flag indicating if the function return after hook
* @var Symfony\Component\Mime\Email email The Symfony Email object
* @var bool break Flag indicating if the function return after hook
* @var Email email The Symfony Email object
* @since 3.2.4-RC1
* @changed 4.0.0-a1 Added vars: email. Removed vars: addresses, subject, msg.
*/
@ -515,7 +495,7 @@ class email extends base
/**
* Get mailer transport object
*
* @return Symfony\Component\Mailer\Transport Symfony Mailer transport object
* @return Transport Symfony Mailer transport object
*/
public function get_transport()
{
@ -527,7 +507,7 @@ class email extends base
*
* @return bool
*/
protected function send()
public function send()
{
$this->prepare_message();
@ -544,9 +524,9 @@ class email extends base
* Event to send message via external transport
*
* @event core.notification_message_email
* @var string subject The message subject
* @var string msg The message text
* @var Symfony\Component\Mime\Email email The Symfony Email object
* @var string subject The message subject
* @var string msg The message text
* @var Email email The Symfony Email object
* @since 3.2.4-RC1
* @changed 4.0.0-a1 Added vars: email. Removed vars: addresses, break
*/
@ -587,10 +567,10 @@ class email extends base
* Modify data before sending out emails with PHP's mail function
*
* @event core.phpbb_mail_before
* @var Symfony\Component\Mime\Email email The Symfony Email object
* @var string subject The message subject
* @var string msg The message text
* @var string headers The email headers
* @var Email email The Symfony Email object
* @var string subject The message subject
* @var string msg The message text
* @var string headers The email headers
* @since 3.3.6-RC1
* @changed 4.0.0-a1 Added vars: email. Removed vars: to, eol, additional_parameters.
*/
@ -621,10 +601,10 @@ class email extends base
* Execute code after sending out emails with PHP's mail function
*
* @event core.phpbb_mail_after
* @var Symfony\Component\Mime\Email email The Symfony Email object
* @var string subject The message subject
* @var string msg The message text
* @var string headers The email headers
* @var Email email The Symfony Email object
* @var string subject The message subject
* @var string msg The message text
* @var string headers The email headers
* @since 3.3.6-RC1
* @changed 4.0.0-a1 Added vars: email. Removed vars: to, eol, additional_parameters, $result.
*/

View file

@ -24,7 +24,7 @@ namespace phpbb\messenger\method;
* Slightly modified by Acyd Burn (2006)
* Refactored to a service (2023)
*/
class jabber extends base
class phpbb_jabber extends base
{
/** @var string */
protected $connect_server;
@ -87,8 +87,8 @@ class jabber extends base
* ->password($password)
* ->ssl($use_ssl)
* ->server($server)
* ->port($port)
* ->stream_options(
* ->port($port)
* ->stream_options(
* 'verify_peer' => true,
* 'verify_peer_name' => true,
* 'allow_self_signed' => false,
@ -99,10 +99,10 @@ class jabber extends base
public function init()
{
$this->username($this->config['jab_username'])
->password($this->config['jab_password'])
->ssl((bool) $this->config['jab_use_ssl'])
->server($this->config['jab_host'])
->port($this->config['jab_port'])
->password($this->config['jab_password'])
->ssl((bool) $this->config['jab_use_ssl'])
->server($this->config['jab_host'])
->port($this->config['jab_port'])
->stream_options['ssl'] = [
'verify_peer' => $this->config['jab_verify_peer'],
'verify_peer_name' => $this->config['jab_verify_peer_name'],
@ -111,9 +111,7 @@ class jabber extends base
}
/**
* Get messenger method id
*
* @return int
* {@inheritDoc}
*/
public function get_id()
{
@ -121,10 +119,9 @@ class jabber extends base
}
/**
* get messenger method fie queue object name
* @return string
* {@inheritDoc}
*/
abstract public function get_queue_object_name($user)
public function get_queue_object_name()
{
return 'jabber';
}
@ -369,10 +366,7 @@ class jabber extends base
}
/**
* Set address as available
*
* @param array $user User row
* @return void
* {@inheritDoc}
*/
public function set_addresses($user)
{
@ -403,16 +397,17 @@ class jabber extends base
}
/**
* Inits/resets the data to default
*
* @return void
* {@inheritDoc}
*/
public function reset()
{
$this->msg = '';
$this->to = [];
$this->to = [];
parent::reset();
$this->subject = $this->additional_headers = [];
$this->msg = '';
$this->use_queue = true;
unset($this->template);
}
/**
@ -426,15 +421,12 @@ class jabber extends base
}
/**
* Send messages from the queue
*
* @param array $queue_data Queue data array
* @return void
* {@inheritDoc}
*/
public function process_queue(&$queue_data)
{
$queue_object_name = $this->get_queue_object_name();
$messages_count = count($queue_data[$queue_object_name]['data'];
$messages_count = count($queue_data[$queue_object_name]['data']);
if (!$this->is_enabled() || !$messages_count)
{

View file

@ -121,7 +121,7 @@ class queue
while ($messenger_collection_iterator->valid())
{
$messenger_method = $messenger_collection_iterator->current();
if (isset($this->queue_data[$messenger_method->get_queue_object_name()])
if (isset($this->queue_data[$messenger_method->get_queue_object_name()]))
{
$messenger_method->process_queue($this->queue_data);
}

View file

@ -27,13 +27,13 @@ use phpbb\di\service_collection;
class email extends \phpbb\notification\method\messenger_base
{
/** @var \phpbb\user */
/** @var user */
protected $user;
/** @var \phpbb\config\config */
/** @var config */
protected $config;
/** @var \phpbb\db\driver\driver_interface */
/** @var driver_interface */
protected $db;
/** @var string Notification emails table */

View file

@ -26,10 +26,10 @@ use phpbb\di\service_collection;
class jabber extends \phpbb\notification\method\messenger_base
{
/** @var \phpbb\user */
/** @var user */
protected $user;
/** @var \phpbb\config\config */
/** @var config */
protected $config;
/** @var service_collection */

View file

@ -41,7 +41,8 @@ class phpbb_console_user_activate_test extends phpbb_console_user_base
$this->notifications,
$this->user_loader,
$this->phpbb_root_path,
$this->php_ext
$this->php_ext,
$this->messenger_method_collection
));
$command = $application->find('user:activate');

View file

@ -32,7 +32,8 @@ class phpbb_console_user_add_test extends phpbb_console_user_base
$this->language,
$this->passwords_manager,
$this->phpbb_root_path,
$this->php_ext
$this->php_ext,
$this->messenger_method_collection
));
$command = $application->find('user:add');

View file

@ -105,6 +105,11 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
$phpbb_container->setParameter('tables.user_notifications', 'phpbb_user_notifications');
$this->messenger_method_collection = new \phpbb\di\service_collection($phpbb_container);
$this->messenger_method_collection->add('messenger.method.email');
$this->messenger_method_collection->add('messenger.method.jabber');
$phpbb_container->set('messenger.method_collection', $this->messenger_method_collection);
parent::setUp();
}

View file

@ -95,7 +95,8 @@ class phpbb_email_parsing_test extends phpbb_test_case
$phpbb_container->set('template.twig.extensions.collection', $twig_extensions_collection);
$twig->addExtension($twig_extension);
$phpbb_container->set('template.twig.lexer', new \phpbb\template\twig\lexer($twig));
$twig_lexer = new \phpbb\template\twig\lexer($twig);
$phpbb_container->set('template.twig.lexer', $twig_lexer);
$phpbb_container->set('dispatcher', $dispatcher);
$phpbb_container->set('language', $lang);
$phpbb_container->set('request', $request);
@ -111,13 +112,23 @@ class phpbb_email_parsing_test extends phpbb_test_case
$core_cache_dir = $phpbb_root_path . 'cache/' . PHPBB_ENVIRONMENT . '/';
$phpbb_container->setParameter('core.cache_dir', $core_cache_dir);
$core_messenger_queue_file = $core_cache_dir . 'queue.' . $phpEx;
$phpbb_container->setParameter('core.messenger_queue_file', $core_messenger_queue_file);
$messenger_method_collection = new \phpbb\di\service_collection($phpbb_container);
$messenger_method_collection->add('messenger.method.email');
$phpbb_container->set('messenger.method_collection', $messenger_method_collection);
$messenger_queue = new \phpbb\messenger\queue($config, $dispatcher, $messenger_method_collection, $core_messenger_queue_file);
$phpbb_container->set('messenger.queue', $messenger_queue);
$this->email = new \phpbb\messenger\email($config, $dispatcher, $lang, $log, $request, $user, $messenger_queue);
$this->email = new \phpbb\messenger\method\phpbb_email(
$config, $dispatcher, $lang, $log, $request, $user, $messenger_queue,
$phpbb_path_helper, $extension_manager, $twig_extensions_collection, $twig_lexer,
$cache_path
);
$phpbb_container->set('messenger.method.email', $this->email);
$reflection = new ReflectionObject($this->email);
$this->reflection_template_property = $reflection->getProperty('template');

View file

@ -146,6 +146,11 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
$phpbb_container->addCompilerPass(new phpbb\di\pass\markpublic_pass());
$messenger_method_collection = new \phpbb\di\service_collection($phpbb_container);
$messenger_method_collection->add('messenger.method.email');
$messenger_method_collection->add('messenger.method.jabber');
$phpbb_container->set('messenger.method_collection', $messenger_method_collection);
$phpbb_container->compile();
$this->notifications->setDependencies($this->auth, $this->config);

View file

@ -105,6 +105,11 @@ class notification_method_email_test extends phpbb_tests_notification_base
)
);
$messenger_method_collection = new \phpbb\di\service_collection($phpbb_container);
$messenger_method_collection->add('messenger.method.email');
$messenger_method_collection->add('messenger.method.jabber');
$phpbb_container->set('messenger.method_collection', $messenger_method_collection);
$this->notification_method_email = $this->getMockBuilder('\phpbb\notification\method\email')
->setConstructorArgs([
$phpbb_container->get('user_loader'),
@ -113,7 +118,8 @@ class notification_method_email_test extends phpbb_tests_notification_base
$phpbb_container->get('dbal.conn'),
$phpbb_root_path,
$phpEx,
$phpbb_container->getParameter('tables.notification_emails')
$phpbb_container->getParameter('tables.notification_emails'),
$phpbb_container->get('messenger.method_collection')
])
->setMethods(['notify_using_messenger'])
->getMock();

View file

@ -158,6 +158,12 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
$phpbb_container->setParameter('tables.notification_push', 'phpbb_notification_push');
$phpbb_container->setParameter('tables.push_subscriptions', 'phpbb_push_subscriptions');
$phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $config, $phpbb_dispatcher, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE));
$messenger_method_collection = new \phpbb\di\service_collection($phpbb_container);
$messenger_method_collection->add('messenger.method.email');
$messenger_method_collection->add('messenger.method.jabber');
$phpbb_container->set('messenger.method_collection', $messenger_method_collection);
$phpbb_container->addCompilerPass(new phpbb\di\pass\markpublic_pass());
$phpbb_container->compile();