From 963260d2628cdaccd330c47761ebbf972193f15e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 15 Jan 2010 10:01:50 -0800 Subject: Fix since_id and max_id API parameters for inbox-based loads; was failing if the exact id mentioned wasn't present in the inbox (or had been trimmed out) --- classes/Inbox.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/classes/Inbox.php b/classes/Inbox.php index 312b4586b..086dba1c9 100644 --- a/classes/Inbox.php +++ b/classes/Inbox.php @@ -154,17 +154,23 @@ class Inbox extends Memcached_DataObject $ids = unpack('N*', $inbox->notice_ids); if (!empty($since_id)) { - $i = array_search($since_id, $ids); - if ($i !== false) { - $ids = array_slice($ids, 0, $i - 1); + $newids = array(); + foreach ($ids as $id) { + if ($id > $since_id) { + $newids[] = $id; + } } + $ids = $newids; } if (!empty($max_id)) { - $i = array_search($max_id, $ids); - if ($i !== false) { - $ids = array_slice($ids, $i - 1); + $newids = array(); + foreach ($ids as $id) { + if ($id <= $max_id) { + $newids[] = $id; + } } + $ids = $newids; } $ids = array_slice($ids, $offset, $limit); -- cgit v1.2.3-54-g00ecf From 598072468c9fdb07df2cda9da207f123b14566ae Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 15 Jan 2010 11:13:06 -0800 Subject: --xmpp-only hack for queuedaemon.php to run separate queue daemon with only xmpp threads --- lib/queuemanager.php | 22 ++++++++++++++-------- lib/stompqueuemanager.php | 7 ++++++- scripts/queuedaemon.php | 5 ++++- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/lib/queuemanager.php b/lib/queuemanager.php index b98e57a1f..291174d3c 100644 --- a/lib/queuemanager.php +++ b/lib/queuemanager.php @@ -149,11 +149,13 @@ abstract class QueueManager extends IoManager function initialize() { if (Event::handle('StartInitializeQueueManager', array($this))) { - $this->connect('plugin', 'PluginQueueHandler'); - $this->connect('omb', 'OmbQueueHandler'); - $this->connect('ping', 'PingQueueHandler'); - if (common_config('sms', 'enabled')) { - $this->connect('sms', 'SmsQueueHandler'); + if (!defined('XMPP_ONLY_FLAG')) { // hack! + $this->connect('plugin', 'PluginQueueHandler'); + $this->connect('omb', 'OmbQueueHandler'); + $this->connect('ping', 'PingQueueHandler'); + if (common_config('sms', 'enabled')) { + $this->connect('sms', 'SmsQueueHandler'); + } } // XMPP output handlers... @@ -165,10 +167,14 @@ abstract class QueueManager extends IoManager $this->connect('confirm', 'XmppConfirmHandler'); } - // For compat with old plugins not registering their own handlers. - $this->connect('plugin', 'PluginQueueHandler'); + if (!defined('XMPP_ONLY_FLAG')) { // hack! + // For compat with old plugins not registering their own handlers. + $this->connect('plugin', 'PluginQueueHandler'); + } + } + if (!defined('XMPP_ONLY_FLAG')) { // hack! + Event::handle('EndInitializeQueueManager', array($this)); } - Event::handle('EndInitializeQueueManager', array($this)); } /** diff --git a/lib/stompqueuemanager.php b/lib/stompqueuemanager.php index a7d735d1c..00590fdb6 100644 --- a/lib/stompqueuemanager.php +++ b/lib/stompqueuemanager.php @@ -104,7 +104,12 @@ class StompQueueManager extends QueueManager */ function getQueues() { - return array_keys($this->handlers[common_config('site', 'server')]); + $site = common_config('site', 'server'); + if (empty($this->handlers[$site])) { + return array(); + } else { + return array_keys($this->handlers[$site]); + } } /** diff --git a/scripts/queuedaemon.php b/scripts/queuedaemon.php index f8bade39d..162f617e0 100755 --- a/scripts/queuedaemon.php +++ b/scripts/queuedaemon.php @@ -21,7 +21,7 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); $shortoptions = 'fi:at:'; -$longoptions = array('id=', 'foreground', 'all', 'threads=', 'skip-xmpp'); +$longoptions = array('id=', 'foreground', 'all', 'threads=', 'skip-xmpp', 'xmpp-only'); /** * Attempts to get a count of the processors available on the current system @@ -263,6 +263,9 @@ $all = have_option('a') || have_option('--all'); if (have_option('--skip-xmpp')) { define('XMPP_EMERGENCY_FLAG', true); } +if (have_option('--xmpp-only')) { + define('XMPP_ONLY_FLAG', true); +} $daemon = new QueueDaemon($id, $daemonize, $threads, $all); $daemon->runOnce(); -- cgit v1.2.3-54-g00ecf From d6b8b13116b9a2de5d745487277551b281796975 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 16 Jan 2010 07:48:46 -0800 Subject: change rc3 to beta3 --- lib/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common.php b/lib/common.php index 243ac3e79..ada48b339 100644 --- a/lib/common.php +++ b/lib/common.php @@ -22,7 +22,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } //exit with 200 response, if this is checking fancy from the installer if (isset($_REQUEST['p']) && $_REQUEST['p'] == 'check-fancy') { exit; } -define('STATUSNET_VERSION', '0.9.0rc3'); +define('STATUSNET_VERSION', '0.9.0beta3'); define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility define('STATUSNET_CODENAME', 'Stand'); -- cgit v1.2.3-54-g00ecf