From eda713032ce9bed773b6c927b2f6ac4b445fe577 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Wed, 6 Oct 2010 04:25:53 +0200 Subject: Add timestamp when a package is flagged out-of-date (FS#20848). Signed-off-by: Loui Chang - resolve conflict and omit i18n changes. --- web/lib/aurjson.class.php | 2 +- web/lib/pkgfuncs.inc | 13 +++++++++---- web/lib/stats.inc | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'web/lib') diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php index a5b3f9e..ab1bdbf 100644 --- a/web/lib/aurjson.class.php +++ b/web/lib/aurjson.class.php @@ -21,7 +21,7 @@ class AurJSON { private $exposed_methods = array('search','info','msearch'); private $fields = array('Packages.ID','Name','Version','CategoryID', 'Description', 'LocationID', 'URL','URLPath','License','NumVotes', - 'OutOfDate'); + '(OutOfDateTS IS NOT NULL) AS OutOfDate'); /** * Handles post data, and routes the request. diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index 5605daa..0f45124 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -457,7 +457,7 @@ function pkg_search_page($SID="") { PackageCategories.Category, PackageLocations.Location, Packages.Name, Packages.Version, Packages.Description, Packages.NumVotes, - Packages.ID, Packages.OutOfDate + Packages.ID, Packages.OutOfDateTS FROM Packages LEFT JOIN Users ON (Packages.MaintainerUID = Users.ID) "; @@ -510,7 +510,7 @@ function pkg_search_page($SID="") { } if (isset($_GET['outdated'])) { - $q .= "AND OutOfDate = 1 "; + $q .= "AND OutOfDateTS IS NOT NULL "; } $order = $_GET["SO"] == 'd' ? 'DESC' : 'ASC'; @@ -642,8 +642,13 @@ function pkg_flag ($atype, $ids, $action = True) { } } - $ood = $action ? 1 : 0; - $q = "UPDATE Packages SET OutOfDate = " . $ood; + $q = "UPDATE Packages SET"; + if ($action) { + $q.= " OutOfDateTS = UNIX_TIMESTAMP()"; + } + else { + $q.= " OutOfDateTS = NULL"; + } $q.= " WHERE ID IN (" . $flag . ")"; db_query($q, $dbh); diff --git a/web/lib/stats.inc b/web/lib/stats.inc index 85c7e28..6a76558 100644 --- a/web/lib/stats.inc +++ b/web/lib/stats.inc @@ -59,7 +59,7 @@ function user_table($user, $dbh) $maintainer_unsupported_count = db_cache_value(sprintf($base_q, 'unsupported'), $dbh, $apc_prefix . 'user_unsupported_count:' . $escuser); - $q = "SELECT count(*) FROM Packages,Users WHERE Packages.OutOfDate = 1 AND Packages.MaintainerUID = Users.ID AND Users.Username='" . $escuser . "'"; + $q = "SELECT count(*) FROM Packages,Users WHERE Packages.OutOfDateTS IS NOT NULL AND Packages.MaintainerUID = Users.ID AND Users.Username='" . $escuser . "'"; $flagged_outdated = db_cache_value($q, $dbh, $apc_prefix . 'user_flagged_outdated:' . $escuser); -- cgit v1.2.3-70-g09d2