]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/actions/pushcallback.php
Debugging log fix.
[quix0rs-gnu-social.git] / plugins / OStatus / actions / pushcallback.php
index 317398243d7ab0d17aeda546b5063167fb892dcd..f5bb880df9ab8265234ba9cba65dff6b2a26a88a 100644 (file)
@@ -77,7 +77,7 @@ class PushCallbackAction extends Action
     /**
      * Handler for GET verification requests from the hub.
      */
-    function handleGet()
+    public function handleGet()
     {
         $mode = $this->arg('hub_mode');
         $topic = $this->arg('hub_topic');
@@ -110,12 +110,21 @@ class PushCallbackAction extends Action
         }
 
         if ($mode == 'subscribe') {
-            if ($feedsub->sub_state == 'active') {
+            $renewal = ($feedsub->sub_state == 'active');
+            if ($renewal) {
                 common_log(LOG_INFO, __METHOD__ . ': sub update confirmed');
             } else {
                 common_log(LOG_INFO, __METHOD__ . ': sub confirmed');
             }
+
             $feedsub->confirmSubscribe($lease_seconds);
+
+            if (!$renewal) {
+                // Kickstart the feed by importing its most recent backlog
+                // FIXME: Send this to background queue handling
+                common_log(LOG_INFO, __METHOD__ . ': Confirmed a new subscription, importing backlog...');
+                $feedsub->importFeed();
+            }
         } else {
             common_log(LOG_INFO, __METHOD__ . ": unsub confirmed; deleting sub record for $topic");
             $feedsub->confirmUnsubscribe();