From ff26b8d88b9e3d185afa83fd2b08c0d67cd4f78d Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 8 Dec 2009 21:04:26 +0000 Subject: [PATCH] Add an RSSCloud queue handler daemon --- plugins/RSSCloud/RSSCloudNotifier.php | 2 + plugins/RSSCloud/RSSCloudPlugin.php | 7 ++ plugins/RSSCloud/RSSCloudQueueHandler.php | 78 +++++++++++++++++++++++ scripts/stopdaemons.sh | 2 +- 4 files changed, 88 insertions(+), 1 deletion(-) create mode 100755 plugins/RSSCloud/RSSCloudQueueHandler.php diff --git a/plugins/RSSCloud/RSSCloudNotifier.php b/plugins/RSSCloud/RSSCloudNotifier.php index 67bd000f00..909cf5c9f3 100644 --- a/plugins/RSSCloud/RSSCloudNotifier.php +++ b/plugins/RSSCloud/RSSCloudNotifier.php @@ -127,6 +127,8 @@ class RSSCloudNotifier { } } } + + return true; } function handleFailure($cloudSub) diff --git a/plugins/RSSCloud/RSSCloudPlugin.php b/plugins/RSSCloud/RSSCloudPlugin.php index b9187d86c0..fcd468f55d 100644 --- a/plugins/RSSCloud/RSSCloudPlugin.php +++ b/plugins/RSSCloud/RSSCloudPlugin.php @@ -205,5 +205,12 @@ class RSSCloudPlugin extends Plugin return true; } + function onGetValidDaemons($daemons) + { + array_push($daemons, INSTALLDIR . + '/plugins/RSSCloud/RSSCloudQueueHandler.php'); + return true; + } + } diff --git a/plugins/RSSCloud/RSSCloudQueueHandler.php b/plugins/RSSCloud/RSSCloudQueueHandler.php new file mode 100755 index 0000000000..693dd27c1f --- /dev/null +++ b/plugins/RSSCloud/RSSCloudQueueHandler.php @@ -0,0 +1,78 @@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/../..')); + +$shortoptions = 'i::'; +$longoptions = array('id::'); + +$helptext = <<log(LOG_INFO, "INITIALIZE"); + $this->notifier = new RSSCloudNotifier(); + return true; + } + + function handle_notice($notice) + { + $profile = $notice->getProfile(); + return $this->notifier->notify($profile); + } + + function finish() + { + } + +} + +if (have_option('i')) { + $id = get_option_value('i'); +} else if (have_option('--id')) { + $id = get_option_value('--id'); +} else if (count($args) > 0) { + $id = $args[0]; +} else { + $id = null; +} + +$handler = new RSSCloudQueueHandler($id); + +$handler->runOnce(); diff --git a/scripts/stopdaemons.sh b/scripts/stopdaemons.sh index 90e7331ca4..c790f1f349 100755 --- a/scripts/stopdaemons.sh +++ b/scripts/stopdaemons.sh @@ -25,7 +25,7 @@ DIR=`php $SDIR/getpiddir.php` for f in jabberhandler ombhandler publichandler smshandler pinghandler \ xmppconfirmhandler xmppdaemon twitterhandler facebookhandler \ - twitterstatusfetcher synctwitterfriends pluginhandler; do + twitterstatusfetcher synctwitterfriends pluginhandler rsscloudhandler; do FILES="$DIR/$f.*.pid" for ff in "$FILES" ; do