Commit a9f2317f authored by jocuri%softhome.net's avatar jocuri%softhome.net

Patch for bug 192247: make Bugzilla quips truly random; code by Bill McGonigle…

Patch for bug 192247: make Bugzilla quips truly random; code by Bill McGonigle <bill+mozilla@zettabyte.net>; r=bbaetz, justdave, a=justdave.
parent 6161333b
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment