mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[ticket/11048] add access specifiers to sphinx search
PHPBB3-11048
This commit is contained in:
parent
dd56c401af
commit
42d6e0715f
1 changed files with 14 additions and 44 deletions
|
@ -92,8 +92,6 @@ class phpbb_search_fulltext_sphinx
|
||||||
* Returns the name of this search backend to be displayed to administrators
|
* Returns the name of this search backend to be displayed to administrators
|
||||||
*
|
*
|
||||||
* @return string Name
|
* @return string Name
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
*/
|
*/
|
||||||
public function get_name()
|
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
|
* 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
|
* @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')
|
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
|
* Generates content of sphinx.conf
|
||||||
*
|
*
|
||||||
* @return bool True if sphinx.conf content is correctly generated, false otherwise
|
* @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
|
// Check if Database is supported by Sphinx
|
||||||
if ($this->db->sql_layer =='mysql' || $this->db->sql_layer == 'mysql4' || $this->db->sql_layer == 'mysqli')
|
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 $keywords Contains the keyword as entered by the user
|
||||||
* @param string $terms is either 'all' or 'any'
|
* @param string $terms is either 'all' or 'any'
|
||||||
* @return false if no valid keywords were found and otherwise true
|
* @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')
|
if ($terms == 'all')
|
||||||
{
|
{
|
||||||
|
@ -356,10 +348,8 @@ class phpbb_search_fulltext_sphinx
|
||||||
* @param int $start indicates the first index of the page
|
* @param int $start indicates the first index of the page
|
||||||
* @param int $per_page number of ids each page is supposed to contain
|
* @param int $per_page number of ids each page is supposed to contain
|
||||||
* @return boolean|int total number of results
|
* @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.
|
// No keywords? No posts.
|
||||||
if (!strlen($this->search_query) && !sizeof($author_ary))
|
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 $start indicates the first index of the page
|
||||||
* @param int $per_page number of ids each page is supposed to contain
|
* @param int $per_page number of ids each page is supposed to contain
|
||||||
* @return boolean|int total number of results
|
* @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 = '';
|
$this->search_query = '';
|
||||||
|
|
||||||
|
@ -573,10 +561,8 @@ class phpbb_search_fulltext_sphinx
|
||||||
* @param string &$subject New or updated post subject
|
* @param string &$subject New or updated post subject
|
||||||
* @param int $poster_id Post author's user id
|
* @param int $poster_id Post author's user id
|
||||||
* @param int $forum_id The id of the forum in which the post is located
|
* @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')
|
if ($mode == 'edit')
|
||||||
{
|
{
|
||||||
|
@ -618,10 +604,8 @@ class phpbb_search_fulltext_sphinx
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a post from the index after it was deleted
|
* 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();
|
$values = array();
|
||||||
foreach ($post_ids as $post_id)
|
foreach ($post_ids as $post_id)
|
||||||
|
@ -634,10 +618,8 @@ class phpbb_search_fulltext_sphinx
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Nothing needs to be destroyed
|
* Nothing needs to be destroyed
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
*/
|
*/
|
||||||
function tidy($create = false)
|
public function tidy($create = false)
|
||||||
{
|
{
|
||||||
set_config('search_last_gc', time(), true);
|
set_config('search_last_gc', time(), true);
|
||||||
}
|
}
|
||||||
|
@ -646,10 +628,8 @@ class phpbb_search_fulltext_sphinx
|
||||||
* Create sphinx table
|
* Create sphinx table
|
||||||
*
|
*
|
||||||
* @return string|bool error string is returned incase of errors otherwise false
|
* @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())
|
if (!$this->index_created())
|
||||||
{
|
{
|
||||||
|
@ -680,10 +660,8 @@ class phpbb_search_fulltext_sphinx
|
||||||
* Drop sphinx table
|
* Drop sphinx table
|
||||||
*
|
*
|
||||||
* @return string|bool error string is returned incase of errors otherwise false
|
* @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())
|
if (!$this->index_created())
|
||||||
{
|
{
|
||||||
|
@ -699,10 +677,8 @@ class phpbb_search_fulltext_sphinx
|
||||||
* Returns true if the sphinx table was created
|
* Returns true if the sphinx table was created
|
||||||
*
|
*
|
||||||
* @return bool true if 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;
|
$created = false;
|
||||||
|
|
||||||
|
@ -718,10 +694,8 @@ class phpbb_search_fulltext_sphinx
|
||||||
* Returns an associative array containing information about the indexes
|
* Returns an associative array containing information about the indexes
|
||||||
*
|
*
|
||||||
* @return string|bool Language string of error false otherwise
|
* @return string|bool Language string of error false otherwise
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
*/
|
*/
|
||||||
function index_stats()
|
public function index_stats()
|
||||||
{
|
{
|
||||||
if (empty($this->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
|
* Collects stats that can be displayed on the index maintenance page
|
||||||
*
|
|
||||||
* @access private
|
|
||||||
*/
|
*/
|
||||||
function get_stats()
|
private function get_stats()
|
||||||
{
|
{
|
||||||
if ($this->index_created())
|
if ($this->index_created())
|
||||||
{
|
{
|
||||||
|
@ -764,10 +736,8 @@ class phpbb_search_fulltext_sphinx
|
||||||
* Returns a list of options for the ACP to display
|
* Returns a list of options for the ACP to display
|
||||||
*
|
*
|
||||||
* @return associative array containing template and config variables
|
* @return associative array containing template and config variables
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
*/
|
*/
|
||||||
function acp()
|
public function acp()
|
||||||
{
|
{
|
||||||
$config_vars = array(
|
$config_vars = array(
|
||||||
'fulltext_sphinx_data_path' => 'string',
|
'fulltext_sphinx_data_path' => 'string',
|
||||||
|
|
Loading…
Add table
Reference in a new issue