[ticket/14812] Prune shadow topics during system cron too

PHPBB3-14812
This commit is contained in:
Oliver Schramm 2018-10-04 01:56:52 +02:00
parent 001f32da95
commit 842e40dab9

View file

@ -55,12 +55,12 @@ class prune_all_forums extends \phpbb\cron\task\base
include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext); include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext);
} }
$sql = 'SELECT forum_id, prune_next, enable_prune, prune_days, prune_viewed, forum_flags, prune_freq $sql = 'SELECT forum_id, prune_next, enable_prune, prune_days, prune_viewed, enable_shadow_prune, prune_shadow_days, prune_shadow_freq, prune_shadow_next, forum_flags, prune_freq
FROM ' . FORUMS_TABLE . " FROM ' . FORUMS_TABLE;
WHERE enable_prune = 1
AND prune_next < " . time();
$result = $this->db->sql_query($sql); $result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) while ($row = $this->db->sql_fetchrow($result))
{
if ($row['enable_prune'] && $row['prune_next'] < time())
{ {
if ($row['prune_days']) if ($row['prune_days'])
{ {
@ -72,6 +72,11 @@ class prune_all_forums extends \phpbb\cron\task\base
auto_prune($row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']); auto_prune($row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']);
} }
} }
if ($row['enable_shadow_prune'] && $row['prune_shadow_next'] < time() && $row['prune_shadow_days'])
{
auto_prune($row['forum_id'], 'shadow', $row['forum_flags'], $row['prune_shadow_days'], $row['prune_shadow_freq']);
}
}
$this->db->sql_freeresult($result); $this->db->sql_freeresult($result);
} }