mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
user_table optimization
Rather than looking up by username, it makes more sense to look the stats up by user ID to reduce the number of needed joins. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
e9d8e9b8c0
commit
97085daadc
2 changed files with 7 additions and 8 deletions
|
@ -58,8 +58,8 @@ echo __(
|
||||||
<td class='boxSoft' valign='top'>
|
<td class='boxSoft' valign='top'>
|
||||||
<?php
|
<?php
|
||||||
if (!empty($_COOKIE["AURSID"])) {
|
if (!empty($_COOKIE["AURSID"])) {
|
||||||
$user = username_from_sid($_COOKIE["AURSID"]);
|
$userid = uid_from_sid($_COOKIE["AURSID"]);
|
||||||
user_table($user, $dbh);
|
user_table($userid, $dbh);
|
||||||
echo '<br />';
|
echo '<br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,17 +17,16 @@ function updates_table($dbh) {
|
||||||
include('stats/updates_table.php');
|
include('stats/updates_table.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
function user_table($user, $dbh) {
|
function user_table($userid, $dbh) {
|
||||||
$escuser = db_escape_string($user);
|
$base_q = "SELECT count(*) FROM Packages WHERE Packages.MaintainerUID = " . $userid;
|
||||||
$base_q = "SELECT count(*) FROM Packages,Users WHERE Packages.MaintainerUID = Users.ID AND Users.Username='" . $escuser . "'";
|
|
||||||
|
|
||||||
$maintainer_unsupported_count = db_cache_value($base_q, $dbh,
|
$maintainer_unsupported_count = db_cache_value($base_q, $dbh,
|
||||||
'user_unsupported_count:' . $escuser);
|
'user_unsupported_count:' . $userid);
|
||||||
|
|
||||||
$q = "SELECT count(*) FROM Packages,Users WHERE Packages.OutOfDateTS IS NOT NULL AND Packages.MaintainerUID = Users.ID AND Users.Username='" . $escuser . "'";
|
$q = "SELECT count(*) FROM Packages WHERE Packages.OutOfDateTS IS NOT NULL AND Packages.MaintainerUID = " . $userid;
|
||||||
|
|
||||||
$flagged_outdated = db_cache_value($q, $dbh,
|
$flagged_outdated = db_cache_value($q, $dbh,
|
||||||
'user_flagged_outdated:' . $escuser);
|
'user_flagged_outdated:' . $userid);
|
||||||
|
|
||||||
# If the user is a TU calculate the number of the packages
|
# If the user is a TU calculate the number of the packages
|
||||||
$atype = account_from_sid($_COOKIE["AURSID"]);
|
$atype = account_from_sid($_COOKIE["AURSID"]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue