1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-19 15:01:33 +02:00

Merge remote-tracking branch 'dhruvgoel92/ticket/11048' into develop

* dhruvgoel92/ticket/11048:
  [ticket/11048] use protected instead of private in pgsql fulltext
  [ticket/11048] use protected instead of private in native search
  [ticket/11048] remove @access from all docblocks
  [ticket/11048] use protected instead of private in mysql fulltext
  [ticket/11048] use protected instead of private in sphinx
  [ticket/11048] add access specifiers to phpbb native search properties
  [ticket/11048] add access specifiers to sphinx search
  [ticket/11048] add access specifiers to phpbb native search
  [ticket/11048] add access specifiers to mysql search
  [ticket/11048] add access specifiers to pgsql search
This commit is contained in:
Andreas Fischer
2012-08-14 14:38:19 +02:00
4 changed files with 95 additions and 197 deletions

View File

@@ -28,20 +28,20 @@ define('SPHINX_CONNECT_WAIT_TIME', 300);
*/
class phpbb_search_fulltext_sphinx
{
private $stats = array();
private $split_words = array();
private $id;
private $indexes;
private $sphinx;
private $phpbb_root_path;
private $php_ext;
private $auth;
private $config;
private $db;
private $db_tools;
private $dbtype;
private $user;
private $config_file_data = '';
protected $stats = array();
protected $split_words = array();
protected $id;
protected $indexes;
protected $sphinx;
protected $phpbb_root_path;
protected $php_ext;
protected $auth;
protected $config;
protected $db;
protected $db_tools;
protected $dbtype;
protected $user;
protected $config_file_data = '';
public $search_query;
public $common_words = array();
@@ -92,8 +92,6 @@ class phpbb_search_fulltext_sphinx
* Returns the name of this search backend to be displayed to administrators
*
* @return string Name
*
* @access public
*/
public function get_name()
{
@@ -104,10 +102,8 @@ class phpbb_search_fulltext_sphinx
* Checks permissions and paths, if everything is correct it generates the config file
*
* @return string|bool Language key of the error/incompatiblity encountered, or false if successful
*
* @access public
*/
function init()
public function init()
{
if ($this->db->sql_layer != 'mysql' && $this->db->sql_layer != 'mysql4' && $this->db->sql_layer != 'mysqli' && $this->db->sql_layer != 'postgres')
{
@@ -124,10 +120,8 @@ class phpbb_search_fulltext_sphinx
* Generates content of sphinx.conf
*
* @return bool True if sphinx.conf content is correctly generated, false otherwise
*
* @access private
*/
function config_generate()
protected function config_generate()
{
// Check if Database is supported by Sphinx
if ($this->db->sql_layer =='mysql' || $this->db->sql_layer == 'mysql4' || $this->db->sql_layer == 'mysqli')
@@ -306,10 +300,8 @@ class phpbb_search_fulltext_sphinx
* @param string $keywords Contains the keyword as entered by the user
* @param string $terms is either 'all' or 'any'
* @return 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')
{
@@ -356,10 +348,8 @@ class phpbb_search_fulltext_sphinx
* @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 (!strlen($this->search_query) && !sizeof($author_ary))
@@ -559,10 +549,8 @@ class phpbb_search_fulltext_sphinx
* @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)
{
$this->search_query = '';
@@ -581,10 +569,8 @@ class phpbb_search_fulltext_sphinx
* @param string &$subject New or updated post subject
* @param int $poster_id Post author's user id
* @param int $forum_id The id of the forum in which the post is located
*
* @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)
{
if ($mode == 'edit')
{
@@ -626,10 +612,8 @@ class phpbb_search_fulltext_sphinx
/**
* Delete a post from the index after it was deleted
*
* @access public
*/
function index_remove($post_ids, $author_ids, $forum_ids)
public function index_remove($post_ids, $author_ids, $forum_ids)
{
$values = array();
foreach ($post_ids as $post_id)
@@ -642,10 +626,8 @@ class phpbb_search_fulltext_sphinx
/**
* Nothing needs to be destroyed
*
* @access public
*/
function tidy($create = false)
public function tidy($create = false)
{
set_config('search_last_gc', time(), true);
}
@@ -654,10 +636,8 @@ class phpbb_search_fulltext_sphinx
* Create sphinx table
*
* @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)
{
if (!$this->index_created())
{
@@ -688,10 +668,8 @@ class phpbb_search_fulltext_sphinx
* Drop sphinx table
*
* @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)
{
if (!$this->index_created())
{
@@ -707,10 +685,8 @@ class phpbb_search_fulltext_sphinx
* Returns true if the sphinx table was created
*
* @return bool true if sphinx table was created
*
* @access public
*/
function index_created($allow_new_files = true)
public function index_created($allow_new_files = true)
{
$created = false;
@@ -726,10 +702,8 @@ class phpbb_search_fulltext_sphinx
* Returns an associative array containing information about the indexes
*
* @return string|bool Language string of error false otherwise
*
* @access public
*/
function index_stats()
public function index_stats()
{
if (empty($this->stats))
{
@@ -745,10 +719,8 @@ class phpbb_search_fulltext_sphinx
/**
* Collects stats that can be displayed on the index maintenance page
*
* @access private
*/
function get_stats()
protected function get_stats()
{
if ($this->index_created())
{
@@ -772,10 +744,8 @@ class phpbb_search_fulltext_sphinx
* Returns a list of options for the ACP to display
*
* @return associative array containing template and config variables
*
* @access public
*/
function acp()
public function acp()
{
$config_vars = array(
'fulltext_sphinx_data_path' => 'string',