]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/lib/pushinqueuehandler.php
Don't accept non-objects before testing with "instanceof".
[quix0rs-gnu-social.git] / plugins / OStatus / lib / pushinqueuehandler.php
index a90f52df26fce37b93b7155ad9a217c343aa1481..ac8a6c84298a7423c94bad50c16576d4f650da48 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+if (!defined('STATUSNET')) {
+    exit(1);
+}
+
 /**
  * Process a feed distribution POST from a PuSH hub.
  * @package FeedSub
  * @author Brion Vibber <brion@status.net>
  */
-
 class PushInQueueHandler extends QueueHandler
 {
     function transport()
@@ -38,9 +41,13 @@ class PushInQueueHandler extends QueueHandler
         $post = $data['post'];
         $hmac = $data['hmac'];
 
-        $feedsub = FeedSub::staticGet('id', $feedsub_id);
-        if ($feedsub) {
-            $feedsub->receive($post, $hmac);
+        $feedsub = FeedSub::getKV('id', $feedsub_id);
+        if ($feedsub instanceof FeedSub) {
+            try {
+                $feedsub->receive($post, $hmac);
+            } catch(Exception $e) {
+                common_log(LOG_ERR, "Exception during PuSH input processing for $feedsub->uri: " . $e->getMessage());
+            }
         } else {
             common_log(LOG_ERR, "Discarding POST to unknown feed subscription id $feedsub_id");
         }