diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index cd45e527d0..b7feed8afb 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -371,6 +371,13 @@ class acp_search */ private function index_action(string $id, string $mode, string $action): void { + // Start displaying progress on first submit + if ($this->request->is_set_post('submit')) + { + $this->display_progress_bar($id, $mode); + return; + } + // For some this may be of help... @ini_set('memory_limit', '128M'); @@ -392,13 +399,6 @@ class acp_search } } - // Start displaying progress on first submit - if ($this->request->is_set_post('submit')) - { - $this->display_progress_bar($id, $mode); - return; - } - // Execute create/delete $type = $this->search_state_helper->type(); $action = $this->search_state_helper->action(); @@ -499,21 +499,19 @@ class acp_search */ protected function get_post_index_progress(int $post_counter): array { - global $db; - $sql = 'SELECT COUNT(post_id) as done_count FROM ' . POSTS_TABLE . ' WHERE post_id <= ' . $post_counter; - $result = $db->sql_query($sql); - $done_count = (int) $db->sql_fetchfield('done_count'); - $db->sql_freeresult($result); + $result = $this->db->sql_query($sql); + $done_count = (int) $this->db->sql_fetchfield('done_count'); + $this->db->sql_freeresult($result); $sql = 'SELECT COUNT(post_id) as remain_count FROM ' . POSTS_TABLE . ' WHERE post_id > ' . $post_counter; - $result = $db->sql_query($sql); - $remain_count = (int) $db->sql_fetchfield('remain_count'); - $db->sql_freeresult($result); + $result = $this->db->sql_query($sql); + $remain_count = (int) $this->db->sql_fetchfield('remain_count'); + $this->db->sql_freeresult($result); $total_count = $done_count + $remain_count; $percent = ($done_count / $total_count) * 100;