From 9f7bc931259522fe7ae1ea9d6b5f4b17b60c97ad Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 18 Mar 2006 14:30:47 +0000 Subject: [PATCH] - Lesson learned: If you rename something rename it in all places and not just in a few :) (min_search_chars/max_search_chars/load_search_upd now prefixed with fulltext_phpbb) - search_indexing_state should not be dynamic - a topic link should link to a topic ;-) git-svn-id: file:///svn/phpbb/trunk@5652 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_search.php | 2 +- phpBB/includes/mcp/mcp_reports.php | 2 +- phpBB/includes/search/fulltext_mysql.php | 5 +++++ phpBB/includes/search/fulltext_phpbb.php | 13 +++++++++---- phpBB/install/schemas/schema_data.sql | 2 +- phpBB/search.php | 2 +- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index cd7c9a0b3e..3b6f935b9e 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -467,7 +467,7 @@ class acp_search ksort($this->state); - set_config('search_indexing_state', implode(',', $this->state), true); + set_config('search_indexing_state', implode(',', $this->state)); } /** diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index a35c3980d5..a3f4a26026 100755 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -281,7 +281,7 @@ class mcp_reports $template->assign_block_vars('postrow', array( 'U_VIEWFORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&f=" . $row['forum_id'], - 'U_VIEWTOPIC' => "{$phpbb_root_path}viewtopic.$phpEx$SID&f=" . $row['forum_id'] . '&p=' . $row['post_id'] . '#p' . $row['post_id'], + 'U_VIEWTOPIC' => "{$phpbb_root_path}viewtopic.$phpEx$SID&f=" . $row['forum_id'] . '&t=' . $row['topic_id'], 'U_VIEW_DETAILS' => "{$phpbb_root_path}mcp.$phpEx$SID&i=reports&start=$start&mode=report_details&f={$forum_id}&p={$row['post_id']}", 'U_VIEW_POSTER_PROFILE' => ($row['poster_id'] != ANONYMOUS) ? "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u={$row['poster_id']}" : '', 'U_VIEW_REPORTER_PROFILE' => ($row['reporter_id'] != ANONYMOUS) ? "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u={$row['reporter_id']}" : '', diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index 74ffa08a81..28f4064aef 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -21,9 +21,14 @@ include_once($phpbb_root_path . 'includes/search/search.' . $phpEx); class fulltext_mysql extends search_backend { var $stats; + var $word_length; function fulltext_mysql(&$error) { + global $config; + + $this->word_length = array('min' => $config['fulltext_mysql_min_word_len'], 'max' => $config['fulltext_mysql_max_word_len']); + $error = false; } diff --git a/phpBB/includes/search/fulltext_phpbb.php b/phpBB/includes/search/fulltext_phpbb.php index 341e9abb87..a1baecc2d2 100644 --- a/phpBB/includes/search/fulltext_phpbb.php +++ b/phpBB/includes/search/fulltext_phpbb.php @@ -21,9 +21,14 @@ include_once($phpbb_root_path . 'includes/search/search.' . $phpEx); class fulltext_phpbb extends search_backend { var $stats; + var $word_length; function fulltext_phpbb(&$error) { + global $config; + + $this->word_length = array('min' => $config['fulltext_phpbb_min_search_chars'], 'max' => $config['fulltext_phpbb_max_search_chars']); + $error = false; } @@ -89,7 +94,7 @@ class fulltext_phpbb extends search_backend // check word length $clean_len = strlen(str_replace('*', '', $word)); - if (($clean_len < $config['min_search_chars']) || ($clean_len > $config['max_search_chars'])) + if (($clean_len < $config['fulltext_phpbb_min_search_chars']) || ($clean_len > $config['fulltext_phpbb_max_search_chars'])) { if ($prefixed) { @@ -194,7 +199,7 @@ class fulltext_phpbb extends search_backend for ($i = 0, $n = sizeof($text); $i < $n; $i++) { $text[$i] = trim($text[$i]); - if (strlen($text[$i]) < $config['min_search_chars'] || strlen($text[$i]) > $config['max_search_chars']) + if (strlen($text[$i]) < $config['fulltext_phpbb_min_search_chars'] || strlen($text[$i]) > $config['fulltext_phpbb_max_search_chars']) { unset($text[$i]); } @@ -712,7 +717,7 @@ class fulltext_phpbb extends search_backend // Is the fulltext indexer disabled? If yes then we need not // carry on ... it's okay ... I know when I'm not wanted boo hoo - if (!$config['load_search_upd']) + if (!$config['fulltext_phpbb_load_search_upd']) { return; } @@ -882,7 +887,7 @@ class fulltext_phpbb extends search_backend // Is the fulltext indexer disabled? If yes then we need not // carry on ... it's okay ... I know when I'm not wanted boo hoo - if (!$config['load_search_upd']) + if (!$config['fulltext_phpbb_load_search_upd']) { return; } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 8ba14ffe6b..410d197d4e 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -166,6 +166,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation INSERT INTO phpbb_config (config_name, config_value) VALUES ('save_passwd', '3'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_block_size', '250'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_gc', '7200'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_indexing_state', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_interval', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_type', 'fulltext_phpbb'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_store_results', '1800'); @@ -206,7 +207,6 @@ INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('num_to INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('num_users', '1', 1); INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('record_online_date', '0', 1); INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('record_online_users', '0', 1); -INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('search_indexing_state', '', 1); INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('search_last_gc', '0', 1); INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('session_last_gc', '0', 1); INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('upload_dir_size', '0', 1); diff --git a/phpBB/search.php b/phpBB/search.php index afd35c50f8..13d64a7230 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -223,7 +223,7 @@ if ($keywords || $author || $search_id) $search->split_keywords($keywords, $search_terms); if (!sizeof($search->split_words) && !sizeof($author_id_ary) && !$search_id) { - trigger_error(sprintf($user->lang['NO_KEYWORDS'], $config['min_search_chars'], $config['max_search_chars'])); + trigger_error(sprintf($user->lang['NO_KEYWORDS'], $search->word_length['min'], $search->word_length['max'])); } }