3 include_once('aur.inc.php');
5 function updates_table($dbh)
7 $key = 'recent_updates';
8 if(!($newest_packages = get_cache_value($key))) {
9 $q = 'SELECT * FROM Packages ORDER BY ModifiedTS DESC LIMIT 10';
10 $result = db_query($q, $dbh);
12 $newest_packages = new ArrayObject();
13 while ($row = mysql_fetch_assoc($result)) {
14 $newest_packages->append($row);
16 set_cache_value($key, $newest_packages);
18 include('stats/updates_table.php');
21 function user_table($user, $dbh)
23 $escuser = mysql_real_escape_string($user);
24 $base_q = "SELECT count(*) FROM Packages,Users WHERE Packages.MaintainerUID = Users.ID AND Users.Username='" . $escuser . "'";
26 $maintainer_unsupported_count = db_cache_value($base_q, $dbh,
27 'user_unsupported_count:' . $escuser);
29 $q = "SELECT count(*) FROM Packages,Users WHERE Packages.OutOfDateTS IS NOT NULL AND Packages.MaintainerUID = Users.ID AND Users.Username='" . $escuser . "'";
31 $flagged_outdated = db_cache_value($q, $dbh,
32 'user_flagged_outdated:' . $escuser);
34 # If the user is a TU calculate the number of the packages
35 $atype = account_from_sid($_COOKIE["AURSID"]);
37 include('stats/user_table.php');
40 function general_stats_table($dbh)
43 $q = "SELECT count(*) FROM Packages";
44 $unsupported_count = db_cache_value($q, $dbh, 'unsupported_count');
46 $q = "SELECT count(*) FROM Packages WHERE MaintainerUID IS NULL";
47 $orphan_count = db_cache_value($q, $dbh, 'orphan_count');
49 $q = "SELECT count(*) FROM Users";
50 $user_count = db_cache_value($q, $dbh, 'user_count');
52 $q = "SELECT count(*) FROM Users,AccountTypes WHERE Users.AccountTypeID = AccountTypes.ID AND AccountTypes.AccountType = 'Trusted User'";
53 $tu_count = db_cache_value($q, $dbh, 'tu_count');
55 $targstamp = intval(strtotime("-7 days"));
56 $yearstamp = intval(strtotime("-1 year"));
58 $q = "SELECT count(*) FROM Packages WHERE Packages.ModifiedTS >= $targstamp AND Packages.ModifiedTS = Packages.SubmittedTS";
59 $add_count = db_cache_value($q, $dbh, 'add_count');
61 $q = "SELECT count(*) FROM Packages WHERE Packages.ModifiedTS >= $targstamp AND Packages.ModifiedTS != Packages.SubmittedTS";
62 $update_count = db_cache_value($q, $dbh, 'update_count');
64 $q = "SELECT count(*) FROM Packages WHERE Packages.ModifiedTS >= $yearstamp AND Packages.ModifiedTS != Packages.SubmittedTS";
65 $update_year_count = db_cache_value($q, $dbh, 'update_year_count');
67 $q = "SELECT count(*) FROM Packages WHERE Packages.ModifiedTS = Packages.SubmittedTS";
68 $never_update_count = db_cache_value($q, $dbh, 'never_update_count');
70 include('stats/general_stats_table.php');