aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/search
diff options
context:
space:
mode:
authorDhruv Goel <dhruv.goel92@gmail.com>2012-06-27 03:44:03 +0530
committerDhruv <dhruv.goel92@gmail.com>2012-07-12 17:31:57 +0530
commit39f8a5fa9f71724d0abd98cdf7a7d82fc7e7bb0f (patch)
tree27446055fc91bf3b3d75baf30a421e7f9151f698 /phpBB/includes/search
parentbfd01f01877bcb9a9be9e2df5c6713c3e338579e (diff)
downloadforums-39f8a5fa9f71724d0abd98cdf7a7d82fc7e7bb0f.tar
forums-39f8a5fa9f71724d0abd98cdf7a7d82fc7e7bb0f.tar.gz
forums-39f8a5fa9f71724d0abd98cdf7a7d82fc7e7bb0f.tar.bz2
forums-39f8a5fa9f71724d0abd98cdf7a7d82fc7e7bb0f.tar.xz
forums-39f8a5fa9f71724d0abd98cdf7a7d82fc7e7bb0f.zip
[feature/sphinx-fulltext-search] use sql_build_query for query
Uses sql_build_query for JOIN query. Remove casting to int and space for phpbb conventions to be followed PHPBB3-10946 Conflicts: phpBB/includes/search/fulltext_sphinx.php
Diffstat (limited to 'phpBB/includes/search')
-rw-r--r--phpBB/includes/search/fulltext_sphinx.php24
1 files changed, 17 insertions, 7 deletions
diff --git a/phpBB/includes/search/fulltext_sphinx.php b/phpBB/includes/search/fulltext_sphinx.php
index 477b1646fb..2690612b1a 100644
--- a/phpBB/includes/search/fulltext_sphinx.php
+++ b/phpBB/includes/search/fulltext_sphinx.php
@@ -53,7 +53,7 @@ class phpbb_search_fulltext_sphinx
$this->id = $config['avatar_salt'];
$this->indexes = 'index_phpbb_' . $this->id . '_delta;index_phpbb_' . $this->id . '_main';
- $this->sphinx = new SphinxClient ();
+ $this->sphinx = new SphinxClient();
if (!empty($config['fulltext_sphinx_configured']))
{
@@ -648,18 +648,28 @@ class phpbb_search_fulltext_sphinx
}
else if ($mode != 'post' && $post_id)
{
- // update topic_last_post_time for full topic
- $sql = 'SELECT p1.post_id
- FROM ' . POSTS_TABLE . ' p1
- LEFT JOIN ' . POSTS_TABLE . ' p2 ON (p1.topic_id = p2.topic_id)
- WHERE p2.post_id = ' . $post_id;
+ // Update topic_last_post_time for full topic
+ $sql_array = array(
+ 'SELECT' => 'p1.post_id',
+ 'FROM' => array(
+ POSTS_TABLE => 'p1',
+ ),
+ 'LEFT_JOIN' => array(array(
+ 'FROM' => array(
+ POSTS_TABLE => 'p2'
+ ),
+ 'ON' => 'p1.topic_id = p2.topic_id',
+ )),
+ );
+
+ $sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query($sql);
$post_updates = array();
$post_time = time();
while ($row = $db->sql_fetchrow($result))
{
- $post_updates[(int)$row['post_id']] = array((int) $post_time);
+ $post_updates[(int)$row['post_id']] = array($post_time);
}
$db->sql_freeresult($result);