diff options
author | Dan McGee <dan@archlinux.org> | 2011-03-30 20:48:08 -0500 |
---|---|---|
committer | Lukas Fleischer <archlinux@cryptocrack.de> | 2011-04-03 22:59:31 +0200 |
commit | 1f252eba64acf18719bd514a7a4464ca18f4c1cb (patch) | |
tree | 0188122c8dc5bf939054ba4c3997fd6ef217b2b4 /web/lib | |
parent | 1128489bd0e89694dd4d88ff69bab7c8d45d972a (diff) | |
download | aurweb-1f252eba64acf18719bd514a7a4464ca18f4c1cb.tar.xz |
Always set ModifiedTS including new packages
Set it equal to the SubmittedTS field, which will be our indication the
package is new when we show the logo on the front page of the AUR.
This results in the ability to remove the use of the unindexable
GREATEST() function from the AUR code everywhere we had to use it before
to handle the 0 timestamp case.
Note that there is no race condition here in calling UNIX_TIMESTAMP()
twice- it always returns the time at the beginning of statment
execution:
mysql> select unix_timestamp(), sleep(2), unix_timestamp();
+------------------+----------+------------------+
| unix_timestamp() | sleep(2) | unix_timestamp() |
+------------------+----------+------------------+
| 1300851746 | 0 | 1300851746 |
+------------------+----------+------------------+
1 row in set (2.00 sec)
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib')
-rw-r--r-- | web/lib/pkgfuncs.inc | 2 | ||||
-rw-r--r-- | web/lib/stats.inc | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index b38c7da..699a3a9 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -525,7 +525,7 @@ function pkg_search_page($SID="") { $q_sort = "ORDER BY Maintainer ".$order.", Name ASC "; break; case 'a': - $q_sort = "ORDER BY GREATEST(SubmittedTS,ModifiedTS) ".$order.", Name ASC "; + $q_sort = "ORDER BY ModifiedTS ".$order.", Name ASC "; break; default: break; diff --git a/web/lib/stats.inc b/web/lib/stats.inc index f42e417..f924fb5 100644 --- a/web/lib/stats.inc +++ b/web/lib/stats.inc @@ -36,7 +36,7 @@ function updates_table($dbh) global $apc_prefix, $apc_ttl; $key = $apc_prefix . 'recent_updates'; if(!(EXTENSION_LOADED_APC && ($newest_packages = apc_fetch($key)))) { - $q = 'SELECT * FROM Packages WHERE DummyPkg != 1 ORDER BY GREATEST(SubmittedTS,ModifiedTS) DESC LIMIT 0 , 10'; + $q = 'SELECT * FROM Packages WHERE DummyPkg != 1 ORDER BY ModifiedTS DESC LIMIT 0 , 10'; $result = db_query($q, $dbh); $newest_packages = new ArrayObject(); @@ -84,7 +84,7 @@ function general_stats_table($dbh) $tu_count = db_cache_value($q, $dbh, $apc_prefix . 'tu_count'); $targstamp = intval(strtotime("-7 days")); - $q = "SELECT count(*) from Packages WHERE (Packages.SubmittedTS >= $targstamp OR Packages.ModifiedTS >= $targstamp)"; + $q = "SELECT count(*) from Packages WHERE Packages.ModifiedTS >= $targstamp"; $update_count = db_cache_value($q, $dbh, $apc_prefix . 'update_count'); include('stats/general_stats_table.php'); |