[ticket/16955] Clean up cron and console classes

PHPBB3-16955
This commit is contained in:
Marc Alexander 2022-12-27 14:31:23 +01:00
parent a8b878349a
commit b855b8a5a5
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
6 changed files with 9 additions and 10 deletions

View file

@ -101,7 +101,7 @@ class update_hashes extends \phpbb\console\command\command
while ($row = $this->db->sql_fetchrow($result))
{
$old_hash = preg_replace('/^\$CP\$/', '', $row['user_password']);
$new_hash = $this->passwords_manager->hash($old_hash, array($this->default_type));
$new_hash = $this->passwords_manager->hash($old_hash, [$this->default_type]);
$sql = 'UPDATE ' . USERS_TABLE . "
SET user_password = '" . $this->db->sql_escape($new_hash) . "'

View file

@ -164,7 +164,7 @@ class manager
* Web runner uses this method to resolve names to tasks.
*
* @param string $name Name of the task to look up.
* @return wrapper A wrapped task corresponding to the given name, or null.
* @return wrapper|null A wrapped task corresponding to the given name, or null.
*/
public function find_task($name)
{

View file

@ -166,7 +166,8 @@ class prune_shadow_topics extends \phpbb\cron\task\base implements \phpbb\cron\t
* @param int $prune_flags Prune flags
* @param int $prune_days Prune date in days
* @param int $prune_freq Prune frequency
* @return null
*
* @return void
*/
protected function auto_prune_shadow_topics($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_freq)
{
@ -194,7 +195,5 @@ class prune_shadow_topics extends \phpbb\cron\task\base implements \phpbb\cron\t
$this->log->add('admin', $user_id, $user_ip, 'LOG_PRUNE_SHADOW', false, array($row['forum_name']));
}
return;
}
}

View file

@ -107,7 +107,7 @@ class update_hashes extends \phpbb\cron\task\base
while ($row = $this->db->sql_fetchrow($result))
{
$old_hash = preg_replace('/^\$CP\$/', '', $row['user_password']);
$new_hash = $this->passwords_manager->hash($old_hash, array($this->default_type));
$new_hash = $this->passwords_manager->hash($old_hash, [$this->default_type]);
// Increase number so we know that users were selected from the database
$affected_rows++;

View file

@ -91,7 +91,7 @@ class wrapper
{
$params = [];
$params['cron_type'] = $this->get_name();
if ($this->is_parametrized())
if ($this->task instanceof parametrized)
{
$params = array_merge($params, $this->task->get_parameters());
}
@ -113,7 +113,7 @@ class wrapper
$this->template->assign_var('CRON_TASK_URL', $this->get_url());
return $this->template->assign_display('cron_html_tag');
return (string) $this->template->assign_display('cron_html_tag');
}
/**

View file

@ -206,8 +206,8 @@ class manager
* Hash supplied password
*
* @param string $password Password that should be hashed
* @param string $type Hash type. Will default to standard hash type if
* none is supplied
* @param string|array $type Hash type. Will default to standard hash type if
* none is supplied, array for combined hashing
* @return string|bool Password hash of supplied password or false if
* if something went wrong during hashing
*/