mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
- pretty sweet speed increase
git-svn-id: file:///svn/phpbb/trunk@7097 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
d591e0bf44
commit
4e423d9907
1 changed files with 85 additions and 64 deletions
|
@ -871,7 +871,7 @@ switch ($mode)
|
||||||
|
|
||||||
// Additional sorting options for user search ... if search is enabled, if not
|
// Additional sorting options for user search ... if search is enabled, if not
|
||||||
// then only admins can make use of this (for ACP functionality)
|
// then only admins can make use of this (for ACP functionality)
|
||||||
$sql_select = $sql_from = $sql_where = $order_by = '';
|
$sql_select = $sql_where_data = $sql_from = $sql_where = $order_by = '';
|
||||||
|
|
||||||
$form = request_var('form', '');
|
$form = request_var('form', '');
|
||||||
$field = request_var('field', '');
|
$field = request_var('field', '');
|
||||||
|
@ -1112,6 +1112,7 @@ switch ($mode)
|
||||||
$order_by = 'ug.group_leader DESC, ';
|
$order_by = 'ug.group_leader DESC, ';
|
||||||
|
|
||||||
$sql_where .= " AND ug.user_pending = 0 AND u.user_id = ug.user_id AND ug.group_id = $group_id";
|
$sql_where .= " AND ug.user_pending = 0 AND u.user_id = ug.user_id AND ug.group_id = $group_id";
|
||||||
|
$sql_where_data = ' AND u.user_id = ug.user_id';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sorting and order
|
// Sorting and order
|
||||||
|
@ -1224,10 +1225,29 @@ switch ($mode)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get us some users :D
|
||||||
|
$sql = "SELECT u.user_id
|
||||||
|
FROM " . USERS_TABLE . " u
|
||||||
|
$sql_from
|
||||||
|
WHERE u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ")
|
||||||
|
$sql_where";
|
||||||
|
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
|
||||||
|
|
||||||
|
$user_list = array();
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$user_list[] = (int) $row['user_id'];
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
// So, did we get any users?
|
||||||
|
if (sizeof($user_list))
|
||||||
|
{
|
||||||
|
// Session time?! Session time...
|
||||||
$sql = 'SELECT session_user_id, MAX(session_time) AS session_time
|
$sql = 'SELECT session_user_id, MAX(session_time) AS session_time
|
||||||
FROM ' . SESSIONS_TABLE . '
|
FROM ' . SESSIONS_TABLE . '
|
||||||
WHERE session_time >= ' . (time() - $config['session_length']) . '
|
WHERE session_time >= ' . (time() - $config['session_length']) . '
|
||||||
AND session_user_id <> ' . ANONYMOUS . '
|
AND ' . $db->sql_in_set('session_user_id', $user_list) . '
|
||||||
GROUP BY session_user_id';
|
GROUP BY session_user_id';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
@ -1243,10 +1263,10 @@ switch ($mode)
|
||||||
$sql_select
|
$sql_select
|
||||||
FROM " . USERS_TABLE . " u
|
FROM " . USERS_TABLE . " u
|
||||||
$sql_from
|
$sql_from
|
||||||
WHERE u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ")
|
WHERE " . $db->sql_in_set('u.user_id', $user_list) . "
|
||||||
$sql_where
|
$sql_where_data
|
||||||
ORDER BY $order_by";
|
ORDER BY $order_by";
|
||||||
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$id_cache = array();
|
$id_cache = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
@ -1265,7 +1285,7 @@ switch ($mode)
|
||||||
$cp = new custom_profile();
|
$cp = new custom_profile();
|
||||||
|
|
||||||
// Grab all profile fields from users in id cache for later use - similar to the poster cache
|
// Grab all profile fields from users in id cache for later use - similar to the poster cache
|
||||||
$profile_fields_cache = $cp->generate_profile_fields_template('grab', array_keys($id_cache));
|
$profile_fields_cache = $cp->generate_profile_fields_template('grab', $user_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we sort by last active date we need to adjust the id cache due to user_lastvisit not being the last active date...
|
// If we sort by last active date we need to adjust the id cache due to user_lastvisit not being the last active date...
|
||||||
|
@ -1311,6 +1331,7 @@ switch ($mode)
|
||||||
$i++;
|
$i++;
|
||||||
unset($id_cache[$user_id]);
|
unset($id_cache[$user_id]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Generate page
|
// Generate page
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
|
|
Loading…
Add table
Reference in a new issue