aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjocuri%softhome.net <>2004-02-27 19:18:45 +0000
committerjocuri%softhome.net <>2004-02-27 19:18:45 +0000
commita9f2317f92af527b28fe648777bacf164ac029f9 (patch)
tree9de46f0bac50849ca101da842abaea021f5337d4 /buglist.cgi
parentPatch for bug 235268: Convert show_activity.cgi to get rid of %FORM; r=jouni;... (diff)
downloadbugzilla-a9f2317f92af527b28fe648777bacf164ac029f9.tar.gz
bugzilla-a9f2317f92af527b28fe648777bacf164ac029f9.tar.bz2
bugzilla-a9f2317f92af527b28fe648777bacf164ac029f9.zip
Patch for bug 192247: make Bugzilla quips truly random; code by Bill McGonigle <bill+mozilla@zettabyte.net>; r=bbaetz, justdave, a=justdave.
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-xbuglist.cgi8
1 files changed, 7 insertions, 1 deletions
diff --git a/buglist.cgi b/buglist.cgi
index ab7373e06..d1a3c665b 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -199,7 +199,13 @@ sub GetQuip {
my $quip;
- SendSQL("SELECT quip FROM quips WHERE approved = 1 ORDER BY RAND() LIMIT 1");
+ # COUNT is quick because it is cached for MySQL. We may want to revisit
+ # this when we support other databases.
+
+ SendSQL("SELECT COUNT(quip) FROM quips WHERE approved = 1");
+ my $count = FetchOneColumn();
+ my $random = int(rand($count));
+ SendSQL("SELECT quip FROM quips WHERE approved = 1 LIMIT $random,1");
if (MoreSQLData()) {
($quip) = FetchSQLData();