Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions phpBB/config/cron_tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ services:
- @config
- @dbal.conn
- @log
- @user
calls:
- [set_name, [cron.task.core.prune_shadow_topics]]
tags:
Expand Down
10 changes: 8 additions & 2 deletions phpBB/phpbb/cron/task/core/prune_shadow_topics.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class prune_shadow_topics extends \phpbb\cron\task\base implements \phpbb\cron\t
protected $config;
protected $db;
protected $log;
protected $user;

/**
* If $forum_data is given, it is assumed to contain necessary information
Expand All @@ -44,14 +45,16 @@ class prune_shadow_topics extends \phpbb\cron\task\base implements \phpbb\cron\t
* @param \phpbb\config\config $config The config
* @param \phpbb\db\driver\driver $db The db connection
* @param \phpbb\log\log $log The phpBB log system
* @param \phpbb\user $user The phpBB user object
*/
public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\log\log $log)
public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\log\log $log, \phpbb\user $user)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$this->config = $config;
$this->db = $db;
$this->log = $log;
$this->user = $user;
}

/**
Expand Down Expand Up @@ -183,7 +186,10 @@ protected function auto_prune_shadow_topics($forum_id, $prune_mode, $prune_flags
WHERE forum_id = $forum_id";
$this->db->sql_query($sql);

$this->log->add('admin', 'LOG_PRUNE_SHADOW', $row['forum_name']);
$user_id = (empty($this->user->data)) ? ANONYMOUS : $this->user->data['user_id'];
$user_ip = (empty($this->user->ip)) ? '' : $this->user->ip;

$this->log->add('admin', $user_id, $user_ip, 'LOG_PRUNE_SHADOW', false, array($row['forum_name']));
}

return;
Expand Down