1) ? $argv[1] : ''; logger('queue: start'); // delete all queue items more than 3 days old // but first mark these sites dead if we haven't heard from them in a month $oldqItems = q("select outq_posturl from outq where outq_created < %s - INTERVAL %s", db_utcnow(), db_quoteinterval('3 DAY') ); if ($oldqItems) { foreach ($oldqItems as $qItem) { $h = parse_url($qItem['outq_posturl']); $site_url = $h['scheme'] . '://' . $h['host'] . (($h['port']) ? ':' . $h['port'] : ''); q("update site set site_dead = 1 where site_dead = 0 and site_url = '%s' and site_update < %s - INTERVAL %s", dbesc($site_url), db_utcnow(), db_quoteinterval('1 MONTH') ); } } q("DELETE FROM outq WHERE outq_created < %s - INTERVAL %s", db_utcnow(), db_quoteinterval('3 DAY') ); if ($queue_id) { $qItems = q("SELECT * FROM outq WHERE outq_hash = '%s' LIMIT 1", dbesc($queue_id) ); Zlib\Queue::deliver(array_shift($qItems)); } else { do { $qItems = q( "SELECT * FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s limit 1", db_utcnow() ); if ($qItems) { Zlib\Queue::deliver(array_shift($qItems)); } } while ($qItems); } } }