diff options
Diffstat (limited to 'phpBB/phpbb/cron/task/core')
-rw-r--r-- | phpBB/phpbb/cron/task/core/prune_all_forums.php | 23 | ||||
-rw-r--r-- | phpBB/phpbb/cron/task/core/prune_forum.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/cron/task/core/prune_shadow_topics.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/cron/task/core/queue.php | 19 | ||||
-rw-r--r-- | phpBB/phpbb/cron/task/core/tidy_plupload.php | 18 | ||||
-rw-r--r-- | phpBB/phpbb/cron/task/core/update_hashes.php | 6 |
6 files changed, 43 insertions, 27 deletions
diff --git a/phpBB/phpbb/cron/task/core/prune_all_forums.php b/phpBB/phpbb/cron/task/core/prune_all_forums.php index b47939ccbe..5005f5b894 100644 --- a/phpBB/phpbb/cron/task/core/prune_all_forums.php +++ b/phpBB/phpbb/cron/task/core/prune_all_forums.php @@ -55,21 +55,26 @@ class prune_all_forums extends \phpbb\cron\task\base 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 - FROM ' . FORUMS_TABLE . " - WHERE enable_prune = 1 - AND prune_next < " . time(); + $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; $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { - if ($row['prune_days']) + if ($row['enable_prune'] && $row['prune_next'] < time()) { - auto_prune($row['forum_id'], 'posted', $row['forum_flags'], $row['prune_days'], $row['prune_freq']); - } + if ($row['prune_days']) + { + auto_prune($row['forum_id'], 'posted', $row['forum_flags'], $row['prune_days'], $row['prune_freq']); + } - if ($row['prune_viewed']) + if ($row['prune_viewed']) + { + 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'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']); + auto_prune($row['forum_id'], 'shadow', $row['forum_flags'], $row['prune_shadow_days'], $row['prune_shadow_freq']); } } $this->db->sql_freeresult($result); diff --git a/phpBB/phpbb/cron/task/core/prune_forum.php b/phpBB/phpbb/cron/task/core/prune_forum.php index ba68565197..abf91aee19 100644 --- a/phpBB/phpbb/cron/task/core/prune_forum.php +++ b/phpBB/phpbb/cron/task/core/prune_forum.php @@ -31,7 +31,7 @@ class prune_forum extends \phpbb\cron\task\base implements \phpbb\cron\task\para * If $forum_data is given, it is assumed to contain necessary information * about a single forum that is to be pruned. * - * If $forum_data is not given, forum id will be retrieved via request_var + * If $forum_data is not given, forum id will be retrieved via $request->variable() * and a database query will be performed to load the necessary information * about the forum. */ diff --git a/phpBB/phpbb/cron/task/core/prune_shadow_topics.php b/phpBB/phpbb/cron/task/core/prune_shadow_topics.php index 97a4b0ea86..0ab59f9ed5 100644 --- a/phpBB/phpbb/cron/task/core/prune_shadow_topics.php +++ b/phpBB/phpbb/cron/task/core/prune_shadow_topics.php @@ -33,7 +33,7 @@ class prune_shadow_topics extends \phpbb\cron\task\base implements \phpbb\cron\t * If $forum_data is given, it is assumed to contain necessary information * about a single forum that is to be pruned. * - * If $forum_data is not given, forum id will be retrieved via request_var + * If $forum_data is not given, forum id will be retrieved via $request->variable() * and a database query will be performed to load the necessary information * about the forum. */ diff --git a/phpBB/phpbb/cron/task/core/queue.php b/phpBB/phpbb/cron/task/core/queue.php index a9345a44df..eca69a5041 100644 --- a/phpBB/phpbb/cron/task/core/queue.php +++ b/phpBB/phpbb/cron/task/core/queue.php @@ -20,20 +20,23 @@ class queue extends \phpbb\cron\task\base { protected $phpbb_root_path; protected $php_ext; + protected $cache_dir; protected $config; /** - * Constructor. - * - * @param string $phpbb_root_path The root path - * @param string $php_ext PHP file extension - * @param \phpbb\config\config $config The config - */ - public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config) + * Constructor. + * + * @param string $phpbb_root_path The root path + * @param string $php_ext PHP file extension + * @param \phpbb\config\config $config The config + * @param string $cache_dir phpBB cache directory + */ + public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, $cache_dir) { $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->config = $config; + $this->cache_dir = $cache_dir; } /** @@ -60,7 +63,7 @@ class queue extends \phpbb\cron\task\base */ public function is_runnable() { - return file_exists($this->phpbb_root_path . 'cache/queue.' . $this->php_ext); + return file_exists($this->cache_dir . 'queue.' . $this->php_ext); } /** diff --git a/phpBB/phpbb/cron/task/core/tidy_plupload.php b/phpBB/phpbb/cron/task/core/tidy_plupload.php index b6aeecf4b4..37d0e9b21a 100644 --- a/phpBB/phpbb/cron/task/core/tidy_plupload.php +++ b/phpBB/phpbb/cron/task/core/tidy_plupload.php @@ -42,6 +42,12 @@ class tidy_plupload extends \phpbb\cron\task\base */ protected $config; + /** @var \phpbb\log\log_interface */ + protected $log; + + /** @var \phpbb\user */ + protected $user; + /** * Directory where plupload stores temporary files. * @var string @@ -53,11 +59,15 @@ class tidy_plupload extends \phpbb\cron\task\base * * @param string $phpbb_root_path The root path * @param \phpbb\config\config $config The config + * @param \phpbb\log\log_interface $log Log + * @param \phpbb\user $user User object */ - public function __construct($phpbb_root_path, \phpbb\config\config $config) + public function __construct($phpbb_root_path, \phpbb\config\config $config, \phpbb\log\log_interface $log, \phpbb\user $user) { $this->phpbb_root_path = $phpbb_root_path; $this->config = $config; + $this->log = $log; + $this->user = $user; $this->plupload_upload_path = $this->phpbb_root_path . $this->config['upload_path'] . '/plupload'; } @@ -88,13 +98,11 @@ class tidy_plupload extends \phpbb\cron\task\base } catch (\UnexpectedValueException $e) { - add_log( - 'critical', - 'LOG_PLUPLOAD_TIDY_FAILED', + $this->log->add('critical', $this->user->data['user_id'], $this->user->ip, 'LOG_PLUPLOAD_TIDY_FAILED', false, array( $this->plupload_upload_path, $e->getMessage(), $e->getTraceAsString() - ); + )); } $this->config->set('plupload_last_gc', time(), true); diff --git a/phpBB/phpbb/cron/task/core/update_hashes.php b/phpBB/phpbb/cron/task/core/update_hashes.php index a4fe477d99..ba095abc8b 100644 --- a/phpBB/phpbb/cron/task/core/update_hashes.php +++ b/phpBB/phpbb/cron/task/core/update_hashes.php @@ -111,9 +111,9 @@ class update_hashes extends \phpbb\cron\task\base // Increase number so we know that users were selected from the database $affected_rows++; - $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_password = "' . $this->db->sql_escape($new_hash) . '" - WHERE user_id = ' . (int) $row['user_id']; + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_password = '" . $this->db->sql_escape($new_hash) . "' + WHERE user_id = " . (int) $row['user_id']; $this->db->sql_query($sql); } |