mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/16913] Move code in index action and remove not needed global
PHPBB3-16913
This commit is contained in:
parent
94ed73b812
commit
df476f733f
1 changed files with 13 additions and 15 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue