mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-02-18 03:37:35 +01:00
Thanks to Bill Karwin on SO (http://stackoverflow.com/a/23703118/1901658), speed up ?/users dramatically
This commit is contained in:
parent
bc9309ba2a
commit
8ac012b1c5
@ -1859,11 +1859,18 @@ function mod_users() {
|
||||
if (!hasPermission($config['mod']['manageusers']))
|
||||
error($config['error']['noaccess']);
|
||||
|
||||
$query = query("SELECT
|
||||
*,
|
||||
(SELECT `time` FROM ``modlogs`` WHERE `mod` = `id` ORDER BY `time` DESC LIMIT 1) AS `last`,
|
||||
(SELECT `text` FROM ``modlogs`` WHERE `mod` = `id` ORDER BY `time` DESC LIMIT 1) AS `action`
|
||||
FROM ``mods`` ORDER BY `type` DESC,`id`") or error(db_error());
|
||||
$query = query("SELECT ``m``.`id`, ``m``.`username`, ``m``.`boards`, ``m``.`type`,
|
||||
``ml``.`time` last, ``ml``.`text` action
|
||||
FROM ``mods`` AS m
|
||||
LEFT JOIN (
|
||||
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);
|
||||
|
||||
foreach ($users as &$user) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user