From 98924a80d776107a734b44027dda18094b1f093f Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 21 Sep 2009 14:39:22 -0400 Subject: [PATCH] 'easy' way to handle notices at queue time --- EVENTS.txt | 3 ++ lib/unqueuemanager.php | 3 ++ lib/util.php | 3 +- scripts/pluginqueuehandler.php | 58 ++++++++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 1 deletion(-) create mode 100755 scripts/pluginqueuehandler.php diff --git a/EVENTS.txt b/EVENTS.txt index d3b58ffb01..2b16d43c07 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -268,3 +268,6 @@ UnqueueHandleNotice: Handle a notice when no queue manager is available GetValidDaemons: Just before determining which daemons to run - &$daemons: modifiable list of daemon scripts to run, filenames relative to scripts/ + +HandleQueuedNotice: Handle a queued notice at queue time (or immediately if no queue) +- &$notice: notice to handle diff --git a/lib/unqueuemanager.php b/lib/unqueuemanager.php index 269ecdeaa0..6cfe5bcbd3 100644 --- a/lib/unqueuemanager.php +++ b/lib/unqueuemanager.php @@ -72,6 +72,9 @@ class UnQueueManager require_once(INSTALLDIR.'/lib/jabber.php'); jabber_broadcast_notice($notice); break; + case 'plugin': + Event::handle('HandleQueuedNotice', array(&$notice)); + break; default: if (Event::handle('UnqueueHandleNotice', array(&$notice, $queue))) { throw ServerException("UnQueueManager: Unknown queue: $queue"); diff --git a/lib/util.php b/lib/util.php index eb247562dc..37744fc5b7 100644 --- a/lib/util.php +++ b/lib/util.php @@ -897,7 +897,8 @@ function common_enqueue_notice($notice) 'twitter', 'facebook', 'ping'); - static $allTransports = array('sms'); + + static $allTransports = array('sms', 'plugin'); $transports = $allTransports; diff --git a/scripts/pluginqueuehandler.php b/scripts/pluginqueuehandler.php new file mode 100755 index 0000000000..ae807db6af --- /dev/null +++ b/scripts/pluginqueuehandler.php @@ -0,0 +1,58 @@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); + +$shortoptions = 'i::'; +$longoptions = array('id::'); + +$helptext = <<runOnce(); -- 2.39.5