aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/search/fulltext_postgres.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/search/fulltext_postgres.php')
-rw-r--r--phpBB/includes/search/fulltext_postgres.php320
1 files changed, 183 insertions, 137 deletions
diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php
index 84ce674564..08f64735b6 100644
--- a/phpBB/includes/search/fulltext_postgres.php
+++ b/phpBB/includes/search/fulltext_postgres.php
@@ -22,32 +22,98 @@ if (!defined('IN_PHPBB'))
*/
class phpbb_search_fulltext_postgres extends phpbb_search_base
{
- private $stats = array();
- private $split_words = array();
- private $tsearch_usable = false;
- private $version;
- private $tsearch_query;
- private $phrase_search = false;
- public $search_query;
- public $common_words = array();
- public $word_length = array();
+ /**
+ * Associative array holding index stats
+ * @var array
+ */
+ protected $stats = array();
+
+ /**
+ * Holds the words entered by user, obtained by splitting the entered query on whitespace
+ * @var array
+ */
+ protected $split_words = array();
+
+ /**
+ * True if PostgreSQL version supports tsearch
+ * @var boolean
+ */
+ protected $tsearch_usable = false;
+
+ /**
+ * Stores the PostgreSQL version
+ * @var string
+ */
+ protected $version;
+
+ /**
+ * Stores the tsearch query
+ * @var string
+ */
+ protected $tsearch_query;
+
+ /**
+ * True if phrase search is supported.
+ * PostgreSQL fulltext currently doesn't support it
+ * @var boolean
+ */
+ protected $phrase_search = false;
+
+ /**
+ * Config object
+ * @var phpbb_config
+ */
+ protected $config;
+
+ /**
+ * DBAL object
+ * @var dbal
+ */
+ protected $db;
+
+ /**
+ * User object
+ * @var phpbb_user
+ */
+ protected $user;
+
+ /**
+ * Contains tidied search query.
+ * Operators are prefixed in search query and common words excluded
+ * @var string
+ */
+ protected $search_query;
+
+ /**
+ * Contains common words.
+ * Common words are words with length less/more than min/max length
+ * @var array
+ */
+ protected $common_words = array();
+
+ /**
+ * Associative array stores the min and max word length to be searched
+ * @var array
+ */
+ protected $word_length = array();
/**
* Constructor
- * Creates a new phpbb_search_fulltext_postgres, which is used as a search backend.
+ * Creates a new phpbb_search_fulltext_postgres, which is used as a search backend
*
* @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false
*/
- public function __construct(&$error)
+ public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user)
{
- global $db, $config;
-
- $this->word_length = array('min' => $config['fulltext_postgres_min_word_len'], 'max' => $config['fulltext_postgres_max_word_len']);
+ $this->config = $config;
+ $this->db = $db;
+ $this->user = $user;
+ $this->word_length = array('min' => $this->config['fulltext_postgres_min_word_len'], 'max' => $this->config['fulltext_postgres_max_word_len']);
- if ($db->sql_layer == 'postgres')
+ if ($this->db->sql_layer == 'postgres')
{
- $pgsql_version = explode(',', substr($db->sql_server_info(), 10));
+ $pgsql_version = explode(',', substr($this->db->sql_server_info(), 10));
$this->version = trim($pgsql_version[0]);
if (version_compare($this->version, '8.3', '>='))
{
@@ -62,8 +128,6 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
* Returns the name of this search backend to be displayed to administrators
*
* @return string Name
- *
- * @access public
*/
public function get_name()
{
@@ -71,11 +135,39 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
}
/**
+ * Returns the search_query
+ *
+ * @return string search query
+ */
+ public function get_search_query()
+ {
+ return $this->search_query;
+ }
+
+ /**
+ * Returns the common_words array
+ *
+ * @return array common words that are ignored by search backend
+ */
+ public function get_common_words()
+ {
+ return $this->common_words;
+ }
+
+ /**
+ * Returns the word_length array
+ *
+ * @return array min and max word length for searching
+ */
+ public function get_word_length()
+ {
+ return $this->word_length;
+ }
+
+ /**
* Returns if phrase search is supported or not
*
* @return bool
- *
- * @access public
*/
public function supports_phrase_search()
{
@@ -86,21 +178,17 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
* Checks for correct PostgreSQL version and stores min/max word length in the config
*
* @return string|bool Language key of the error/incompatiblity occured
- *
- * @access public
*/
- function init()
+ public function init()
{
- global $db, $user;
-
- if ($db->sql_layer != 'postgres')
+ if ($this->db->sql_layer != 'postgres')
{
- return $user->lang['FULLTEXT_POSTGRES_INCOMPATIBLE_DATABASE'];
+ return $this->user->lang['FULLTEXT_POSTGRES_INCOMPATIBLE_DATABASE'];
}
if (!$this->tsearch_usable)
{
- return $user->lang['FULLTEXT_POSTGRES_TS_NOT_USABLE'];
+ return $this->user->lang['FULLTEXT_POSTGRES_TS_NOT_USABLE'];
}
return false;
@@ -113,13 +201,9 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
* @param string &$keywords Contains the keyword as entered by the user
* @param string $terms is either 'all' or 'any'
* @return bool false if no valid keywords were found and otherwise true
- *
- * @access public
*/
- function split_keywords(&$keywords, $terms)
+ public function split_keywords(&$keywords, $terms)
{
- global $config;
-
if ($terms == 'all')
{
$match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#\+#', '#-#', '#\|#');
@@ -143,7 +227,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
// check word length
$clean_len = utf8_strlen(str_replace('*', '', $clean_word));
- if (($clean_len < $config['fulltext_postgres_min_word_len']) || ($clean_len > $config['fulltext_postgres_max_word_len']))
+ if (($clean_len < $this->config['fulltext_postgres_min_word_len']) || ($clean_len > $this->config['fulltext_postgres_max_word_len']))
{
$this->common_words[] = $word;
unset($this->split_words[$i]);
@@ -208,13 +292,9 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
/**
* Turns text into an array of words
* @param string $text contains post text/subject
- *
- * @access public
*/
- function split_message($text)
+ public function split_message($text)
{
- global $config;
-
// Split words
$text = preg_replace('#([^\p{L}\p{N}\'*])#u', '$1$1', str_replace('\'\'', '\' \'', trim($text)));
$matches = array();
@@ -226,7 +306,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
for ($i = 0, $n = sizeof($text); $i < $n; $i++)
{
$text[$i] = trim($text[$i]);
- if (utf8_strlen($text[$i]) < $config['fulltext_postgres_min_word_len'] || utf8_strlen($text[$i]) > $config['fulltext_postgres_max_word_len'])
+ if (utf8_strlen($text[$i]) < $this->config['fulltext_postgres_min_word_len'] || utf8_strlen($text[$i]) > $this->config['fulltext_postgres_max_word_len'])
{
unset($text[$i]);
}
@@ -236,7 +316,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
}
/**
- * Performs a search on keywords depending on display specific params. You have to run split_keywords() first.
+ * Performs a search on keywords depending on display specific params. You have to run split_keywords() first
*
* @param string $type contains either posts or topics depending on what should be searched for
* @param string $fields contains either titleonly (topic titles should be searched), msgonly (only message bodies should be searched), firstpost (only subject and body of the first post should be searched) or all (all post bodies and subjects should be searched)
@@ -254,19 +334,21 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
* @param int $start indicates the first index of the page
* @param int $per_page number of ids each page is supposed to contain
* @return boolean|int total number of results
- *
- * @access public
*/
- function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, &$id_ary, $start, $per_page)
+ public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, &$id_ary, $start, $per_page)
{
- global $config, $db;
-
- // No keywords? No posts.
+ // No keywords? No posts
if (!$this->search_query)
{
return false;
}
+ // When search query contains queries like -foo
+ if (strpos($this->search_query, '+') === false)
+ {
+ return false;
+ }
+
// generate a search_key from all the options to identify the results
$search_key = md5(implode('#', array(
implode(', ', $this->split_words),
@@ -349,7 +431,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
}
else
{
- $m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
+ $m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
}
$sql_select = ($type == 'posts') ? 'p.post_id' : 'DISTINCT t.topic_id';
@@ -360,11 +442,11 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
if (sizeof($author_ary) && $author_name)
{
// first one matches post of registered users, second one guests and deleted users
- $sql_author = '(' . $db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')';
+ $sql_author = '(' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')';
}
else if (sizeof($author_ary))
{
- $sql_author = ' AND ' . $db->sql_in_set('p.poster_id', $author_ary);
+ $sql_author = ' AND ' . $this->db->sql_in_set('p.poster_id', $author_ary);
}
else
{
@@ -374,7 +456,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
$sql_where_options = $sql_sort_join;
$sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : '';
$sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : '';
- $sql_where_options .= (sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
+ $sql_where_options .= (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
$sql_where_options .= $m_approve_fid_sql;
$sql_where_options .= $sql_author;
$sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
@@ -383,7 +465,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
$tmp_sql_match = array();
foreach (explode(',', $sql_match) as $sql_match_column)
{
- $tmp_sql_match[] = "to_tsvector ('" . $db->sql_escape($config['fulltext_postgres_ts_name']) . "', " . $sql_match_column . ") @@ to_tsquery ('" . $db->sql_escape($config['fulltext_postgres_ts_name']) . "', '" . $db->sql_escape($this->tsearch_query) . "')";
+ $tmp_sql_match[] = "to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', " . $sql_match_column . ") @@ to_tsquery ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', '" . $this->db->sql_escape($this->tsearch_query) . "')";
}
$sql = "SELECT $sql_select
@@ -391,13 +473,13 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
WHERE (" . implode(' OR ', $tmp_sql_match) . ")
$sql_where_options
ORDER BY $sql_sort";
- $result = $db->sql_query_limit($sql, $config['search_block_size'], $start);
+ $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start);
- while ($row = $db->sql_fetchrow($result))
+ while ($row = $this->db->sql_fetchrow($result))
{
$id_ary[] = $row[$field];
}
- $db->sql_freeresult($result);
+ $this->db->sql_freeresult($result);
$id_ary = array_unique($id_ary);
@@ -442,14 +524,10 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
* @param int $start indicates the first index of the page
* @param int $per_page number of ids each page is supposed to contain
* @return boolean|int total number of results
- *
- * @access public
*/
- function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, &$id_ary, $start, $per_page)
+ public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_ary, $author_name, &$id_ary, $start, $per_page)
{
- global $config, $db;
-
- // No author? No posts.
+ // No author? No posts
if (!sizeof($author_ary))
{
return 0;
@@ -484,13 +562,13 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
if ($author_name)
{
// first one matches post of registered users, second one guests and deleted users
- $sql_author = '(' . $db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')';
+ $sql_author = '(' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')';
}
else
{
- $sql_author = $db->sql_in_set('p.poster_id', $author_ary);
+ $sql_author = $this->db->sql_in_set('p.poster_id', $author_ary);
}
- $sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
+ $sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
$sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : '';
$sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
$sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : '';
@@ -526,7 +604,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
}
else
{
- $m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
+ $m_approve_fid_sql = ' AND (p.post_approved = 1 OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) . ')';
}
// Build the query for really selecting the post_ids
@@ -562,13 +640,13 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
}
// Only read one block of posts from the db and then cache it
- $result = $db->sql_query_limit($sql, $config['search_block_size'], $start);
+ $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start);
- while ($row = $db->sql_fetchrow($result))
+ while ($row = $this->db->sql_fetchrow($result))
{
$id_ary[] = $row[$field];
}
- $db->sql_freeresult($result);
+ $this->db->sql_freeresult($result);
// retrieve the total result count if needed
if (!$result_count)
@@ -592,7 +670,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
}
/**
- * Destroys cached search results, that contained one of the new words in a post so the results won't be outdated.
+ * Destroys cached search results, that contained one of the new words in a post so the results won't be outdated
*
* @param string $mode contains the post mode: edit, post, reply, quote ...
* @param int $post_id contains the post id of the post to index
@@ -600,13 +678,9 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
* @param string $subject contains the subject of the post to index
* @param int $poster_id contains the user id of the poster
* @param int $forum_id contains the forum id of parent forum of the post
- *
- * @access public
*/
- function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id)
+ public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id)
{
- global $db;
-
// Split old and new post/subject to obtain array of words
$split_text = $this->split_message($message);
$split_title = ($subject) ? $this->split_message($subject) : array();
@@ -624,23 +698,17 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
/**
* Destroy cached results, that might be outdated after deleting a post
- *
- * @access public
*/
- function index_remove($post_ids, $author_ids, $forum_ids)
+ public function index_remove($post_ids, $author_ids, $forum_ids)
{
$this->destroy_cache(array(), $author_ids);
}
/**
* Destroy old cache entries
- *
- * @access public
*/
- function tidy()
+ public function tidy()
{
- global $db, $config;
-
// destroy too old cached search results
$this->destroy_cache(array());
@@ -651,13 +719,9 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
* Create fulltext index
*
* @return string|bool error string is returned incase of errors otherwise false
- *
- * @access public
*/
- function create_index($acp_module, $u_action)
+ public function create_index($acp_module, $u_action)
{
- global $db, $config;
-
// Make sure we can actually use PostgreSQL with fulltext indexes
if ($error = $this->init())
{
@@ -671,15 +735,15 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
if (!isset($this->stats['post_subject']))
{
- $db->sql_query("CREATE INDEX " . POSTS_TABLE . "_" . $config['fulltext_postgres_ts_name'] . "_post_subject ON " . POSTS_TABLE . " USING gin (to_tsvector ('" . $db->sql_escape($config['fulltext_postgres_ts_name']) . "', post_subject))");
+ $this->db->sql_query("CREATE INDEX " . POSTS_TABLE . "_" . $this->config['fulltext_postgres_ts_name'] . "_post_subject ON " . POSTS_TABLE . " USING gin (to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', post_subject))");
}
if (!isset($this->stats['post_text']))
{
- $db->sql_query("CREATE INDEX " . POSTS_TABLE . "_" . $config['fulltext_postgres_ts_name'] . "_post_text ON " . POSTS_TABLE . " USING gin (to_tsvector ('" . $db->sql_escape($config['fulltext_postgres_ts_name']) . "', post_text))");
+ $this->db->sql_query("CREATE INDEX " . POSTS_TABLE . "_" . $this->config['fulltext_postgres_ts_name'] . "_post_text ON " . POSTS_TABLE . " USING gin (to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', post_text))");
}
- $db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);
+ $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);
return false;
}
@@ -688,13 +752,9 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
* Drop fulltext index
*
* @return string|bool error string is returned incase of errors otherwise false
- *
- * @access public
*/
- function delete_index($acp_module, $u_action)
+ public function delete_index($acp_module, $u_action)
{
- global $db;
-
// Make sure we can actually use PostgreSQL with fulltext indexes
if ($error = $this->init())
{
@@ -708,25 +768,23 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
if (isset($this->stats['post_subject']))
{
- $db->sql_query('DROP INDEX ' . $this->stats['post_subject']['relname']);
+ $this->db->sql_query('DROP INDEX ' . $this->stats['post_subject']['relname']);
}
if (isset($this->stats['post_text']))
{
- $db->sql_query('DROP INDEX ' . $this->stats['post_text']['relname']);
+ $this->db->sql_query('DROP INDEX ' . $this->stats['post_text']['relname']);
}
- $db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);
+ $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);
return false;
}
/**
* Returns true if both FULLTEXT indexes exist
- *
- * @access public
*/
- function index_created()
+ public function index_created()
{
if (empty($this->stats))
{
@@ -738,33 +796,25 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
/**
* Returns an associative array containing information about the indexes
- *
- * @access public
*/
- function index_stats()
+ public function index_stats()
{
- global $user;
-
if (empty($this->stats))
{
$this->get_stats();
}
return array(
- $user->lang['FULLTEXT_POSTGRES_TOTAL_POSTS'] => ($this->index_created()) ? $this->stats['total_posts'] : 0,
+ $this->user->lang['FULLTEXT_POSTGRES_TOTAL_POSTS'] => ($this->index_created()) ? $this->stats['total_posts'] : 0,
);
}
/**
* Computes the stats and store them in the $this->stats associative array
- *
- * @access private
*/
- function get_stats()
+ protected function get_stats()
{
- global $db, $config;
-
- if ($db->sql_layer != 'postgres')
+ if ($this->db->sql_layer != 'postgres')
{
$this->stats = array();
return;
@@ -776,74 +826,70 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
AND pg_catalog.pg_table_is_visible(c1.oid)
AND c1.oid = i.indrelid
AND i.indexrelid = c2.oid";
- $result = $db->sql_query($sql);
+ $result = $this->db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
+ while ($row = $this->db->sql_fetchrow($result))
{
// deal with older PostgreSQL versions which didn't use Index_type
if (strpos($row['indexdef'], 'to_tsvector') !== false)
{
- if ($row['relname'] == POSTS_TABLE . '_' . $config['fulltext_postgres_ts_name'] . '_post_text' || $row['relname'] == POSTS_TABLE . '_post_text')
+ if ($row['relname'] == POSTS_TABLE . '_' . $this->config['fulltext_postgres_ts_name'] . '_post_text' || $row['relname'] == POSTS_TABLE . '_post_text')
{
$this->stats['post_text'] = $row;
}
- else if ($row['relname'] == POSTS_TABLE . '_' . $config['fulltext_postgres_ts_name'] . '_post_subject' || $row['relname'] == POSTS_TABLE . '_post_subject')
+ else if ($row['relname'] == POSTS_TABLE . '_' . $this->config['fulltext_postgres_ts_name'] . '_post_subject' || $row['relname'] == POSTS_TABLE . '_post_subject')
{
$this->stats['post_subject'] = $row;
}
}
}
- $db->sql_freeresult($result);
+ $this->db->sql_freeresult($result);
- $this->stats['total_posts'] = $config['num_posts'];
+ $this->stats['total_posts'] = $this->config['num_posts'];
}
/**
* Display various options that can be configured for the backend from the acp
*
* @return associative array containing template and config variables
- *
- * @access public
*/
- function acp()
+ public function acp()
{
- global $user, $config, $db;
-
$tpl = '
<dl>
- <dt><label>' . $user->lang['FULLTEXT_POSTGRES_VERSION_CHECK'] . '</label><br /><span>' . $user->lang['FULLTEXT_POSTGRES_VERSION_CHECK_EXPLAIN'] . '</span></dt>
- <dd>' . (($this->tsearch_usable) ? $user->lang['YES'] : $user->lang['NO']) . ' (PostgreSQL ' . $this->version . ')</dd>
+ <dt><label>' . $this->user->lang['FULLTEXT_POSTGRES_VERSION_CHECK'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_POSTGRES_VERSION_CHECK_EXPLAIN'] . '</span></dt>
+ <dd>' . (($this->tsearch_usable) ? $this->user->lang['YES'] : $this->user->lang['NO']) . ' (PostgreSQL ' . $this->version . ')</dd>
</dl>
<dl>
- <dt><label>' . $user->lang['FULLTEXT_POSTGRES_TS_NAME'] . '</label><br /><span>' . $user->lang['FULLTEXT_POSTGRES_TS_NAME_EXPLAIN'] . '</span></dt>
+ <dt><label>' . $this->user->lang['FULLTEXT_POSTGRES_TS_NAME'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_POSTGRES_TS_NAME_EXPLAIN'] . '</span></dt>
<dd><select name="config[fulltext_postgres_ts_name]">';
- if ($db->sql_layer == 'postgres' && $this->tsearch_usable)
+ if ($this->db->sql_layer == 'postgres' && $this->tsearch_usable)
{
$sql = 'SELECT cfgname AS ts_name
FROM pg_ts_config';
- $result = $db->sql_query($sql);
+ $result = $this->db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
+ while ($row = $this->db->sql_fetchrow($result))
{
- $tpl .= '<option value="' . $row['ts_name'] . '"' . ($row['ts_name'] === $config['fulltext_postgres_ts_name'] ? ' selected="selected"' : '') . '>' . $row['ts_name'] . '</option>';
+ $tpl .= '<option value="' . $row['ts_name'] . '"' . ($row['ts_name'] === $this->config['fulltext_postgres_ts_name'] ? ' selected="selected"' : '') . '>' . $row['ts_name'] . '</option>';
}
- $db->sql_freeresult($result);
+ $this->db->sql_freeresult($result);
}
else
{
- $tpl .= '<option value="' . $config['fulltext_postgres_ts_name'] . '" selected="selected">' . $config['fulltext_postgres_ts_name'] . '</option>';
+ $tpl .= '<option value="' . $this->config['fulltext_postgres_ts_name'] . '" selected="selected">' . $this->config['fulltext_postgres_ts_name'] . '</option>';
}
$tpl .= '</select></dd>
</dl>
<dl>
- <dt><label for="fulltext_postgres_min_word_len">' . $user->lang['FULLTEXT_POSTGRES_MIN_WORD_LEN'] . ':</label><br /><span>' . $user->lang['FULLTEXT_POSTGRES_MIN_WORD_LEN_EXPLAIN'] . '</span></dt>
- <dd><input id="fulltext_postgres_min_word_len" type="text" size="3" maxlength="3" name="config[fulltext_postgres_min_word_len]" value="' . (int) $config['fulltext_postgres_min_word_len'] . '" /></dd>
+ <dt><label for="fulltext_postgres_min_word_len">' . $this->user->lang['FULLTEXT_POSTGRES_MIN_WORD_LEN'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_POSTGRES_MIN_WORD_LEN_EXPLAIN'] . '</span></dt>
+ <dd><input id="fulltext_postgres_min_word_len" type="text" size="3" maxlength="3" name="config[fulltext_postgres_min_word_len]" value="' . (int) $this->config['fulltext_postgres_min_word_len'] . '" /></dd>
</dl>
<dl>
- <dt><label for="fulltext_postgres_max_word_len">' . $user->lang['FULLTEXT_POSTGRES_MAX_WORD_LEN'] . ':</label><br /><span>' . $user->lang['FULLTEXT_POSTGRES_MAX_WORD_LEN_EXPLAIN'] . '</span></dt>
- <dd><input id="fulltext_postgres_max_word_len" type="text" size="3" maxlength="3" name="config[fulltext_postgres_max_word_len]" value="' . (int) $config['fulltext_postgres_max_word_len'] . '" /></dd>
+ <dt><label for="fulltext_postgres_max_word_len">' . $this->user->lang['FULLTEXT_POSTGRES_MAX_WORD_LEN'] . $this->user->lang['COLON'] . '</label><br /><span>' . $this->user->lang['FULLTEXT_POSTGRES_MAX_WORD_LEN_EXPLAIN'] . '</span></dt>
+ <dd><input id="fulltext_postgres_max_word_len" type="text" size="3" maxlength="3" name="config[fulltext_postgres_max_word_len]" value="' . (int) $this->config['fulltext_postgres_max_word_len'] . '" /></dd>
</dl>
';