diff options
| author | Nils Adermann <naderman@naderman.de> | 2011-08-15 20:00:47 -0400 |
|---|---|---|
| committer | Nils Adermann <naderman@naderman.de> | 2011-09-29 15:42:40 +0200 |
| commit | dcc5ca53778184f0719b9ac0c221688ad03bd57e (patch) | |
| tree | ab61c555eecd1f38d92bfd103d23dbec3b940d87 /phpBB/includes/acp/acp_search.php | |
| parent | fb943d4d6b39cea9825aab78e397eefe26cf7bdf (diff) | |
| download | forums-dcc5ca53778184f0719b9ac0c221688ad03bd57e.tar forums-dcc5ca53778184f0719b9ac0c221688ad03bd57e.tar.gz forums-dcc5ca53778184f0719b9ac0c221688ad03bd57e.tar.bz2 forums-dcc5ca53778184f0719b9ac0c221688ad03bd57e.tar.xz forums-dcc5ca53778184f0719b9ac0c221688ad03bd57e.zip | |
[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_<oldname> which works for
the default backends we ship.
PHPBB3-10323
Diffstat (limited to 'phpBB/includes/acp/acp_search.php')
| -rw-r--r-- | phpBB/includes/acp/acp_search.php | 29 |
1 files changed, 17 insertions, 12 deletions
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 .= '<option value="' . $type . '"' . $selected . '>' . $name . '</option>'; @@ -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']; |
