From dcc5ca53778184f0719b9ac0c221688ad03bd57e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 15 Aug 2011 20:00:47 -0400 Subject: [feature/extension-manager] Make search backends loadable from extensions Search backends are now required to be autoloadable. The database updater to 3.1 tries to guess the class name as phpbb_search_ which works for the default backends we ship. PHPBB3-10323 --- phpBB/includes/acp/acp_search.php | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'phpBB/includes/acp/acp_search.php') diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index a3061ae2da..a6377f6b49 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -77,7 +77,8 @@ class acp_search continue; } - $name = ucfirst(strtolower(str_replace('_', ' ', $type))); + $name = $search->get_name(); + $selected = ($config['search_type'] == $type) ? ' selected="selected"' : ''; $search_options .= ''; @@ -275,7 +276,7 @@ class acp_search { trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING); } - $name = ucfirst(strtolower(str_replace('_', ' ', $this->state[0]))); + $name = $this->search->get_name(); $action = &$this->state[1]; @@ -454,7 +455,7 @@ class acp_search continue; } - $name = ucfirst(strtolower(str_replace('_', ' ', $type))); + $name = $search->get_name(); $data = array(); if (method_exists($search, 'index_stats')) @@ -553,8 +554,19 @@ class acp_search function get_search_types() { - global $phpbb_root_path, $phpEx; + global $phpbb_root_path, $phpEx, $phpbb_extension_manager; + + $finder = $phpbb_extension_manager->get_finder(); + + return $finder + ->suffix('_backend') + ->directory('/search') + ->default_path('includes/search/') + ->default_suffix('') + ->default_directory('') + ->get_classes(); +/* $search_types = array(); $dp = @opendir($phpbb_root_path . 'includes/search'); @@ -574,6 +586,7 @@ class acp_search } return $search_types; +*/ } function get_max_post_id() @@ -610,14 +623,6 @@ class acp_search { global $phpbb_root_path, $phpEx, $user; - if (!preg_match('#^\w+$#', $type) || !file_exists("{$phpbb_root_path}includes/search/$type.$phpEx")) - { - $error = $user->lang['NO_SUCH_SEARCH_MODULE']; - return $error; - } - - include_once("{$phpbb_root_path}includes/search/$type.$phpEx"); - if (!class_exists($type)) { $error = $user->lang['NO_SUCH_SEARCH_MODULE']; -- cgit v1.2.1 From 989bd9cde7314024999f5b92fc2ff4572b9ac937 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 15 Aug 2011 20:55:29 -0400 Subject: [feature/extension-manager] Skip phpbb_search_base by checking for get_name() PHPBB3-10323 --- phpBB/includes/acp/acp_search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_search.php') diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index a6377f6b49..0c34d02ac7 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -623,7 +623,7 @@ class acp_search { global $phpbb_root_path, $phpEx, $user; - if (!class_exists($type)) + if (!class_exists($type) || !method_exists($type, 'get_name')) { $error = $user->lang['NO_SUCH_SEARCH_MODULE']; return $error; -- cgit v1.2.1 From 0d296785b2364f894f34171d054341cc4979223f Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 16:42:53 +0100 Subject: [feature/extension-manager] Rename default methods to core methods on finder. There are now extension_ and core_ methods for all finder settings as well as a generic method which overwrites both. PHPBB3-10323 --- phpBB/includes/acp/acp_search.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'phpBB/includes/acp/acp_search.php') diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index 0c34d02ac7..049a70647f 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -559,11 +559,9 @@ class acp_search $finder = $phpbb_extension_manager->get_finder(); return $finder - ->suffix('_backend') - ->directory('/search') - ->default_path('includes/search/') - ->default_suffix('') - ->default_directory('') + ->extension_suffix('_backend') + ->extension_directory('/search') + ->core_path('includes/search/') ->get_classes(); /* -- cgit v1.2.1 From 5f48f55cca5d0a6a2c51cdcc8a60b475354f50b1 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 18 Nov 2011 19:57:20 +0100 Subject: [feature/extension-manager] Removing now unused acp_search code PHPBB3-10323 --- phpBB/includes/acp/acp_search.php | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'phpBB/includes/acp/acp_search.php') diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index 049a70647f..ab604cd7cd 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -563,28 +563,6 @@ class acp_search ->extension_directory('/search') ->core_path('includes/search/') ->get_classes(); - -/* - $search_types = array(); - - $dp = @opendir($phpbb_root_path . 'includes/search'); - - if ($dp) - { - while (($file = readdir($dp)) !== false) - { - if ((preg_match('#\.' . $phpEx . '$#', $file)) && ($file != "search.$phpEx")) - { - $search_types[] = preg_replace('#^(.*?)\.' . $phpEx . '$#', '\1', $file); - } - } - closedir($dp); - - sort($search_types); - } - - return $search_types; -*/ } function get_max_post_id() -- cgit v1.2.1 From 179662e949967090724c5e14ea4d4d399886a38a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 20 Sep 2011 01:33:33 +0200 Subject: [ticket/10345] Use the plural function in some more places. I added two function avatar_explanation_string() and avatar_error_wrong_size() for easier handling of the "pixels"-languages, as they are used quite often. PHPBB3-10345 --- phpBB/includes/acp/acp_search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_search.php') diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index ab604cd7cd..2de76187d5 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -338,7 +338,7 @@ class acp_search $totaltime = $mtime[0] + $mtime[1] - $starttime; $rows_per_second = $row_count / $totaltime; meta_refresh(1, append_sid($this->u_action . '&action=delete&skip_rows=' . $post_counter)); - trigger_error(sprintf($user->lang['SEARCH_INDEX_DELETE_REDIRECT'], $post_counter, $row_count, $rows_per_second)); + trigger_error($user->lang('SEARCH_INDEX_DELETE_REDIRECT', (int) $row_count, $post_counter, $rows_per_second)); } } @@ -428,7 +428,7 @@ class acp_search $totaltime = $mtime[0] + $mtime[1] - $starttime; $rows_per_second = $row_count / $totaltime; meta_refresh(1, append_sid($this->u_action . '&action=create&skip_rows=' . $post_counter)); - trigger_error(sprintf($user->lang['SEARCH_INDEX_CREATE_REDIRECT'], $post_counter, $row_count, $rows_per_second)); + trigger_error($user->lang('SEARCH_INDEX_CREATE_REDIRECT', (int) $row_count, $post_counter) . $user->lang('SEARCH_INDEX_CREATE_REDIRECT_RATE', $rows_per_second)); } } -- cgit v1.2.1 From 7a04c9048c110f0bd21ea3e9e869e17b408d640e Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 31 Dec 2011 13:32:52 +0000 Subject: [ticket/9916] Updating header license and removing Version $Id$ PHPBB3-9916 --- phpBB/includes/acp/acp_search.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_search.php') diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index 2de76187d5..54a3e7aaa1 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -2,9 +2,8 @@ /** * * @package acp -* @version $Id$ * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ -- cgit v1.2.1 From 0e9174d168a82bde16ec59d615e19b85a50cebcf Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Sun, 1 Jul 2012 05:06:51 +0530 Subject: [feature/sphinx-fulltext-search] use keywords_search instead of get_name using keyword_search method instead of get_name to distinguish between the search backend classes present in includes/search and other helper classes. PHPBB3-10946 --- phpBB/includes/acp/acp_search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/acp/acp_search.php') diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index 54a3e7aaa1..82d9b021fe 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -598,7 +598,7 @@ class acp_search { global $phpbb_root_path, $phpEx, $user; - if (!class_exists($type) || !method_exists($type, 'get_name')) + if (!class_exists($type) || !method_exists($type, 'keyword_search')) { $error = $user->lang['NO_SUCH_SEARCH_MODULE']; return $error; -- cgit v1.2.1 From 2e218776bbac82841e1ced583c83890be5080af0 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Tue, 24 Jul 2012 12:10:22 +0530 Subject: [ticket/11011] passing global variables Pass global variables to class constructor when making a new object. PHPBB3-11011 --- phpBB/includes/acp/acp_search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_search.php') diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index 82d9b021fe..5ae9f363f0 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -596,7 +596,7 @@ class acp_search */ function init_search($type, &$search, &$error) { - global $phpbb_root_path, $phpEx, $user; + global $phpbb_root_path, $phpEx, $user, $config, $db; if (!class_exists($type) || !method_exists($type, 'keyword_search')) { @@ -605,7 +605,7 @@ class acp_search } $error = false; - $search = new $type($error); + $search = new $type($error, $phpbb_root_path, $phpEx, $config, $db, $user); return $error; } -- cgit v1.2.1 From 794d6ec443bd16ad2f7776d1ba2abcf2ce1c5553 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Wed, 8 Aug 2012 11:07:47 +0530 Subject: [ticket/11011] pass $auth to search backend constructor $auth global var is passed to search backend constructor, as it is used by sphinx backend. PHPBB3-11011 --- phpBB/includes/acp/acp_search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/acp/acp_search.php') diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index 5ae9f363f0..6618e2c3f9 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -596,7 +596,7 @@ class acp_search */ function init_search($type, &$search, &$error) { - global $phpbb_root_path, $phpEx, $user, $config, $db; + global $phpbb_root_path, $phpEx, $user, $auth, $config, $db; if (!class_exists($type) || !method_exists($type, 'keyword_search')) { @@ -605,7 +605,7 @@ class acp_search } $error = false; - $search = new $type($error, $phpbb_root_path, $phpEx, $config, $db, $user); + $search = new $type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user); return $error; } -- cgit v1.2.1