aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/search
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/search')
-rw-r--r--phpBB/includes/search/base.php (renamed from phpBB/includes/search/search.php)9
-rw-r--r--phpBB/includes/search/fulltext_mysql.php33
-rw-r--r--phpBB/includes/search/fulltext_native.php27
3 files changed, 32 insertions, 37 deletions
diff --git a/phpBB/includes/search/search.php b/phpBB/includes/search/base.php
index df7c8a0892..b364dead9a 100644
--- a/phpBB/includes/search/search.php
+++ b/phpBB/includes/search/base.php
@@ -2,9 +2,8 @@
/**
*
* @package search
-* @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
*
*/
@@ -24,12 +23,12 @@ define('SEARCH_RESULT_IN_CACHE', 1);
define('SEARCH_RESULT_INCOMPLETE', 2);
/**
-* search_backend
+* phpbb_search_base
* optional base class for search plugins providing simple caching based on ACM
* and functions to retrieve ignore_words and synonyms
* @package search
*/
-class search_backend
+class phpbb_search_base
{
var $ignore_words = array();
var $match_synonym = array();
@@ -316,5 +315,3 @@ class search_backend
$db->sql_query($sql);
}
}
-
-?> \ No newline at end of file
diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php
index 779ec1d216..7c94038cc9 100644
--- a/phpBB/includes/search/fulltext_mysql.php
+++ b/phpBB/includes/search/fulltext_mysql.php
@@ -2,9 +2,8 @@
/**
*
* @package search
-* @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
*
*/
@@ -17,16 +16,11 @@ if (!defined('IN_PHPBB'))
}
/**
-* @ignore
-*/
-include_once($phpbb_root_path . 'includes/search/search.' . $phpEx);
-
-/**
* fulltext_mysql
* Fulltext search for MySQL
* @package search
*/
-class fulltext_mysql extends search_backend
+class phpbb_search_fulltext_mysql extends phpbb_search_base
{
var $stats = array();
var $word_length = array();
@@ -36,19 +30,16 @@ class fulltext_mysql extends search_backend
var $pcre_properties = false;
var $mbstring_regex = false;
- function fulltext_mysql(&$error)
+ public function __construct(&$error)
{
global $config;
$this->word_length = array('min' => $config['fulltext_mysql_min_word_len'], 'max' => $config['fulltext_mysql_max_word_len']);
- if (version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>=')))
+ // PHP may not be linked with the bundled PCRE lib and instead with an older version
+ if (phpbb_pcre_utf8_support())
{
- // While this is the proper range of PHP versions, PHP may not be linked with the bundled PCRE lib and instead with an older version
- if (@preg_match('/\p{L}/u', 'a') !== false)
- {
- $this->pcre_properties = true;
- }
+ $this->pcre_properties = true;
}
if (function_exists('mb_ereg'))
@@ -61,6 +52,16 @@ class fulltext_mysql extends search_backend
}
/**
+ * Returns the name of this search backend to be displayed to administrators
+ *
+ * @return string Name
+ */
+ public function get_name()
+ {
+ return 'MySQL Fulltext';
+ }
+
+ /**
* Checks for correct MySQL version and stores min/max word length in the config
*/
function init()
@@ -932,5 +933,3 @@ class fulltext_mysql extends search_backend
);
}
}
-
-?> \ No newline at end of file
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php
index dc961f3c8a..3e029c86d0 100644
--- a/phpBB/includes/search/fulltext_native.php
+++ b/phpBB/includes/search/fulltext_native.php
@@ -2,9 +2,8 @@
/**
*
* @package search
-* @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
*
*/
@@ -17,16 +16,11 @@ if (!defined('IN_PHPBB'))
}
/**
-* @ignore
-*/
-include_once($phpbb_root_path . 'includes/search/search.' . $phpEx);
-
-/**
* fulltext_native
* phpBB's own db driven fulltext search, version 2
* @package search
*/
-class fulltext_native extends search_backend
+class phpbb_search_fulltext_native extends phpbb_search_base
{
var $stats = array();
var $word_length = array();
@@ -41,10 +35,8 @@ class fulltext_native extends search_backend
* Initialises the fulltext_native search backend with min/max word length and makes sure the UTF-8 normalizer is loaded.
*
* @param boolean|string &$error is passed by reference and should either be set to false on success or an error message on failure.
- *
- * @access public
*/
- function fulltext_native(&$error)
+ public function __construct(&$error)
{
global $phpbb_root_path, $phpEx, $config;
@@ -58,11 +50,20 @@ class fulltext_native extends search_backend
include($phpbb_root_path . 'includes/utf/utf_normalizer.' . $phpEx);
}
-
$error = false;
}
/**
+ * Returns the name of this search backend to be displayed to administrators
+ *
+ * @return string Name
+ */
+ public function get_name()
+ {
+ return 'phpBB Native Fulltext';
+ }
+
+ /**
* This function fills $this->search_query with the cleaned user search query.
*
* If $terms is 'any' then the words will be extracted from the search query
@@ -1745,5 +1746,3 @@ class fulltext_native extends search_backend
);
}
}
-
-?> \ No newline at end of file