1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-22 10:57:56 +01:00

[ticket/11048] add access specifiers to pgsql search

PHPBB3-11048
This commit is contained in:
Dhruv 2012-08-10 11:30:02 +05:30
parent 4b8eac02f0
commit b2e166dbfa

View File

@ -66,8 +66,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()
{
@ -78,8 +76,6 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
* Returns if phrase search is supported or not
*
* @return bool
*
* @access public
*/
public function supports_phrase_search()
{
@ -90,10 +86,8 @@ 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()
{
if ($this->db->sql_layer != 'postgres')
{
@ -115,10 +109,8 @@ 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)
{
if ($terms == 'all')
{
@ -208,10 +200,8 @@ 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)
{
// Split words
$text = preg_replace('#([^\p{L}\p{N}\'*])#u', '$1$1', str_replace('\'\'', '\' \'', trim($text)));
@ -252,10 +242,8 @@ 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)
{
// No keywords? No posts.
if (!$this->search_query)
@ -438,10 +426,8 @@ 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)
{
// No author? No posts.
if (!sizeof($author_ary))
@ -594,10 +580,8 @@ 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)
{
// Split old and new post/subject to obtain array of words
$split_text = $this->split_message($message);
@ -616,20 +600,16 @@ 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()
{
// destroy too old cached search results
$this->destroy_cache(array());
@ -641,10 +621,8 @@ 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)
{
// Make sure we can actually use PostgreSQL with fulltext indexes
if ($error = $this->init())
@ -676,10 +654,8 @@ 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)
{
// Make sure we can actually use PostgreSQL with fulltext indexes
if ($error = $this->init())
@ -709,10 +685,8 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
/**
* Returns true if both FULLTEXT indexes exist
*
* @access public
*/
function index_created()
public function index_created()
{
if (empty($this->stats))
{
@ -724,10 +698,8 @@ 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()
{
if (empty($this->stats))
{
@ -741,10 +713,8 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
/**
* Computes the stats and store them in the $this->stats associative array
*
* @access private
*/
function get_stats()
private function get_stats()
{
if ($this->db->sql_layer != 'postgres')
{
@ -784,10 +754,8 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
* 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()
{
$tpl = '
<dl>