aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorDhruv Goel <dhruv.goel92@gmail.com>2012-07-10 05:23:23 +0530
committerDhruv <dhruv.goel92@gmail.com>2012-07-19 23:01:35 +0530
commit45c0956bcf72e59138c3b05e26c73b657298f562 (patch)
tree344dd5f9174b6fb8d538884f906acc4bca3c9b11 /phpBB
parent79432aa4a0698a5a4a518521613aad4adbb40584 (diff)
downloadforums-45c0956bcf72e59138c3b05e26c73b657298f562.tar
forums-45c0956bcf72e59138c3b05e26c73b657298f562.tar.gz
forums-45c0956bcf72e59138c3b05e26c73b657298f562.tar.bz2
forums-45c0956bcf72e59138c3b05e26c73b657298f562.tar.xz
forums-45c0956bcf72e59138c3b05e26c73b657298f562.zip
[feature/sphinx-fulltext-search] implementing db_tools
Use db_tools class for creating/dropping sphinx table. PHPBB3-10946
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/search/fulltext_sphinx.php27
1 files changed, 19 insertions, 8 deletions
diff --git a/phpBB/includes/search/fulltext_sphinx.php b/phpBB/includes/search/fulltext_sphinx.php
index f858b199b2..317a35937d 100644
--- a/phpBB/includes/search/fulltext_sphinx.php
+++ b/phpBB/includes/search/fulltext_sphinx.php
@@ -43,6 +43,7 @@ class phpbb_search_fulltext_sphinx
private $auth;
private $config;
private $db;
+ private $db_tools;
private $user;
public $word_length = array();
public $search_query;
@@ -56,12 +57,20 @@ class phpbb_search_fulltext_sphinx
*/
public function __construct(&$error)
{
- global $config, $db, $user, $auth;
+ global $config, $db, $user, $auth, $phpbb_root_path, $phpEx;
$this->config = $config;
$this->user = $user;
$this->db = $db;
$this->auth = $auth;
+ if (!class_exists('phpbb_db_tools'))
+ {
+ require($phpbb_root_path . 'includes/db/db_tools.' . $phpEx);
+ }
+
+ // Initialize phpbb_db_tools object
+ $this->db_tools = new phpbb_db_tools($this->db);
+
$this->id = $config['avatar_salt'];
$this->indexes = 'index_phpbb_' . $this->id . '_delta;index_phpbb_' . $this->id . '_main';
@@ -604,11 +613,14 @@ class phpbb_search_fulltext_sphinx
{
if (!$this->index_created())
{
- $sql = 'CREATE TABLE IF NOT EXISTS ' . SPHINX_TABLE . ' (
- counter_id INT NOT NULL PRIMARY KEY,
- max_doc_id INT NOT NULL
- )';
- $this->db->sql_query($sql);
+ $table_data = array(
+ 'COLUMNS' => array(
+ 'counter_id' => array('UINT', 0),
+ 'max_doc_id' => array('UINT', 0),
+ ),
+ 'PRIMARY_KEY' => 'counter_id',
+ );
+ $this->db_tools->sql_create_table(SPHINX_TABLE, $table_data);
$sql = 'TRUNCATE TABLE ' . SPHINX_TABLE;
$this->db->sql_query($sql);
@@ -631,8 +643,7 @@ class phpbb_search_fulltext_sphinx
return false;
}
- $sql = 'DROP TABLE ' . SPHINX_TABLE;
- $this->db->sql_query($sql);
+ $this->db_tools->sql_table_drop(SPHINX_TABLE);
return false;
}