diff options
author | DM42.Net (Matt Dent) <dentm42@dm42.net> | 2019-01-10 15:29:24 -0500 |
---|---|---|
committer | DM42.Net (Matt Dent) <dentm42@dm42.net> | 2019-01-10 15:29:24 -0500 |
commit | 6791b05a4032a076651f7c8e4790614f0f405a55 (patch) | |
tree | 433a39189e04457a38dc0a8b879561d6387a811e /Zotlabs/Daemon/Queue.php | |
parent | b54ddccd7beece51d78b21b4ba9e98c908fec4c5 (diff) | |
download | volse-hubzilla-6791b05a4032a076651f7c8e4790614f0f405a55.tar.gz volse-hubzilla-6791b05a4032a076651f7c8e4790614f0f405a55.tar.bz2 volse-hubzilla-6791b05a4032a076651f7c8e4790614f0f405a55.zip |
Fix for PGSQL/MYSQL difference
Diffstat (limited to 'Zotlabs/Daemon/Queue.php')
-rw-r--r-- | Zotlabs/Daemon/Queue.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Zotlabs/Daemon/Queue.php b/Zotlabs/Daemon/Queue.php index e041804f0..6b525b8c3 100644 --- a/Zotlabs/Daemon/Queue.php +++ b/Zotlabs/Daemon/Queue.php @@ -12,6 +12,15 @@ class Queue { require_once('include/items.php'); require_once('include/bbcode.php'); + switch (DBTYPE_ACTIVE) { + case DBTYPE_MYSQL: + $sqlrandfunc = "RAND()"; + break; + + case DBTYPE_POSTGRESQL: + $sqlrandfunc = "RANDOM()"; + break; + } if($argc > 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 // 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() ); while ($r) { foreach($r as $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() ); } |