diff options
author | Maat <maat-pub@mageia.biz> | 2020-05-08 21:52:11 +0200 |
---|---|---|
committer | Maat <maat-pub@mageia.biz> | 2020-05-08 21:52:11 +0200 |
commit | 8ea437e30605e0f66b5220bf904a61d7c1d11ddd (patch) | |
tree | e0db2bb4a012d5b06a633160b19f62f4868ecd28 /phpBB/includes/acp/acp_search.php | |
parent | 36bc1870f21fac04736a1049c1d5b8e127d729f4 (diff) | |
parent | 2fdd46b36431ae0f58bb2e78e42553168db9a0ff (diff) | |
download | forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.gz forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.bz2 forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.xz forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.zip |
Merge remote-tracking branch 'upstream/prep-release-3.2.9'
Diffstat (limited to 'phpBB/includes/acp/acp_search.php')
-rw-r--r-- | phpBB/includes/acp/acp_search.php | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index cc1e5df084..538a28a926 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -50,8 +50,8 @@ class acp_search function settings($id, $mode) { - global $db, $user, $auth, $template, $cache, $request; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $user, $template, $phpbb_log, $request; + global $config, $phpbb_admin_path, $phpEx; $submit = (isset($_POST['submit'])) ? true : false; @@ -109,8 +109,8 @@ class acp_search unset($search); unset($error); - $cfg_array = (isset($_REQUEST['config'])) ? request_var('config', array('' => ''), true) : array(); - $updated = request_var('updated', false); + $cfg_array = (isset($_REQUEST['config'])) ? $request->variable('config', array('' => ''), true) : array(); + $updated = $request->variable('updated', false); foreach ($settings as $config_name => $var_type) { @@ -138,7 +138,7 @@ class acp_search // only change config if anything was actually changed if ($submit && ($config[$config_name] != $config_value)) { - set_config($config_name, $config_value); + $config->set($config_name, $config_value); $updated = true; } } @@ -148,7 +148,7 @@ class acp_search $extra_message = ''; if ($updated) { - add_log('admin', 'LOG_CONFIG_SEARCH'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_SEARCH'); } if (isset($cfg_array['search_type']) && in_array($cfg_array['search_type'], $search_types, true) && ($cfg_array['search_type'] != $config['search_type'])) @@ -162,11 +162,11 @@ class acp_search { if (!method_exists($search, 'init') || !($error = $search->init())) { - set_config('search_type', $cfg_array['search_type']); + $config->set('search_type', $cfg_array['search_type']); if (!$updated) { - add_log('admin', 'LOG_CONFIG_SEARCH'); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_SEARCH'); } $extra_message = '<br />' . $user->lang['SWITCHED_SEARCH_BACKEND'] . '<br /><a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=search&mode=index') . '">» ' . $user->lang['GO_TO_SEARCH_INDEX'] . '</a>'; } @@ -237,10 +237,10 @@ class acp_search function index($id, $mode) { - global $db, $user, $auth, $template, $cache, $request; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $db, $user, $template, $phpbb_log, $request; + global $config, $phpbb_admin_path, $phpEx; - $action = request_var('action', ''); + $action = $request->variable('action', ''); $this->state = explode(',', $config['search_indexing_state']); if (isset($_POST['cancel'])) @@ -261,7 +261,7 @@ class acp_search switch ($action) { case 'progress_bar': - $type = request_var('type', ''); + $type = $request->variable('type', ''); $this->display_progress_bar($type); break; @@ -280,7 +280,7 @@ class acp_search if (empty($this->state[0])) { - $this->state[0] = request_var('search_type', ''); + $this->state[0] = $request->variable('search_type', ''); } $this->search = null; @@ -314,8 +314,7 @@ class acp_search } else { - $starttime = explode(' ', microtime()); - $starttime = $starttime[1] + $starttime[0]; + $starttime = microtime(true); $row_count = 0; while (still_on_time() && $post_counter <= $this->max_post_id) { @@ -333,9 +332,9 @@ class acp_search $forum_ids[] = $row['forum_id']; } $db->sql_freeresult($result); - $row_count += sizeof($ids); + $row_count += count($ids); - if (sizeof($ids)) + if (count($ids)) { $this->search->index_remove($ids, $posters, $forum_ids); } @@ -347,11 +346,10 @@ class acp_search if ($post_counter <= $this->max_post_id) { - $mtime = explode(' ', microtime()); - $totaltime = $mtime[0] + $mtime[1] - $starttime; + $totaltime = microtime(true) - $starttime; $rows_per_second = $row_count / $totaltime; meta_refresh(1, append_sid($this->u_action . '&action=delete&skip_rows=' . $post_counter . '&hash=' . generate_link_hash('acp_search'))); - trigger_error($user->lang('SEARCH_INDEX_DELETE_REDIRECT', (int) $row_count, $post_counter, $rows_per_second)); + trigger_error($user->lang('SEARCH_INDEX_DELETE_REDIRECT', (int) $row_count, $post_counter) . $user->lang('SEARCH_INDEX_DELETE_REDIRECT_RATE', $rows_per_second)); } } @@ -360,7 +358,7 @@ class acp_search $this->state = array(''); $this->save_state(); - add_log('admin', 'LOG_SEARCH_INDEX_REMOVED', $name); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_SEARCH_INDEX_REMOVED', false, array($name)); trigger_error($user->lang['SEARCH_INDEX_REMOVED'] . adm_back_link($this->u_action) . $this->close_popup_js()); break; @@ -387,8 +385,7 @@ class acp_search } $db->sql_freeresult($result); - $starttime = explode(' ', microtime()); - $starttime = $starttime[1] + $starttime[0]; + $starttime = microtime(true); $row_count = 0; while (still_on_time() && $post_counter <= $this->max_post_id) { @@ -437,8 +434,7 @@ class acp_search if ($post_counter <= $this->max_post_id) { - $mtime = explode(' ', microtime()); - $totaltime = $mtime[0] + $mtime[1] - $starttime; + $totaltime = microtime(true) - $starttime; $rows_per_second = $row_count / $totaltime; meta_refresh(1, append_sid($this->u_action . '&action=create&skip_rows=' . $post_counter . '&hash=' . generate_link_hash('acp_search'))); trigger_error($user->lang('SEARCH_INDEX_CREATE_REDIRECT', (int) $row_count, $post_counter) . $user->lang('SEARCH_INDEX_CREATE_REDIRECT_RATE', $rows_per_second)); @@ -450,7 +446,7 @@ class acp_search $this->state = array(''); $this->save_state(); - add_log('admin', 'LOG_SEARCH_INDEX_CREATED', $name); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_SEARCH_INDEX_CREATED', false, array($name)); trigger_error($user->lang['SEARCH_INDEX_CREATED'] . adm_back_link($this->u_action) . $this->close_popup_js()); break; } @@ -478,8 +474,8 @@ class acp_search $statistics = array(); foreach ($data as $statistic => $value) { - $n = sizeof($statistics); - if ($n && sizeof($statistics[$n - 1]) < 3) + $n = count($statistics); + if ($n && count($statistics[$n - 1]) < 3) { $statistics[$n - 1] += array('statistic_2' => $statistic, 'value_2' => $value); } @@ -496,7 +492,7 @@ class acp_search 'S_ACTIVE' => ($type == $config['search_type']) ? true : false, 'S_HIDDEN_FIELDS' => build_hidden_fields(array('search_type' => $type)), 'S_INDEXED' => (bool) $search->index_created(), - 'S_STATS' => (bool) sizeof($statistics)) + 'S_STATS' => (bool) count($statistics)) ); foreach ($statistics as $statistic) @@ -566,7 +562,7 @@ class acp_search function get_search_types() { - global $phpbb_root_path, $phpEx, $phpbb_extension_manager; + global $phpbb_extension_manager; $finder = $phpbb_extension_manager->get_finder(); @@ -592,6 +588,8 @@ class acp_search function save_state($state = false) { + global $config; + if ($state) { $this->state = $state; @@ -599,7 +597,7 @@ class acp_search ksort($this->state); - set_config('search_indexing_state', implode(',', $this->state), true); + $config->set('search_indexing_state', implode(',', $this->state), true); } /** |