mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/17135] Use email method instead of service collection where appropriate
PHPBB-17135
This commit is contained in:
@@ -17,10 +17,10 @@ use phpbb\config\config;
|
||||
use phpbb\console\command\command;
|
||||
use phpbb\language\language;
|
||||
use phpbb\log\log_interface;
|
||||
use phpbb\messenger\method\email;
|
||||
use phpbb\notification\manager;
|
||||
use phpbb\user;
|
||||
use phpbb\user_loader;
|
||||
use phpbb\di\service_collection;
|
||||
use Symfony\Component\Console\Command\Command as symfony_command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
@@ -33,15 +33,15 @@ class activate extends command
|
||||
/** @var config */
|
||||
protected $config;
|
||||
|
||||
/** @var email */
|
||||
protected $email_method;
|
||||
|
||||
/** @var language */
|
||||
protected $language;
|
||||
|
||||
/** @var log_interface */
|
||||
protected $log;
|
||||
|
||||
/** @var service_collection */
|
||||
protected $messenger;
|
||||
|
||||
/** @var manager */
|
||||
protected $notifications;
|
||||
|
||||
@@ -69,18 +69,18 @@ class activate extends command
|
||||
* @param config $config
|
||||
* @param language $language
|
||||
* @param log_interface $log
|
||||
* @param service_collection $messenger
|
||||
* @param email $email_method
|
||||
* @param manager $notifications
|
||||
* @param user_loader $user_loader
|
||||
* @param string $phpbb_root_path
|
||||
* @param string $php_ext
|
||||
*/
|
||||
public function __construct(user $user, config $config, language $language, log_interface $log, service_collection $messenger, manager $notifications, user_loader $user_loader, $phpbb_root_path, $php_ext)
|
||||
public function __construct(user $user, config $config, language $language, log_interface $log, email $email_method, manager $notifications, user_loader $user_loader, $phpbb_root_path, $php_ext)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->email_method = $email_method;
|
||||
$this->language = $language;
|
||||
$this->log = $log;
|
||||
$this->messenger = $messenger;
|
||||
$this->notifications = $notifications;
|
||||
$this->user_loader = $user_loader;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
@@ -200,15 +200,14 @@ class activate extends command
|
||||
|
||||
if ($input->getOption('send-email'))
|
||||
{
|
||||
$email_method = $this->messenger->offsetGet('messenger.method.email');
|
||||
$email_method->set_use_queue(false);
|
||||
$email_method->template('admin_welcome_activated', $user_row['user_lang']);
|
||||
$email_method->set_addresses($user_row);
|
||||
$email_method->anti_abuse_headers($this->config, $this->user);
|
||||
$email_method->assign_vars([
|
||||
$this->email_method->set_use_queue(false);
|
||||
$this->email_method->template('admin_welcome_activated', $user_row['user_lang']);
|
||||
$this->email_method->set_addresses($user_row);
|
||||
$this->email_method->anti_abuse_headers($this->config, $this->user);
|
||||
$this->email_method->assign_vars([
|
||||
'USERNAME' => html_entity_decode($user_row['username'], ENT_COMPAT),
|
||||
]);
|
||||
$email_method->send();
|
||||
$this->email_method->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -18,9 +18,9 @@ use phpbb\console\command\command;
|
||||
use phpbb\db\driver\driver_interface;
|
||||
use phpbb\exception\runtime_exception;
|
||||
use phpbb\language\language;
|
||||
use phpbb\messenger\method\email;
|
||||
use phpbb\passwords\manager;
|
||||
use phpbb\user;
|
||||
use phpbb\di\service_collection;
|
||||
use Symfony\Component\Console\Command\Command as symfony_command;
|
||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
@@ -40,12 +40,12 @@ class add extends command
|
||||
/** @var config */
|
||||
protected $config;
|
||||
|
||||
/** @var email */
|
||||
protected $email_method;
|
||||
|
||||
/** @var language */
|
||||
protected $language;
|
||||
|
||||
/** @var service_collection */
|
||||
protected $messenger;
|
||||
|
||||
/** @var manager */
|
||||
protected $password_manager;
|
||||
|
||||
@@ -75,12 +75,12 @@ class add extends command
|
||||
* @param string $phpbb_root_path
|
||||
* @param string $php_ext
|
||||
*/
|
||||
public function __construct(user $user, driver_interface $db, config $config, language $language, service_collection $messenger, manager $password_manager, $phpbb_root_path, $php_ext)
|
||||
public function __construct(user $user, driver_interface $db, config $config, language $language, email $email_method, manager $password_manager, $phpbb_root_path, $php_ext)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
$this->email_method = $email_method;
|
||||
$this->language = $language;
|
||||
$this->messenger = $messenger;
|
||||
$this->password_manager = $password_manager;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
@@ -313,18 +313,17 @@ class add extends command
|
||||
|
||||
$user_actkey = $this->get_activation_key($user_id);
|
||||
|
||||
$email_method = $this->messenger->offsetGet('messenger.method.email');
|
||||
$email_method->set_use_queue(false);
|
||||
$email_method->template($email_template, $this->user->lang_name);
|
||||
$email_method->to($this->data['email'], $this->data['username']);
|
||||
$email_method->anti_abuse_headers($this->config, $this->user);
|
||||
$email_method->assign_vars([
|
||||
$this->email_method->set_use_queue(false);
|
||||
$this->email_method->template($email_template, $this->user->lang_name);
|
||||
$this->email_method->to($this->data['email'], $this->data['username']);
|
||||
$this->email_method->anti_abuse_headers($this->config, $this->user);
|
||||
$this->email_method->assign_vars([
|
||||
'WELCOME_MSG' => html_entity_decode($this->language->lang('WELCOME_SUBJECT', $this->config['sitename']), ENT_COMPAT),
|
||||
'USERNAME' => html_entity_decode($this->data['username'], ENT_COMPAT),
|
||||
'PASSWORD' => html_entity_decode($this->data['new_password'], ENT_COMPAT),
|
||||
'U_ACTIVATE' => generate_board_url() . "/ucp.{$this->php_ext}?mode=activate&u=$user_id&k=$user_actkey",
|
||||
]);
|
||||
$email_method->send();
|
||||
$this->email_method->send();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user