3 * GNU social feed polling plugin, to avoid using external PuSH hubs
7 * @author Mikael Nordfeldth <mmn@hethane.se>
8 * @copyright 2013 Free Software Foundation, Inc.
9 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
10 * @link http://www.gnu.org/software/social/
13 if (!defined('GNUSOCIAL')) { exit(1); }
15 class FeedPollerPlugin extends Plugin {
16 public $interval = 5; // interval in minutes for feed checks
18 public function onEndInitializeQueueManager(QueueManager $qm)
20 $qm->connect(FeedPoll::QUEUE_CHECK, 'FeedPollQueueHandler');
24 public function onCronMinutely()
26 $args = array('interval'=>$this->interval);
27 FeedPoll::enqueueNewFeeds($args);
31 public function onFeedSubscribe(FeedSub $feedsub)
33 if (!$feedsub->isPuSH()) {
34 FeedPoll::setupFeedSub($feedsub, $this->interval*60);
35 return false; // We're polling this feed, so stop processing FeedSubscribe
40 public function onFeedUnsubscribe(FeedSub $feedsub)
42 if (!$feedsub->isPuSH()) {
43 // removes sub_state setting and such
44 $feedsub->confirmUnsubscribe();
50 public function onPluginVersion(array &$versions)
52 $versions[] = array('name' => 'FeedPoller',
53 'version' => GNUSOCIAL_VERSION,
54 'author' => 'Mikael Nordfeldth',
55 'homepage' => 'http://www.gnu.org/software/social/',
57 // TRANS: Plugin description.
58 _m('Feed polling plugin to avoid using external push hubs.'));