mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-06 14:35:56 +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:
parent
bfd01f0187
commit
39f8a5fa9f
@ -53,7 +53,7 @@ class phpbb_search_fulltext_sphinx
|
|||||||
$this->id = $config['avatar_salt'];
|
$this->id = $config['avatar_salt'];
|
||||||
$this->indexes = 'index_phpbb_' . $this->id . '_delta;index_phpbb_' . $this->id . '_main';
|
$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']))
|
if (!empty($config['fulltext_sphinx_configured']))
|
||||||
{
|
{
|
||||||
@ -648,18 +648,28 @@ class phpbb_search_fulltext_sphinx
|
|||||||
}
|
}
|
||||||
else if ($mode != 'post' && $post_id)
|
else if ($mode != 'post' && $post_id)
|
||||||
{
|
{
|
||||||
// update topic_last_post_time for full topic
|
// Update topic_last_post_time for full topic
|
||||||
$sql = 'SELECT p1.post_id
|
$sql_array = array(
|
||||||
FROM ' . POSTS_TABLE . ' p1
|
'SELECT' => 'p1.post_id',
|
||||||
LEFT JOIN ' . POSTS_TABLE . ' p2 ON (p1.topic_id = p2.topic_id)
|
'FROM' => array(
|
||||||
WHERE p2.post_id = ' . $post_id;
|
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);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$post_updates = array();
|
$post_updates = array();
|
||||||
$post_time = time();
|
$post_time = time();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
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);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user