Fix for PGSQL/MYSQL difference
This commit is contained in:
parent
b54ddccd7b
commit
6791b05a40
@ -12,6 +12,15 @@ class Queue {
|
|||||||
require_once('include/items.php');
|
require_once('include/items.php');
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
|
|
||||||
|
switch (DBTYPE_ACTIVE) {
|
||||||
|
case DBTYPE_MYSQL:
|
||||||
|
$sqlrandfunc = "RAND()";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DBTYPE_POSTGRESQL:
|
||||||
|
$sqlrandfunc = "RANDOM()";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if($argc > 1)
|
if($argc > 1)
|
||||||
$queue_id = $argv[1];
|
$queue_id = $argv[1];
|
||||||
@ -62,14 +71,14 @@ class Queue {
|
|||||||
// the site is permanently down, there's no reason to attempt delivery at all, or at most not more than once
|
// the site is permanently down, there's no reason to attempt delivery at all, or at most not more than once
|
||||||
// or twice a day.
|
// or twice a day.
|
||||||
|
|
||||||
$r = q("SELECT *,RAND() as rn FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s order by rn limit 1",
|
$r = q("SELECT *,$sqlrandfunc as rn FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s order by rn limit 1",
|
||||||
db_utcnow()
|
db_utcnow()
|
||||||
);
|
);
|
||||||
while ($r) {
|
while ($r) {
|
||||||
foreach($r as $rv) {
|
foreach($r as $rv) {
|
||||||
queue_deliver($rv);
|
queue_deliver($rv);
|
||||||
}
|
}
|
||||||
$r = q("SELECT *,RAND() as rn FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s order by rn limit 1",
|
$r = q("SELECT *,$sqlrandfunc as rn FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s order by rn limit 1",
|
||||||
db_utcnow()
|
db_utcnow()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user