From b2e166dbfaab846a1aba82b4439999e98a003f82 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Fri, 10 Aug 2012 11:30:02 +0530 Subject: [PATCH 01/10] [ticket/11048] add access specifiers to pgsql search PHPBB3-11048 --- phpBB/includes/search/fulltext_postgres.php | 60 +++++---------------- 1 file changed, 14 insertions(+), 46 deletions(-) diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php index 0e6f72f142..d897c73745 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/includes/search/fulltext_postgres.php @@ -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 = '
From de8b7c0b7d07859b1110e32024209faadca64a6b Mon Sep 17 00:00:00 2001 From: Dhruv Date: Fri, 10 Aug 2012 11:35:50 +0530 Subject: [PATCH 02/10] [ticket/11048] add access specifiers to mysql search PHPBB3-11048 --- phpBB/includes/search/fulltext_mysql.php | 58 ++++++------------------ 1 file changed, 14 insertions(+), 44 deletions(-) diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index 8320b8e760..8684258982 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -52,8 +52,6 @@ class phpbb_search_fulltext_mysql 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() { @@ -64,10 +62,8 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base * Checks for correct MySQL 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 != 'mysql4' && $this->db->sql_layer != 'mysqli') { @@ -117,10 +113,8 @@ class phpbb_search_fulltext_mysql 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') { @@ -237,10 +231,8 @@ class phpbb_search_fulltext_mysql 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))); @@ -281,10 +273,8 @@ class phpbb_search_fulltext_mysql 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) @@ -463,10 +453,8 @@ class phpbb_search_fulltext_mysql 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)) @@ -625,10 +613,8 @@ class phpbb_search_fulltext_mysql 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); @@ -647,20 +633,16 @@ class phpbb_search_fulltext_mysql 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(), array_unique($author_ids)); } /** * Destroy old cache entries - * - * @access public */ - function tidy() + public function tidy() { // destroy too old cached search results $this->destroy_cache(array()); @@ -672,10 +654,8 @@ class phpbb_search_fulltext_mysql 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 MySQL with fulltext indexes if ($error = $this->init()) @@ -735,10 +715,8 @@ class phpbb_search_fulltext_mysql 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 MySQL with fulltext indexes if ($error = $this->init()) @@ -780,10 +758,8 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base /** * Returns true if both FULLTEXT indexes exist - * - * @access public */ - function index_created() + public function index_created() { if (empty($this->stats)) { @@ -795,10 +771,8 @@ class phpbb_search_fulltext_mysql 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)) { @@ -812,10 +786,8 @@ class phpbb_search_fulltext_mysql 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 (strpos($this->db->sql_layer, 'mysql') === false) { @@ -857,10 +829,8 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base * Display a note, that UTF-8 support is not available with certain versions of PHP * * @return associative array containing template and config variables - * - * @access public */ - function acp() + public function acp() { $tpl = '
From dd56c401af495655fe729e3d5919623114812f1a Mon Sep 17 00:00:00 2001 From: Dhruv Date: Fri, 10 Aug 2012 12:23:25 +0530 Subject: [PATCH 03/10] [ticket/11048] add access specifiers to phpbb native search PHPBB3-11048 --- phpBB/includes/search/fulltext_native.php | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index ea9d050b60..478b1f2c82 100644 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -90,7 +90,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base * * @access public */ - function split_keywords($keywords, $terms) + public function split_keywords($keywords, $terms) { $tokens = '+-|()*'; @@ -427,7 +427,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base * * @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 (empty($this->search_query)) @@ -823,7 +823,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base * * @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)) @@ -1048,7 +1048,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base * * @access private */ - function split_message($text) + public function split_message($text) { $match = $words = array(); @@ -1125,7 +1125,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base * * @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 (!$this->config['fulltext_native_load_upd']) { @@ -1282,7 +1282,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base /** * Removes entries from the wordmatch table for the specified post_ids */ - function index_remove($post_ids, $author_ids, $forum_ids) + public function index_remove($post_ids, $author_ids, $forum_ids) { if (sizeof($post_ids)) { @@ -1340,7 +1340,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base * Tidy up indexes: Tag 'common words' and remove * words no longer referenced in the match table */ - function tidy() + public function tidy() { // Is the fulltext indexer disabled? If yes then we need not // carry on ... it's okay ... I know when I'm not wanted boo hoo @@ -1403,7 +1403,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base /** * Deletes all words from the index */ - function delete_index($acp_module, $u_action) + public function delete_index($acp_module, $u_action) { switch ($this->db->sql_layer) { @@ -1425,7 +1425,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base /** * Returns true if both FULLTEXT indexes exist */ - function index_created() + public function index_created() { if (!sizeof($this->stats)) { @@ -1438,7 +1438,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base /** * Returns an associative array containing information about the indexes */ - function index_stats() + public function index_stats() { if (!sizeof($this->stats)) { @@ -1450,7 +1450,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base $this->user->lang['TOTAL_MATCHES'] => $this->stats['total_matches']); } - function get_stats() + private function get_stats() { $this->stats['total_words'] = $this->db->get_estimated_row_count(SEARCH_WORDLIST_TABLE); $this->stats['total_matches'] = $this->db->get_estimated_row_count(SEARCH_WORDMATCH_TABLE); @@ -1471,7 +1471,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base * * @todo normalizer::cleanup being able to be used? */ - function cleanup($text, $allowed_chars = null, $encoding = 'utf-8') + private function cleanup($text, $allowed_chars = null, $encoding = 'utf-8') { static $conv = array(), $conv_loaded = array(); $words = $allow = array(); @@ -1700,7 +1700,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base /** * Returns a list of options for the ACP to display */ - function acp() + public function acp() { /** * if we need any options, copied from fulltext_native for now, will have to be adjusted or removed From 42d6e0715feacd4bea4cdfc31272546c414df6ef Mon Sep 17 00:00:00 2001 From: Dhruv Date: Fri, 10 Aug 2012 14:06:25 +0530 Subject: [PATCH 04/10] [ticket/11048] add access specifiers to sphinx search PHPBB3-11048 --- phpBB/includes/search/fulltext_sphinx.php | 58 ++++++----------------- 1 file changed, 14 insertions(+), 44 deletions(-) diff --git a/phpBB/includes/search/fulltext_sphinx.php b/phpBB/includes/search/fulltext_sphinx.php index 5f4a0deaa0..9b98bf038b 100644 --- a/phpBB/includes/search/fulltext_sphinx.php +++ b/phpBB/includes/search/fulltext_sphinx.php @@ -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() + private 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)) @@ -551,10 +541,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 = ''; @@ -573,10 +561,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') { @@ -618,10 +604,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) @@ -634,10 +618,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); } @@ -646,10 +628,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()) { @@ -680,10 +660,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()) { @@ -699,10 +677,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; @@ -718,10 +694,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)) { @@ -737,10 +711,8 @@ class phpbb_search_fulltext_sphinx /** * Collects stats that can be displayed on the index maintenance page - * - * @access private */ - function get_stats() + private function get_stats() { if ($this->index_created()) { @@ -764,10 +736,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', From a3a359d80ac5a4594ac6e7eee0b851d40d6ccf66 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Fri, 10 Aug 2012 16:35:06 +0530 Subject: [PATCH 05/10] [ticket/11048] add access specifiers to phpbb native search properties PHPBB3-11048 --- phpBB/includes/search/fulltext_native.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index 478b1f2c82..d66e690c76 100644 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -22,14 +22,14 @@ if (!defined('IN_PHPBB')) */ class phpbb_search_fulltext_native extends phpbb_search_base { - var $stats = array(); - var $word_length = array(); - var $search_query; - var $common_words = array(); + private $stats = array(); + public $word_length = array(); + public $search_query; + public $common_words = array(); - var $must_contain_ids = array(); - var $must_not_contain_ids = array(); - var $must_exclude_one_ids = array(); + private $must_contain_ids = array(); + private $must_not_contain_ids = array(); + private $must_exclude_one_ids = array(); private $phpbb_root_path; private $php_ext; From d0cdf445fba40401171b672ebd8fd1549b15a78f Mon Sep 17 00:00:00 2001 From: Dhruv Date: Tue, 14 Aug 2012 17:33:44 +0530 Subject: [PATCH 06/10] [ticket/11048] use protected instead of private in sphinx PHPBB3-11048 --- phpBB/includes/search/fulltext_sphinx.php | 32 +++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/phpBB/includes/search/fulltext_sphinx.php b/phpBB/includes/search/fulltext_sphinx.php index 9b98bf038b..f586860311 100644 --- a/phpBB/includes/search/fulltext_sphinx.php +++ b/phpBB/includes/search/fulltext_sphinx.php @@ -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(); @@ -121,7 +121,7 @@ class phpbb_search_fulltext_sphinx * * @return bool True if sphinx.conf content is correctly generated, false otherwise */ - 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') @@ -712,7 +712,7 @@ class phpbb_search_fulltext_sphinx /** * Collects stats that can be displayed on the index maintenance page */ - private function get_stats() + protected function get_stats() { if ($this->index_created()) { From 5698d03ead081d167264a1a561b61b7ba9af1587 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Tue, 14 Aug 2012 17:35:24 +0530 Subject: [PATCH 07/10] [ticket/11048] use protected instead of private in mysql fulltext PHPBB3-11048 --- phpBB/includes/search/fulltext_mysql.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index 8684258982..cf89ab1c24 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -22,11 +22,11 @@ if (!defined('IN_PHPBB')) */ class phpbb_search_fulltext_mysql extends phpbb_search_base { - private $stats = array(); - private $split_words = array(); - private $config; - private $db; - private $user; + protected $stats = array(); + protected $split_words = array(); + protected $config; + protected $db; + protected $user; public $word_length = array(); public $search_query; public $common_words = array(); @@ -787,7 +787,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base /** * Computes the stats and store them in the $this->stats associative array */ - private function get_stats() + protected function get_stats() { if (strpos($this->db->sql_layer, 'mysql') === false) { From 8e8e94ec4c43fa67366ae4c317ff123965f4fe0b Mon Sep 17 00:00:00 2001 From: Dhruv Date: Tue, 14 Aug 2012 17:43:01 +0530 Subject: [PATCH 08/10] [ticket/11048] remove @access from all docblocks PHPBB3-11048 --- phpBB/includes/search/fulltext_native.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index d66e690c76..56a610a392 100644 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -87,8 +87,6 @@ class phpbb_search_fulltext_native extends phpbb_search_base * @param string $terms is either 'all' (use search query as entered, default words to 'must be contained in post') * or 'any' (find all posts containing at least one of the given words) * @return boolean false if no valid keywords were found and otherwise true - * - * @access public */ public function split_keywords($keywords, $terms) { @@ -424,8 +422,6 @@ class phpbb_search_fulltext_native 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 */ 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) { @@ -820,8 +816,6 @@ class phpbb_search_fulltext_native 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 */ 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) { @@ -1045,8 +1039,6 @@ class phpbb_search_fulltext_native extends phpbb_search_base * * @param string $text Text to split, encoded in UTF-8 * @return array Array of UTF-8 words - * - * @access private */ public function split_message($text) { @@ -1122,8 +1114,6 @@ class phpbb_search_fulltext_native extends phpbb_search_base * @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 */ public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id) { From 469d8083656e455dc52cd1e4e65fdd7c86c5e2ab Mon Sep 17 00:00:00 2001 From: Dhruv Date: Tue, 14 Aug 2012 17:46:17 +0530 Subject: [PATCH 09/10] [ticket/11048] use protected instead of private in native search PHPBB3-11048 --- phpBB/includes/search/fulltext_native.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index 56a610a392..96b3f02ec6 100644 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -22,20 +22,20 @@ if (!defined('IN_PHPBB')) */ class phpbb_search_fulltext_native extends phpbb_search_base { - private $stats = array(); + protected $stats = array(); public $word_length = array(); public $search_query; public $common_words = array(); - private $must_contain_ids = array(); - private $must_not_contain_ids = array(); - private $must_exclude_one_ids = array(); + protected $must_contain_ids = array(); + protected $must_not_contain_ids = array(); + protected $must_exclude_one_ids = array(); - private $phpbb_root_path; - private $php_ext; - private $config; - private $db; - private $user; + protected $phpbb_root_path; + protected $php_ext; + protected $config; + protected $db; + protected $user; /** * Initialises the fulltext_native search backend with min/max word length and makes sure the UTF-8 normalizer is loaded. @@ -1440,7 +1440,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base $this->user->lang['TOTAL_MATCHES'] => $this->stats['total_matches']); } - private function get_stats() + protected function get_stats() { $this->stats['total_words'] = $this->db->get_estimated_row_count(SEARCH_WORDLIST_TABLE); $this->stats['total_matches'] = $this->db->get_estimated_row_count(SEARCH_WORDMATCH_TABLE); @@ -1461,7 +1461,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base * * @todo normalizer::cleanup being able to be used? */ - private function cleanup($text, $allowed_chars = null, $encoding = 'utf-8') + protected function cleanup($text, $allowed_chars = null, $encoding = 'utf-8') { static $conv = array(), $conv_loaded = array(); $words = $allow = array(); From a9fd98c1366cc63032bcfa5d5409ebf891ea5095 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Tue, 14 Aug 2012 17:47:01 +0530 Subject: [PATCH 10/10] [ticket/11048] use protected instead of private in pgsql fulltext PHPBB3-11048 --- phpBB/includes/search/fulltext_postgres.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/search/fulltext_postgres.php b/phpBB/includes/search/fulltext_postgres.php index d897c73745..50ed785093 100644 --- a/phpBB/includes/search/fulltext_postgres.php +++ b/phpBB/includes/search/fulltext_postgres.php @@ -22,15 +22,15 @@ 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; - private $config; - private $db; - private $user; + protected $stats = array(); + protected $split_words = array(); + protected $tsearch_usable = false; + protected $version; + protected $tsearch_query; + protected $phrase_search = false; + protected $config; + protected $db; + protected $user; public $search_query; public $common_words = array(); public $word_length = array(); @@ -714,7 +714,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base /** * Computes the stats and store them in the $this->stats associative array */ - private function get_stats() + protected function get_stats() { if ($this->db->sql_layer != 'postgres') {