[ticket/12150] Use log service instead of add_log() function

PHPBB3-12150
This commit is contained in:
Marc Alexander 2014-03-29 21:29:22 +01:00
parent d83d819827
commit 494dd4110b
2 changed files with 6 additions and 2 deletions

View file

@ -30,6 +30,7 @@ services:
- %core.php_ext% - %core.php_ext%
- @config - @config
- @dbal.conn - @dbal.conn
- @log
calls: calls:
- [set_name, [cron.task.core.prune_shadow_topics]] - [set_name, [cron.task.core.prune_shadow_topics]]
tags: tags:

View file

@ -24,6 +24,7 @@ class prune_shadow_topics extends \phpbb\cron\task\base implements \phpbb\cron\t
protected $php_ext; protected $php_ext;
protected $config; protected $config;
protected $db; protected $db;
protected $log;
/** /**
* If $forum_data is given, it is assumed to contain necessary information * If $forum_data is given, it is assumed to contain necessary information
@ -42,13 +43,15 @@ class prune_shadow_topics extends \phpbb\cron\task\base implements \phpbb\cron\t
* @param string $php_ext The PHP extension * @param string $php_ext The PHP extension
* @param \phpbb\config\config $config The config * @param \phpbb\config\config $config The config
* @param \phpbb\db\driver\driver $db The db connection * @param \phpbb\db\driver\driver $db The db connection
* @param \phpbb\log\log $log The phpBB log system
*/ */
public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver $db) public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\log\log $log)
{ {
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
$this->config = $config; $this->config = $config;
$this->db = $db; $this->db = $db;
$this->log = $log;
} }
/** /**
@ -180,7 +183,7 @@ class prune_shadow_topics extends \phpbb\cron\task\base implements \phpbb\cron\t
WHERE forum_id = $forum_id"; WHERE forum_id = $forum_id";
$this->db->sql_query($sql); $this->db->sql_query($sql);
add_log('admin', 'LOG_PRUNE_SHADOW', $row['forum_name']); $this->log->add('admin', 'LOG_PRUNE_SHADOW', $row['forum_name']);
} }
return; return;