1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-29 18:50:25 +02:00

[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
This commit is contained in:
Dhruv Goel 2012-06-27 03:44:03 +05:30 committed by Dhruv
parent bfd01f0187
commit 39f8a5fa9f

View File

@ -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);