]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/FeedPoller/lib/feedpollqueuehandler.php
Merge branch 'notice_id-xml' into 'nightly'
[quix0rs-gnu-social.git] / plugins / FeedPoller / lib / feedpollqueuehandler.php
1 <?php
2
3 if (!defined('GNUSOCIAL')) { exit(1); }
4
5 /**
6  * Poll a feed based on its urlhash, the full url is in the feedsub table
7  *
8  * @author Mikael Nordfeldth <mmn@hethane.se>
9  */
10 class FeedPollQueueHandler extends QueueHandler
11 {
12     public function transport()
13     {
14         return FeedPoll::QUEUE_CHECK;
15     }
16
17     public function handle($item)
18     {
19         $feedsub = FeedSub::getKV('id', $item['id']);
20         if (!$feedsub instanceof FeedSub) {
21             // Removed from the feedsub table I guess
22             return true;
23         }
24         if (!$feedsub->sub_state == 'nohub') {
25             // We're not supposed to poll this (either it's WebSub or it's unsubscribed)
26             return true;
27         }
28
29         try {
30             FeedPoll::checkUpdates($feedsub);
31         } catch (Exception $e) {
32             common_log(LOG_ERR, "Failed to check feedsub id= ".$feedsub->id.' ("'.$e->getMessage().'")');
33         }
34
35         return true;
36     }
37 }