mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
- backport viewforum performance change from 3.1.x to 3.0.x
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8305 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
8b423ba308
commit
1074925720
3 changed files with 62 additions and 29 deletions
|
@ -90,6 +90,11 @@
|
||||||
<li>[Fix] Allow single quotes in db password to be stored within config.php in installer</li>
|
<li>[Fix] Allow single quotes in db password to be stored within config.php in installer</li>
|
||||||
<li>[Fix] Correctly quote db password for re-display in installer (Bug #16695 / thanks to m313 for reporting too - #s17235)</li>
|
<li>[Fix] Correctly quote db password for re-display in installer (Bug #16695 / thanks to m313 for reporting too - #s17235)</li>
|
||||||
<li>[Fix] Correctly handle empty imageset entries (Bug #16865)</li>
|
<li>[Fix] Correctly handle empty imageset entries (Bug #16865)</li>
|
||||||
|
<li>[Fix] Correctly check empty subjects/messages (Bug #17915)</li>
|
||||||
|
<li>[Change] Do not check usernames against word censor list. Disallowed usernames is already checked and word censor belong to posts. (Bug #17745)</li>
|
||||||
|
<li>[Fix] Additionally include non-postable forums for moderators forums shown within the teams list. (Bug #17265)</li>
|
||||||
|
<li>[Change] Sped up viewforum considerably (also goes towards mcp_forum)</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<a name="v30rc8"></a><h3>1.i. Changes since 3.0.RC8</h3>
|
<a name="v30rc8"></a><h3>1.i. Changes since 3.0.RC8</h3>
|
||||||
|
|
|
@ -146,8 +146,8 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
|
||||||
$read_tracking_join = $read_tracking_select = '';
|
$read_tracking_join = $read_tracking_select = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT t.*$read_tracking_select
|
$sql = "SELECT t.topic_id
|
||||||
FROM " . TOPICS_TABLE . " t $read_tracking_join
|
FROM " . TOPICS_TABLE . " t
|
||||||
WHERE t.forum_id IN($forum_id, 0)
|
WHERE t.forum_id IN($forum_id, 0)
|
||||||
" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . "
|
" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . "
|
||||||
$limit_time_sql
|
$limit_time_sql
|
||||||
|
@ -155,10 +155,21 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
|
||||||
$result = $db->sql_query_limit($sql, $topics_per_page, $start);
|
$result = $db->sql_query_limit($sql, $topics_per_page, $start);
|
||||||
|
|
||||||
$topic_list = $topic_tracking_info = array();
|
$topic_list = $topic_tracking_info = array();
|
||||||
|
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$topic_list[] = $row['topic_id'];
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$sql = "SELECT t.*$read_tracking_select
|
||||||
|
FROM " . TOPICS_TABLE . " t $read_tracking_join
|
||||||
|
WHERE " . $db->sql_in_set('t.topic_id', $topic_list);
|
||||||
|
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$topic_rows[$row['topic_id']] = $row;
|
$topic_rows[$row['topic_id']] = $row;
|
||||||
$topic_list[] = $row['topic_id'];
|
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
@ -181,10 +192,12 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($topic_rows as $topic_id => $row)
|
foreach ($topic_list as $topic_id)
|
||||||
{
|
{
|
||||||
$topic_title = '';
|
$topic_title = '';
|
||||||
|
|
||||||
|
$row = &$topic_rows[$topic_id];
|
||||||
|
|
||||||
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
|
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
|
||||||
|
|
||||||
if ($row['topic_status'] == ITEM_MOVED)
|
if ($row['topic_status'] == ITEM_MOVED)
|
||||||
|
|
|
@ -408,39 +408,54 @@ else
|
||||||
$sql_where = (sizeof($get_forum_ids)) ? $db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id;
|
$sql_where = (sizeof($get_forum_ids)) ? $db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SQL array for obtaining topics/stickies
|
// Grab just the sorted topic ids
|
||||||
$sql_array = array(
|
$sql = 'SELECT t.topic_id
|
||||||
'SELECT' => $sql_array['SELECT'],
|
FROM ' . TOPICS_TABLE . " t
|
||||||
'FROM' => $sql_array['FROM'],
|
WHERE $sql_where
|
||||||
'LEFT_JOIN' => $sql_array['LEFT_JOIN'],
|
AND t.topic_type IN (" . POST_NORMAL . ', ' . POST_STICKY . ")
|
||||||
|
|
||||||
'WHERE' => $sql_where . '
|
|
||||||
AND t.topic_type IN (' . POST_NORMAL . ', ' . POST_STICKY . ")
|
|
||||||
$sql_approved
|
$sql_approved
|
||||||
$sql_limit_time",
|
$sql_limit_time
|
||||||
|
ORDER BY t.topic_type " . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order;
|
||||||
'ORDER_BY' => 't.topic_type ' . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order,
|
|
||||||
);
|
|
||||||
|
|
||||||
// If store_reverse, then first obtain topics, then stickies, else the other way around...
|
|
||||||
// Funnily enough you typically save one query if going from the last page to the middle (store_reverse) because
|
|
||||||
// the number of stickies are not known
|
|
||||||
$sql = $db->sql_build_query('SELECT', $sql_array);
|
|
||||||
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
|
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
|
||||||
|
|
||||||
$shadow_topic_list = array();
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if ($row['topic_status'] == ITEM_MOVED)
|
$topic_list[] = (int) $row['topic_id'];
|
||||||
{
|
|
||||||
$shadow_topic_list[$row['topic_moved_id']] = $row['topic_id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$rowset[$row['topic_id']] = $row;
|
|
||||||
$topic_list[] = $row['topic_id'];
|
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
// For storing shadow topics
|
||||||
|
$shadow_topic_list = array();
|
||||||
|
|
||||||
|
if (sizeof($topic_list))
|
||||||
|
{
|
||||||
|
// SQL array for obtaining topics/stickies
|
||||||
|
$sql_array = array(
|
||||||
|
'SELECT' => $sql_array['SELECT'],
|
||||||
|
'FROM' => $sql_array['FROM'],
|
||||||
|
'LEFT_JOIN' => $sql_array['LEFT_JOIN'],
|
||||||
|
|
||||||
|
'WHERE' => $db->sql_in_set('t.topic_id', $topic_list),
|
||||||
|
);
|
||||||
|
|
||||||
|
// If store_reverse, then first obtain topics, then stickies, else the other way around...
|
||||||
|
// Funnily enough you typically save one query if going from the last page to the middle (store_reverse) because
|
||||||
|
// the number of stickies are not known
|
||||||
|
$sql = $db->sql_build_query('SELECT', $sql_array);
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
if ($row['topic_status'] == ITEM_MOVED)
|
||||||
|
{
|
||||||
|
$shadow_topic_list[$row['topic_moved_id']] = $row['topic_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowset[$row['topic_id']] = $row;
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
}
|
||||||
|
|
||||||
// If we have some shadow topics, update the rowset to reflect their topic information
|
// If we have some shadow topics, update the rowset to reflect their topic information
|
||||||
if (sizeof($shadow_topic_list))
|
if (sizeof($shadow_topic_list))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue