From ff26b8d88b9e3d185afa83fd2b08c0d67cd4f78d Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 8 Dec 2009 21:04:26 +0000 Subject: 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 67bd000f0..909cf5c9f 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 b9187d86c..fcd468f55 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 000000000..693dd27c1 --- /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 90e7331ca..c790f1f34 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 -- cgit v1.2.3-54-g00ecf