From 2da33f0318321af237ebf7925a5988f0b7010d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dark=E2=9D=B6?= <25451052+Dark1z@users.noreply.github.com> Date: Wed, 27 Apr 2022 21:28:38 +0530 Subject: [PATCH] RSI v1.1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update `acp_base.php` Signed-off-by: Dark❶ <25451052+Dark1z@users.noreply.github.com> --- composer.json | 2 +- controller/acp_base.php | 11 ++++++++--- controller/acp_cron.php | 2 +- cron/auto_reduce_sync.php | 2 +- language/en/info_acp_rsi.php | 1 + 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 17b2314..dd3947b 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "type": "phpbb-extension", "description": "Reduce Search Index [RSI]", "homepage": "https://phpbb.com/customise/db/extension/reduce_search_index", - "version": "1.1.0", + "version": "1.1.1", "time": "2022-01-23", "keywords": [ "phpbb", diff --git a/controller/acp_base.php b/controller/acp_base.php index da0e9b6..8521703 100644 --- a/controller/acp_base.php +++ b/controller/acp_base.php @@ -142,16 +142,21 @@ protected function check_form_on_submit() * Success Form On Submit. * Used to Log & Trigger Success Err0r. * + * @param string $lang_key Lang Key + * @param string $lang_str Lang String + * * @return void * @access protected */ - protected function success_form_on_submit() + protected function success_form_on_submit($lang_key = 'ACP_RSI_LOG_SET_SAV', $lang_str = null) { + $lang_str = !isset($lang_str) ? $this->language->lang('ACP_RSI_' . strtoupper($this->mode)) : $lang_str; + // Add option settings change action to the admin log - $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'ACP_RSI_LOG_SET_SAV', time(), [$this->language->lang('ACP_RSI_' . strtoupper($this->mode))]); + $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, $lang_key, time(), [$lang_str]); // Option settings have been updated and logged // Confirm this to the user and provide link back to previous page - trigger_error($this->language->lang('ACP_RSI_LOG_SET_SAV', $this->language->lang('ACP_RSI_' . strtoupper($this->mode))) . adm_back_link($this->u_action), E_USER_NOTICE); + trigger_error($this->language->lang($lang_key, $lang_str) . adm_back_link($this->u_action), E_USER_NOTICE); } } diff --git a/controller/acp_cron.php b/controller/acp_cron.php index ffec669..f311116 100644 --- a/controller/acp_cron.php +++ b/controller/acp_cron.php @@ -80,7 +80,7 @@ public function handle() $cron_task = $this->cron_manager->find_task('dark1.reducesearchindex.cron.auto_reduce_sync'); $cron_task->run(); - $this->success_form_on_submit(); + $this->success_form_on_submit('ACP_RSI_LOG_CRON', ''); } // Set output variables for display in the template diff --git a/cron/auto_reduce_sync.php b/cron/auto_reduce_sync.php index 00c68f6..0478ebe 100644 --- a/cron/auto_reduce_sync.php +++ b/cron/auto_reduce_sync.php @@ -281,7 +281,7 @@ private function reduce_search_index($post_ids, $poster_ids, $forum_ids) if ($name == 'fulltext_native' && class_exists($search) && count($post_ids) > 0) { /** @var fulltext_native */ - $search = new $search(false, $this->phpbb_root_path, $this->php_ext, $this->auth, $this->config, $this->db, $this->user, $this->phpbb_dispatcher); + $search = new $search($error = false, $this->phpbb_root_path, $this->php_ext, $this->auth, $this->config, $this->db, $this->user, $this->phpbb_dispatcher); $post_ids = array_chunk($post_ids, 50, true); foreach ($post_ids as $post_ids_chunk) diff --git a/language/en/info_acp_rsi.php b/language/en/info_acp_rsi.php index f98dd52..58bd0c5 100644 --- a/language/en/info_acp_rsi.php +++ b/language/en/info_acp_rsi.php @@ -45,6 +45,7 @@ // phpBB Log 'ACP_RSI_LOG_SET_SAV' => 'Reduce Search Index [RSI]
» %s saved successfully!', + 'ACP_RSI_LOG_CRON' => 'Reduce Search Index [RSI]
» Cron ran successfully!%s', 'RSI_AUTO_LOG' => 'Reduce Search Index [RSI]
» Auto Reduce Updater completed.
» Search Restricted for Last “%1$s” Day(s) from “%2$s”', // ACP Modes