[ticket/13952] Inject dispatcher dependency to the tidy search cron task

PHPBB3-13952
This commit is contained in:
rxu 2015-06-20 21:39:06 +07:00
parent da7b24449d
commit a8fe3926dc
2 changed files with 6 additions and 2 deletions

View file

@ -120,6 +120,7 @@ services:
- @config
- @dbal.conn
- @user
- @dispatcher
calls:
- [set_name, [cron.task.core.tidy_search]]
tags:

View file

@ -26,6 +26,7 @@ class tidy_search extends \phpbb\cron\task\base
protected $config;
protected $db;
protected $user;
protected $phpbb_dispatcher;
/**
* Constructor.
@ -36,8 +37,9 @@ class tidy_search extends \phpbb\cron\task\base
* @param \phpbb\config\config $config The config
* @param \phpbb\db\driver\driver_interface $db The db connection
* @param \phpbb\user $user The user
* @param \phpbb\event\dispatcher_interface $phpbb_dispatcher The event dispatcher
*/
public function __construct($phpbb_root_path, $php_ext, \phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user)
public function __construct($phpbb_root_path, $php_ext, \phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, \phpbb\event\dispatcher_interface $phpbb_dispatcher)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
@ -45,6 +47,7 @@ class tidy_search extends \phpbb\cron\task\base
$this->config = $config;
$this->db = $db;
$this->user = $user;
$this->phpbb_dispatcher = $phpbb_dispatcher;
}
/**
@ -58,7 +61,7 @@ class tidy_search extends \phpbb\cron\task\base
// We do some additional checks in the module to ensure it can actually be utilised
$error = false;
$search = new $search_type($error, $this->phpbb_root_path, $this->php_ext, $this->auth, $this->config, $this->db, $this->user);
$search = new $search_type($error, $this->phpbb_root_path, $this->php_ext, $this->auth, $this->config, $this->db, $this->user, $this->phpbb_dispatcher);
if (!$error)
{