mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-08 01:36:57 +02:00
These changes should let olympus scale a little bit better.
i haven't adjusted the schemas but added the details to create_schema_files - david is able to build them then in line with his changes. :) git-svn-id: file:///svn/phpbb/trunk@6411 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -191,7 +191,7 @@ function mcp_resync_topics($topic_ids)
|
||||
|
||||
$redirect = request_var('redirect', $user->data['session_page']);
|
||||
|
||||
meta_refresh(2, $redirect);
|
||||
meta_refresh(3, $redirect);
|
||||
trigger_error($msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
|
||||
|
||||
return;
|
||||
|
@@ -89,7 +89,7 @@ function mcp_post_details($id, $mode, $action)
|
||||
}
|
||||
|
||||
// Set some vars
|
||||
$users_ary = array();
|
||||
$users_ary = $usernames_ary = array();
|
||||
$post_id = $post_info['post_id'];
|
||||
$poster = ($post_info['user_colour']) ? '<span style="color:#' . $post_info['user_colour'] . '">' . $post_info['username'] . '</span>' : $post_info['username'];
|
||||
|
||||
@@ -217,69 +217,83 @@ function mcp_post_details($id, $mode, $action)
|
||||
}
|
||||
|
||||
// Get other users who've posted under this IP
|
||||
$sql = 'SELECT poster_id, COUNT(poster_id) as postings
|
||||
FROM ' . POSTS_TABLE . "
|
||||
WHERE poster_ip = '" . $db->sql_escape($post_info['poster_ip']) . "'
|
||||
GROUP BY poster_id";
|
||||
|
||||
// Firebird does not support ORDER BY on aliased columns
|
||||
// MySQL does not support ORDER BY on functions
|
||||
switch (SQL_LAYER)
|
||||
{
|
||||
case 'firebird':
|
||||
$sql = 'SELECT u.user_id, u.username, COUNT(*) as postings
|
||||
FROM ' . USERS_TABLE . ' u, ' . POSTS_TABLE . " p
|
||||
WHERE p.poster_id = u.user_id
|
||||
AND p.poster_ip = '" . $db->sql_escape($post_info['poster_ip']) . "'
|
||||
AND p.poster_id <> {$post_info['user_id']}
|
||||
GROUP BY u.user_id, u.username
|
||||
ORDER BY COUNT(*) DESC";
|
||||
$sql .= ' ORDER BY COUNT(poster_id) DESC';
|
||||
break;
|
||||
|
||||
default:
|
||||
$sql = 'SELECT u.user_id, u.username, COUNT(*) as postings
|
||||
FROM ' . USERS_TABLE . ' u, ' . POSTS_TABLE . " p
|
||||
WHERE p.poster_id = u.user_id
|
||||
AND p.poster_ip = '" . $db->sql_escape($post_info['poster_ip']) . "'
|
||||
AND p.poster_id <> {$post_info['user_id']}
|
||||
GROUP BY u.user_id, u.username
|
||||
ORDER BY postings DESC";
|
||||
$sql .= ' ORDER BY postings DESC';
|
||||
break;
|
||||
}
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
// Fill the user select list with users who have posted
|
||||
// under this IP
|
||||
if ($row['user_id'] != $post_info['poster_id'])
|
||||
// Fill the user select list with users who have posted under this IP
|
||||
if ($row['poster_id'] != $post_info['poster_id'])
|
||||
{
|
||||
$users_ary[strtolower($row['username'])] = $row;
|
||||
$users_ary[$row['poster_id']] = $row;
|
||||
}
|
||||
|
||||
$template->assign_block_vars('userrow', array(
|
||||
'USERNAME' => ($row['user_id'] == ANONYMOUS) ? $user->lang['GUEST'] : $row['username'],
|
||||
'NUM_POSTS' => $row['postings'],
|
||||
'L_POST_S' => ($row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'],
|
||||
|
||||
'U_PROFILE' => ($row['user_id'] == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']),
|
||||
'U_SEARCHPOSTS' => append_sid("{$phpbb_root_path}search.$phpEx", 'author=' . urlencode($row['username']) . '&sr=topics'))
|
||||
);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (sizeof($users_ary))
|
||||
{
|
||||
// Get the usernames
|
||||
$sql = 'SELECT user_id, username
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('user_id', array_keys($users_ary));
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$users_ary[$row['user_id']]['username'] = strtolower($row['username']);
|
||||
$usernames_ary[strtolower($row['username'])] = $users_ary[$row['user_id']];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
foreach ($users_ary as $user_id => $user_row)
|
||||
{
|
||||
$template->assign_block_vars('userrow', array(
|
||||
'USERNAME' => ($user_id == ANONYMOUS) ? $user->lang['GUEST'] : $user_row['username'],
|
||||
'NUM_POSTS' => $user_row['postings'],
|
||||
'L_POST_S' => ($user_row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'],
|
||||
|
||||
'U_PROFILE' => ($user_id == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $user_id),
|
||||
'U_SEARCHPOSTS' => append_sid("{$phpbb_root_path}search.$phpEx", 'author=' . urlencode($user_row['username']) . '&sr=topics'))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Get other IP's this user has posted under
|
||||
|
||||
// A compound index on poster_id, poster_ip (posts table) would help speed up this query a lot,
|
||||
// but the extra size is only valuable if there are persons having more than a thousands posts.
|
||||
// This is better left to the really really big forums.
|
||||
|
||||
// Firebird does not support ORDER BY on aliased columns
|
||||
// MySQL does not support ORDER BY on functions
|
||||
switch (SQL_LAYER)
|
||||
{
|
||||
case 'firebird':
|
||||
$sql = 'SELECT poster_ip, COUNT(*) AS postings
|
||||
$sql = 'SELECT poster_ip, COUNT(poster_ip) AS postings
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE poster_id = ' . $post_info['poster_id'] . '
|
||||
GROUP BY poster_ip
|
||||
ORDER BY COUNT(*) DESC';
|
||||
ORDER BY COUNT(poster_ip) DESC';
|
||||
break;
|
||||
|
||||
default:
|
||||
$sql = 'SELECT poster_ip, COUNT(*) AS postings
|
||||
$sql = 'SELECT poster_ip, COUNT(poster_ip) AS postings
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE poster_id = ' . $post_info['poster_id'] . '
|
||||
GROUP BY poster_ip
|
||||
@@ -305,12 +319,17 @@ function mcp_post_details($id, $mode, $action)
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$user_select = '';
|
||||
ksort($users_ary);
|
||||
|
||||
foreach ($users_ary as $row)
|
||||
if (sizeof($usernames_ary))
|
||||
{
|
||||
$user_select .= '<option value="' . $row['user_id'] . '">' . $row['username'] . "</option>\n";
|
||||
ksort($usernames_ary);
|
||||
|
||||
foreach ($usernames_ary as $row)
|
||||
{
|
||||
$user_select .= '<option value="' . $row['poster_id'] . '">' . $row['username'] . "</option>\n";
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_var('S_USER_SELECT', $user_select);
|
||||
}
|
||||
|
||||
|
@@ -286,8 +286,8 @@ class mcp_queue
|
||||
{
|
||||
$sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_title AS post_subject, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_first_poster_name AS username
|
||||
FROM ' . TOPICS_TABLE . " t
|
||||
WHERE topic_approved = 0
|
||||
AND forum_id IN (0, $forum_list)
|
||||
WHERE forum_id IN (0, $forum_list)
|
||||
AND topic_approved = 0
|
||||
$limit_time_sql
|
||||
ORDER BY $sort_order_sql";
|
||||
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
|
||||
@@ -412,6 +412,8 @@ function approve_post($post_id_list, $mode)
|
||||
$total_topics = $total_posts = $forum_topics = $forum_posts = 0;
|
||||
$topic_approve_sql = $topic_replies_sql = $post_approve_sql = $topic_id_list = array();
|
||||
|
||||
$update_forum_information = false;
|
||||
|
||||
foreach ($post_info as $post_id => $post_data)
|
||||
{
|
||||
$topic_id_list[$post_data['topic_id']] = 1;
|
||||
@@ -446,6 +448,12 @@ function approve_post($post_id_list, $mode)
|
||||
}
|
||||
|
||||
$post_approve_sql[] = $post_id;
|
||||
|
||||
// If the post is newer than the last post information stored we need to update the forum information
|
||||
if ($post_data['post_time'] >= $post_data['forum_last_post_time'])
|
||||
{
|
||||
$update_forum_information = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof($topic_approve_sql))
|
||||
@@ -499,7 +507,11 @@ function approve_post($post_id_list, $mode)
|
||||
unset($topic_approve_sql, $topic_replies_sql, $post_approve_sql);
|
||||
|
||||
update_post_information('topic', array_keys($topic_id_list));
|
||||
update_post_information('forum', $forum_id);
|
||||
|
||||
if ($update_forum_information)
|
||||
{
|
||||
update_post_information('forum', $forum_id);
|
||||
}
|
||||
unset($topic_id_list);
|
||||
|
||||
$messenger = new messenger();
|
||||
|
Reference in New Issue
Block a user