]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Queue_item.php
Don't retry unhandled transports in OpportunisticQM
[quix0rs-gnu-social.git] / classes / Queue_item.php
index 3a7d05adef7249d203a7dee5c24f2c64f39392e2..d41c53e0e068dac5a264030d70eaacd5f388d747 100644 (file)
@@ -40,7 +40,7 @@ class Queue_item extends Managed_DataObject
      * @param mixed $transports name of a single queue or array of queues to pull from
      *                          If not specified, checks all queues in the system.
      */
-    static function top($transports=null) {
+    static function top($transports=null, array $ignored_transports=array()) {
 
         $qi = new Queue_item();
         if ($transports) {
@@ -52,6 +52,11 @@ class Queue_item extends Managed_DataObject
                 $qi->transport = $transports;
             }
         }
+        if (!empty($ignored_transports)) {
+            // @fixme use safer escaping
+            $list = implode("','", array_map(array($qi, 'escape'), $ignored_transports));
+            $qi->whereAdd("transport NOT IN ('$list')");
+        }
         $qi->orderBy('created');
         $qi->whereAdd('claimed is null');