]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/OStatusPlugin.php
Merge branch 'master' of git.gnu.io:gnu/gnu-social into nightly
[quix0rs-gnu-social.git] / plugins / OStatus / OStatusPlugin.php
index 5a871f322b1ac27cdb5b9beb722f7397e0b1e627..e8a3c2d66663c58a40c56a511535a94916bc209d 100644 (file)
@@ -118,6 +118,9 @@ class OStatusPlugin extends Plugin
 
         // Incoming from a foreign PuSH hub
         $qm->connect('pushin', 'PushInQueueHandler');
+
+        // Re-subscribe feeds that need renewal
+        $qm->connect('pushrenew', 'PushRenewQueueHandler');
         return true;
     }
 
@@ -1396,4 +1399,20 @@ class OStatusPlugin extends Plugin
         // Since we completed the salmon slap, we discontinue the event
         return false;
     }
+
+    public function onCronDaily()
+    {
+        try {
+            $sub = FeedSub::renewalCheck();
+        } catch (NoResultException $e) {
+            common_log(LOG_INFO, "There were no expiring feeds.");
+            return;
+        }
+
+        $qm = QueueManager::get();
+        while ($sub->fetch()) {
+            $item = array('feedsub_id' => $sub->id);
+            $qm->enqueue($item, 'pushrenew');
+        }
+    }
 }