summaryrefslogtreecommitdiffstats
path: root/web/lib/stats.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'web/lib/stats.inc.php')
-rw-r--r--web/lib/stats.inc.php28
1 files changed, 14 insertions, 14 deletions
diff --git a/web/lib/stats.inc.php b/web/lib/stats.inc.php
index cfae7947..3b7cb8f1 100644
--- a/web/lib/stats.inc.php
+++ b/web/lib/stats.inc.php
@@ -9,7 +9,8 @@ include_once('aur.inc.php');
*
* @return void
*/
-function updates_table($dbh) {
+function updates_table() {
+ $dbh = DB::connect();
$key = 'recent_updates';
if(!($newest_packages = get_cache_value($key))) {
$q = 'SELECT * FROM Packages ORDER BY ModifiedTS DESC LIMIT 10';
@@ -32,16 +33,15 @@ function updates_table($dbh) {
*
* @return void
*/
-function user_table($userid, $dbh) {
+function user_table($userid) {
$base_q = "SELECT count(*) FROM Packages WHERE Packages.MaintainerUID = " . $userid;
- $maintainer_unsupported_count = db_cache_value($base_q, $dbh,
+ $maintainer_unsupported_count = db_cache_value($base_q,
'user_unsupported_count:' . $userid);
$q = "SELECT count(*) FROM Packages WHERE Packages.OutOfDateTS IS NOT NULL AND Packages.MaintainerUID = " . $userid;
- $flagged_outdated = db_cache_value($q, $dbh,
- 'user_flagged_outdated:' . $userid);
+ $flagged_outdated = db_cache_value($q, 'user_flagged_outdated:' . $userid);
include('stats/user_table.php');
}
@@ -53,34 +53,34 @@ function user_table($userid, $dbh) {
*
* @return void
*/
-function general_stats_table($dbh) {
+function general_stats_table() {
# AUR statistics
$q = "SELECT count(*) FROM Packages";
- $unsupported_count = db_cache_value($q, $dbh, 'unsupported_count');
+ $unsupported_count = db_cache_value($q, 'unsupported_count');
$q = "SELECT count(*) FROM Packages WHERE MaintainerUID IS NULL";
- $orphan_count = db_cache_value($q, $dbh, 'orphan_count');
+ $orphan_count = db_cache_value($q, 'orphan_count');
$q = "SELECT count(*) FROM Users";
- $user_count = db_cache_value($q, $dbh, 'user_count');
+ $user_count = db_cache_value($q, 'user_count');
$q = "SELECT count(*) FROM Users,AccountTypes WHERE Users.AccountTypeID = AccountTypes.ID AND AccountTypes.AccountType = 'Trusted User'";
- $tu_count = db_cache_value($q, $dbh, 'tu_count');
+ $tu_count = db_cache_value($q, 'tu_count');
$targstamp = intval(strtotime("-7 days"));
$yearstamp = intval(strtotime("-1 year"));
$q = "SELECT count(*) FROM Packages WHERE Packages.ModifiedTS >= $targstamp AND Packages.ModifiedTS = Packages.SubmittedTS";
- $add_count = db_cache_value($q, $dbh, 'add_count');
+ $add_count = db_cache_value($q, 'add_count');
$q = "SELECT count(*) FROM Packages WHERE Packages.ModifiedTS >= $targstamp AND Packages.ModifiedTS != Packages.SubmittedTS";
- $update_count = db_cache_value($q, $dbh, 'update_count');
+ $update_count = db_cache_value($q, 'update_count');
$q = "SELECT count(*) FROM Packages WHERE Packages.ModifiedTS >= $yearstamp AND Packages.ModifiedTS != Packages.SubmittedTS";
- $update_year_count = db_cache_value($q, $dbh, 'update_year_count');
+ $update_year_count = db_cache_value($q, 'update_year_count');
$q = "SELECT count(*) FROM Packages WHERE Packages.ModifiedTS = Packages.SubmittedTS";
- $never_update_count = db_cache_value($q, $dbh, 'never_update_count');
+ $never_update_count = db_cache_value($q, 'never_update_count');
include('stats/general_stats_table.php');
}