123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- defined('GNUSOCIAL') || die();
- class PushInQueueHandler extends QueueHandler
- {
- function transport()
- {
- return 'pushin';
- }
- function handle($data) : bool
- {
- if (!is_array($data)) {
- common_log(LOG_ERR, "Got bogus data, not processing");
- return true;
- }
- $feedsub_id = $data['feedsub_id'];
- $post = $data['post'];
- $hmac = $data['hmac'];
- try {
- $feedsub = FeedSub::getByID($feedsub_id);
- $feedsub->receive($post, $hmac);
- } catch(NoResultException $e) {
- common_log(LOG_INFO, "Discarding POST to unknown feed subscription id {$feedsub_id}");
- } catch(Exception $e) {
- if (is_null($feedsub)) {
- common_log(LOG_ERR, "Exception "._ve(get_class($e))." during WebSub push input processing where FeedSub->receive returned null!" . _ve($e->getMessage()));
- } else {
- common_log(LOG_ERR, "Exception "._ve(get_class($e))." during WebSub push input processing for {$feedsub->getUri()}: " . _ve($e->getMessage()));
- }
- }
- return true;
- }
- }
|