diff options
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/avatar/driver/local.php | 8 | ||||
-rw-r--r-- | phpBB/phpbb/console/command/cron/cron_list.php | 90 | ||||
-rw-r--r-- | phpBB/phpbb/cron/manager.php | 10 | ||||
-rw-r--r-- | phpBB/phpbb/log/log.php | 31 |
4 files changed, 120 insertions, 19 deletions
diff --git a/phpBB/phpbb/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php index 00e519e3f2..f3acf7cb2c 100644 --- a/phpBB/phpbb/avatar/driver/local.php +++ b/phpBB/phpbb/avatar/driver/local.php @@ -36,7 +36,7 @@ class local extends \phpbb\avatar\driver\driver public function prepare_form($request, $template, $user, $row, &$error) { $avatar_list = $this->get_avatar_list($user); - $category = $request->variable('avatar_local_cat', ''); + $category = $request->variable('avatar_local_cat', key($avatar_list)); foreach ($avatar_list as $cat => $null) { @@ -131,7 +131,7 @@ class local extends \phpbb\avatar\driver\driver } return array( - 'avatar' => ($category != $user->lang['MAIN']) ? $category . '/' . $file : $file, + 'avatar' => ($category != $user->lang['NO_AVATAR_CATEGORY']) ? $category . '/' . $file : $file, 'avatar_width' => $avatar_list[$category][urldecode($file)]['width'], 'avatar_height' => $avatar_list[$category][urldecode($file)]['height'], ); @@ -179,9 +179,9 @@ class local extends \phpbb\avatar\driver\driver { $dims = array(0, 0); } - $cat = ($path == $file_path) ? $user->lang['MAIN'] : str_replace("$path/", '', $file_path); + $cat = ($path == $file_path) ? $user->lang['NO_AVATAR_CATEGORY'] : str_replace("$path/", '', $file_path); $avatar_list[$cat][$image] = array( - 'file' => ($cat != $user->lang['MAIN']) ? rawurlencode($cat) . '/' . rawurlencode($image) : rawurlencode($image), + 'file' => ($cat != $user->lang['NO_AVATAR_CATEGORY']) ? rawurlencode($cat) . '/' . rawurlencode($image) : rawurlencode($image), 'filename' => rawurlencode($image), 'name' => ucfirst(str_replace('_', ' ', preg_replace('#^(.*)\..*$#', '\1', $image))), 'width' => $dims[0], diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php new file mode 100644 index 0000000000..9db6a23947 --- /dev/null +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -0,0 +1,90 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +namespace phpbb\console\command\cron; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class cron_list extends \phpbb\console\command\command +{ + /** @var \phpbb\cron\manager */ + protected $cron_manager; + + /** @var \phpbb\user */ + protected $user; + + public function __construct(\phpbb\cron\manager $cron_manager, \phpbb\user $user) + { + $this->cron_manager = $cron_manager; + $this->user = $user; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('cron:list') + ->setDescription($this->user->lang('CLI_DESCRIPTION_CRON_LIST')) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $tasks = $this->cron_manager->get_tasks(); + + if (empty($tasks)) + { + $output->writeln($this->user->lang('CRON_NO_TASKS')); + return; + } + + $ready_tasks = array(); + $not_ready_tasks = array(); + foreach ($tasks as $task) + { + if ($task->is_ready()) + { + $ready_tasks[] = $task; + } + else + { + $not_ready_tasks[] = $task; + } + } + + if (!empty($ready_tasks)) + { + $output->writeln('<info>' . $this->user->lang('TASKS_READY') . '</info>'); + $this->print_tasks_names($ready_tasks, $output); + } + + if (!empty($ready_tasks) && !empty($not_ready_tasks)) + { + $output->writeln(''); + } + + if (!empty($not_ready_tasks)) + { + $output->writeln('<info>' . $this->user->lang('TASKS_NOT_READY') . '</info>'); + $this->print_tasks_names($not_ready_tasks, $output); + } + } + + protected function print_tasks_names(array $tasks, OutputInterface $output) + { + foreach ($tasks as $task) + { + $output->writeln($task->get_name()); + } + } +} diff --git a/phpBB/phpbb/cron/manager.php b/phpBB/phpbb/cron/manager.php index 1eb8edf033..f04f063228 100644 --- a/phpBB/phpbb/cron/manager.php +++ b/phpBB/phpbb/cron/manager.php @@ -122,6 +122,16 @@ class manager } /** + * Find all tasks and return them. + * + * @return array List of all tasks. + */ + public function get_tasks() + { + return $this->tasks; + } + + /** * Wraps a task inside an instance of \phpbb\cron\task\wrapper. * * @param \phpbb\cron\task\task $task The task. diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index 453cb740bb..10efe5fd1c 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -391,28 +391,29 @@ class log implements \phpbb\log\log_interface } $sql_where = 'WHERE log_type = ' . $log_type; + + if (isset($conditions['keywords'])) + { + $sql_where .= $this->generate_sql_keyword($conditions['keywords'], ''); + + unset($conditions['keywords']); + } + foreach ($conditions as $field => $field_value) { $sql_where .= ' AND '; - if ($field == 'keywords') + if (is_array($field_value) && sizeof($field_value) == 2 && !is_array($field_value[1])) + { + $sql_where .= $field . ' ' . $field_value[0] . ' ' . $field_value[1]; + } + else if (is_array($field_value) && isset($field_value['IN']) && is_array($field_value['IN'])) { - $sql_where .= $this->generate_sql_keyword($field_value, '', ''); + $sql_where .= $this->db->sql_in_set($field, $field_value['IN']); } else { - if (is_array($field_value) && sizeof($field_value) == 2 && !is_array($field_value[1])) - { - $sql_where .= $field . ' ' . $field_value[0] . ' ' . $field_value[1]; - } - else if (is_array($field_value) && isset($field_value['IN']) && is_array($field_value['IN'])) - { - $sql_where .= $this->db->sql_in_set($field, $field_value['IN']); - } - else - { - $sql_where .= $field . ' = ' . $field_value; - } + $sql_where .= $field . ' = ' . $field_value; } } @@ -781,7 +782,7 @@ class log implements \phpbb\log\log_interface } } - $sql_keywords = $statement_operator . ' ('; + $sql_keywords = ' ' . $statement_operator . ' ('; if (!empty($operations)) { $sql_keywords .= $this->db->sql_in_set($table_alias . 'log_operation', $operations) . ' OR '; |