forked from GithubBackups/vichan
Thanks to Bill Karwin on SO (http://stackoverflow.com/a/23703118/1901658), speed up ?/users dramatically
This commit is contained in:
parent
da4a310d3f
commit
8cdd807af7
@ -1859,11 +1859,18 @@ function mod_users() {
|
|||||||
if (!hasPermission($config['mod']['manageusers']))
|
if (!hasPermission($config['mod']['manageusers']))
|
||||||
error($config['error']['noaccess']);
|
error($config['error']['noaccess']);
|
||||||
|
|
||||||
$query = query("SELECT
|
$query = query("SELECT ``m``.`id`, ``m``.`username`, ``m``.`boards`, ``m``.`type`,
|
||||||
*,
|
``ml``.`time` last, ``ml``.`text` action
|
||||||
(SELECT `time` FROM ``modlogs`` WHERE `mod` = `id` ORDER BY `time` DESC LIMIT 1) AS `last`,
|
FROM ``mods`` AS m
|
||||||
(SELECT `text` FROM ``modlogs`` WHERE `mod` = `id` ORDER BY `time` DESC LIMIT 1) AS `action`
|
LEFT JOIN (
|
||||||
FROM ``mods`` ORDER BY `type` DESC,`id`") or error(db_error());
|
SELECT ml1.*
|
||||||
|
FROM ``modlogs`` AS ml1
|
||||||
|
JOIN (
|
||||||
|
SELECT `mod`, MAX(time) AS time
|
||||||
|
FROM ``modlogs``
|
||||||
|
GROUP BY `mod`
|
||||||
|
) AS ml2 USING (`mod`, time)
|
||||||
|
) AS ml ON m.id = ml.`mod`;") or error(db_error());
|
||||||
$users = $query->fetchAll(PDO::FETCH_ASSOC);
|
$users = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
foreach ($users as &$user) {
|
foreach ($users as &$user) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user