diff --git a/phpBB/adm/style/acp_search_index.html b/phpBB/adm/style/acp_search_index.html index 8ce882fa89..6a9b0c22db 100644 --- a/phpBB/adm/style/acp_search_index.html +++ b/phpBB/adm/style/acp_search_index.html @@ -1,4 +1,4 @@ - +{% include 'overall_header.html' %} @@ -11,36 +11,36 @@ { close_waitscreen = 0; // no scrollbars - popup('{UA_PROGRESS_BAR}&type=' + progress_type, 400, 240, '_index'); + popup('{{ UA_PROGRESS_BAR }}&type=' + progress_type, 400, 240, '_index'); } // ]]> -

{L_ACP_SEARCH_INDEX}

+

{{ lang('ACP_SEARCH_INDEX') }}

-

{L_ACP_SEARCH_INDEX_EXPLAIN}

+

{{ lang('ACP_SEARCH_INDEX_EXPLAIN') }}

- +{% for backend in loops.backend %} {% if backend.S_STATS is not empty %} -
+
- {backend.S_HIDDEN_FIELDS} + {{ backend.S_HIDDEN_FIELDS }} - {L_INDEX_STATS}{L_COLON} {backend.L_NAME} ({L_ACTIVE}) + {{ lang('INDEX_STATS') }}{{ lang('COLON') }} {{ backend.NAME }} {% if backend.S_ACTIVE %}({{ lang('ACTIVE') }}) {% endif %} - + - - - - + + + + @@ -48,7 +48,7 @@ {% for key, value in stat %} {% if value is not empty %} - + {% else %} @@ -63,18 +63,18 @@ {% endif %}

- + {% if backend.S_INDEXED %} - - + + {% else %} - - + + {% endif %}

- {S_FORM_TOKEN} + {{ S_FORM_TOKEN }} - +{% endfor %} - +{% include 'overall_footer.html' %} diff --git a/phpBB/adm/style/acp_search_index_inprogress.html b/phpBB/adm/style/acp_search_index_inprogress.html index fb84618c55..3d9111192a 100644 --- a/phpBB/adm/style/acp_search_index_inprogress.html +++ b/phpBB/adm/style/acp_search_index_inprogress.html @@ -1,4 +1,4 @@ - +{% include 'overall_header.html' %} @@ -11,24 +11,24 @@ { close_waitscreen = 0; // no scrollbars - popup('{UA_PROGRESS_BAR}&type=' + progress_type, 400, 240, '_index'); + popup('{{ UA_PROGRESS_BAR }}&type=' + progress_type, 400, 240, '_index'); } // ]]> -

{L_CONTINUE}

+

{{ lang('CONTINUE') }}

-

{L_CONTINUE_EXPLAIN}

+

{{ lang('CONTINUE_EXPLAIN') }}

- +
- {L_ACP_SUBMIT_CHANGES} + {{ lang('ACP_SUBMIT_CHANGES') }}

-   - +   +

- {S_FORM_TOKEN} + {{ S_FORM_TOKEN }}
- +{% include 'overall_footer.html' %} diff --git a/phpBB/adm/style/acp_search_settings.html b/phpBB/adm/style/acp_search_settings.html index b468fd17ed..66f9838173 100644 --- a/phpBB/adm/style/acp_search_settings.html +++ b/phpBB/adm/style/acp_search_settings.html @@ -1,39 +1,39 @@ - +{% include 'overall_header.html' %} -

{L_ACP_SEARCH_SETTINGS}

+

{{ lang('ACP_SEARCH_SETTINGS') }}

-

{L_ACP_SEARCH_SETTINGS_EXPLAIN}

+

{{ lang('ACP_SEARCH_SETTINGS_EXPLAIN') }}

- +
- {L_GENERAL_SEARCH_SETTINGS} + {{ lang('GENERAL_SEARCH_SETTINGS') }}
-

{L_YES_SEARCH_EXPLAIN}
-
-
+

{{ lang('YES_SEARCH_EXPLAIN') }}
+
+
-

{L_SEARCH_INTERVAL_EXPLAIN}
-
{L_SECONDS}
+

{{ lang('SEARCH_INTERVAL_EXPLAIN') }}
+
{{ lang('SECONDS') }}
-

{L_SEARCH_GUEST_INTERVAL_EXPLAIN}
-
{L_SECONDS}
+

{{ lang('SEARCH_GUEST_INTERVAL_EXPLAIN') }}
+
{{ lang('SECONDS') }}
-

{L_LIMIT_SEARCH_LOAD_EXPLAIN}
-
+

{{ lang('LIMIT_SEARCH_LOAD_EXPLAIN') }}
+
-

{L_MIN_SEARCH_AUTHOR_CHARS_EXPLAIN}
-
+

{{ lang('MIN_SEARCH_AUTHOR_CHARS_EXPLAIN') }}
+
-

{L_MAX_NUM_SEARCH_KEYWORDS_EXPLAIN}
-
+

{{ lang('MAX_NUM_SEARCH_KEYWORDS_EXPLAIN') }}
+
@@ -43,36 +43,36 @@
-

{L_SEARCH_STORE_RESULTS_EXPLAIN}
-
{L_SECONDS}
+

{{ lang('SEARCH_STORE_RESULTS_EXPLAIN') }}
+
{{ lang('SECONDS') }}
- {L_SEARCH_TYPE} + {{ lang('SEARCH_TYPE') }}
-

{L_SEARCH_TYPE_EXPLAIN}
-
+

{{ lang('SEARCH_TYPE_EXPLAIN') }}
+
- +{% for backend in loops.backend %} -
- {backend.NAME} - {backend.SETTINGS} +
+ {{ backend.NAME }} + {{ backend.SETTINGS }}
- +{% endfor %}
- {L_ACP_SUBMIT_CHANGES} + {{ lang('ACP_SUBMIT_CHANGES') }}

-   - +   +

- {S_FORM_TOKEN} + {{ S_FORM_TOKEN }}
- +{% include 'overall_footer.html' %} diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index a5ebd46f65..e8a2e0971a 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -277,6 +277,8 @@ class acp_search } /** + * Execute action + * * @param string $id * @param string $mode * @throws Exception @@ -337,8 +339,8 @@ class acp_search foreach ($this->search_backend_collection as $search) { $this->template->assign_block_vars('backend', [ - 'L_NAME' => $search->get_name(), - 'NAME' => $search->get_type(), + 'NAME' => $search->get_name(), + 'TYPE' => $search->get_type(), 'S_ACTIVE' => $search->get_type() === $this->config['search_type'], 'S_HIDDEN_FIELDS' => build_hidden_fields(['search_type' => $search->get_type()]), @@ -407,67 +409,39 @@ class acp_search $action = $state[self::STATE_ACTION]; $post_counter = &$state[self::STATE_POST_COUNTER]; - switch ($action) + // Execute create/delete + $search = $this->search_backend_factory->get($type); + + try { - case 'delete': - $search = $this->search_backend_factory->get($type); + $status = ($action == 'create') ? $search->create_index($post_counter) : $search->delete_index($post_counter); + if ($status) // Status is not null, so action is in progress.... + { + $this->save_state($state); // update $post_counter in $state in the database - try - { - if ($status = $search->delete_index($post_counter)) // Status is not null, so deleting is in progress.... - { - $this->save_state($state); // update $post_counter in $state in the database + $u_action = append_sid($this->phpbb_admin_path . "index." . $this->php_ex, "i=$id&mode=$mode&action=$action&hash=" . generate_link_hash('acp_search'), false); + meta_refresh(1, $u_action); - $u_action = append_sid($this->phpbb_admin_path . "index." . $this->php_ex, "i=$id&mode=$mode&action=delete&hash=" . generate_link_hash('acp_search'), false); - meta_refresh(1, $u_action); - trigger_error($this->language->lang('SEARCH_INDEX_DELETE_REDIRECT', (int) $status['row_count'], $status['post_counter']) . $this->language->lang('SEARCH_INDEX_DELETE_REDIRECT_RATE', $status['rows_per_second'])); - } - } - catch (Exception $e) - { - $this->save_state([]); // Unexpected error, cancel action - trigger_error($e->getMessage() . adm_back_link($this->u_action) . $this->close_popup_js(), E_USER_WARNING); - } - - $search->tidy(); - - $this->save_state([]); // finished operation, cancel action - - $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_SEARCH_INDEX_REMOVED', false, [$search->get_name()]); - trigger_error($this->language->lang('SEARCH_INDEX_REMOVED') . adm_back_link($this->u_action) . $this->close_popup_js()); - break; - - case 'create': - $search = $this->search_backend_factory->get($type); - - try - { - $search = $this->search_backend_factory->get($type); - - if ($status = $search->create_index($post_counter)) // Status is not null, so indexing is in progress.... - { - $this->save_state($state); // update $post_counter in $state in the database - - $u_action = append_sid($this->phpbb_admin_path . "index." . $this->php_ex, "i=$id&mode=$mode&action=create&hash=" . generate_link_hash('acp_search'), false); - meta_refresh(1, $u_action); - trigger_error($this->language->lang('SEARCH_INDEX_CREATE_REDIRECT', (int) $status['row_count'], $status['post_counter']) . $this->language->lang('SEARCH_INDEX_CREATE_REDIRECT_RATE', $status['rows_per_second'])); - } - } - catch (Exception $e) - { - // Error executing create_index - $this->save_state([]); - trigger_error($e->getMessage() . adm_back_link($this->u_action) . $this->close_popup_js(), E_USER_WARNING); - } - - $search->tidy(); - - $this->save_state([]); // finished operation, cancel action - - $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_SEARCH_INDEX_CREATED', false, [$search->get_name()]); - trigger_error($this->language->lang('SEARCH_INDEX_CREATED') . adm_back_link($this->u_action) . $this->close_popup_js()); - break; + $message_redirect = $this->language->lang(($action == 'create') ? 'SEARCH_INDEX_CREATE_REDIRECT' : 'SEARCH_INDEX_DELETE_REDIRECT', (int) $status['row_count'], $status['post_counter']); + $message_rate = $this->language->lang(($action == 'create') ? 'SEARCH_INDEX_CREATE_REDIRECT_RATE' : 'SEARCH_INDEX_DELETE_REDIRECT_RATE', $status['rows_per_second']); + trigger_error($message_redirect . $message_rate); + } } + catch (Exception $e) + { + $this->save_state([]); // Unexpected error, cancel action + trigger_error($e->getMessage() . adm_back_link($this->u_action) . $this->close_popup_js(), E_USER_WARNING); + } + + $search->tidy(); + + $this->save_state([]); // finished operation, cancel action + + $log_operation = ($action == 'create') ? 'LOG_SEARCH_INDEX_CREATED' : 'LOG_SEARCH_INDEX_REMOVED'; + $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, $log_operation, false, [$search->get_name()]); + + $message = $this->language->lang(($action == 'create') ? 'SEARCH_INDEX_CREATED' : 'SEARCH_INDEX_REMOVED'); + trigger_error($message . adm_back_link($this->u_action) . $this->close_popup_js()); } /**
{backend.L_NAME} ({L_ACTIVE}) {{ backend.NAME }} {% if backend.S_ACTIVE %}({{ lang('ACTIVE') }}) {% endif %}
{L_STATISTIC}{L_VALUE}{L_STATISTIC}{L_VALUE}{{ lang('STATISTIC') }}{{ lang('VALUE') }}{{ lang('STATISTIC') }}{{ lang('VALUE') }}
{{ key }}{L_COLON}{{ key }}{{ lang('COLON') }} {{ value }}