mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-12 06:18:52 +00:00
[ticket/10199] Delete a useless join in viewtopic.
PHPBB3-10199
This commit is contained in:
parent
13ca659f1f
commit
0648923b19
1 changed files with 6 additions and 7 deletions
|
@ -196,7 +196,7 @@ if ($db->sql_layer === 'firebird')
|
||||||
// The FROM-Order is quite important here, else t.* columns can not be correctly bound.
|
// The FROM-Order is quite important here, else t.* columns can not be correctly bound.
|
||||||
if ($post_id)
|
if ($post_id)
|
||||||
{
|
{
|
||||||
$sql_array['SELECT'] .= ', p.post_approved';
|
$sql_array['SELECT'] .= ', p.post_approved, p.post_time';
|
||||||
$sql_array['FROM'][POSTS_TABLE] = 'p';
|
$sql_array['FROM'][POSTS_TABLE] = 'p';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,12 +314,11 @@ if ($post_id)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = 'SELECT COUNT(p1.post_id) AS prev_posts
|
$sql = 'SELECT COUNT(p.post_id) AS prev_posts
|
||||||
FROM ' . POSTS_TABLE . ' p1, ' . POSTS_TABLE . " p2
|
FROM ' . POSTS_TABLE . " p
|
||||||
WHERE p1.topic_id = {$topic_data['topic_id']}
|
WHERE p.topic_id = {$topic_data['topic_id']}
|
||||||
AND p2.post_id = {$post_id}
|
" . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . '
|
||||||
" . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p1.post_approved = 1' : '') . '
|
AND ' . (($sort_dir == 'd') ? "p.post_time >= {$topic_data['post_time']}" : "p.post_time <= {$topic_data['post_time']}");
|
||||||
AND ' . (($sort_dir == 'd') ? 'p1.post_time >= p2.post_time' : 'p1.post_time <= p2.post_time');
|
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
|
|
Loading…
Add table
Reference in a new issue