summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/all.php2
-rw-r--r--actions/apitimelinefriends.php1
-rw-r--r--classes/Inbox.php19
-rw-r--r--lib/iomaster.php2
-rw-r--r--lib/queuemanager.php2
-rw-r--r--lib/xmppmanager.php6
-rwxr-xr-xscripts/queuedaemon.php6
7 files changed, 28 insertions, 10 deletions
diff --git a/actions/all.php b/actions/all.php
index efa4521e2..3eb185214 100644
--- a/actions/all.php
+++ b/actions/all.php
@@ -81,7 +81,7 @@ class AllAction extends ProfileAction
function title()
{
if ($this->page > 1) {
- return sprintf(_("%1$s and friends, page %2$d"), $this->user->nickname, $this->page);
+ return sprintf(_('%1$s and friends, page %2$d'), $this->user->nickname, $this->page);
} else {
return sprintf(_("%s and friends"), $this->user->nickname);
}
diff --git a/actions/apitimelinefriends.php b/actions/apitimelinefriends.php
index ef58b103c..4e3827bae 100644
--- a/actions/apitimelinefriends.php
+++ b/actions/apitimelinefriends.php
@@ -72,7 +72,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
function prepare($args)
{
parent::prepare($args);
- common_debug("api friends_timeline");
$this->user = $this->getTargetUser($this->arg('id'));
if (empty($this->user)) {
diff --git a/classes/Inbox.php b/classes/Inbox.php
index 83cfe8ef8..312b4586b 100644
--- a/classes/Inbox.php
+++ b/classes/Inbox.php
@@ -103,9 +103,9 @@ class Inbox extends Memcached_DataObject
static function insertNotice($user_id, $notice_id)
{
- $inbox = Inbox::staticGet('user_id', $user_id);
+ $inbox = DB_DataObject::staticGet('inbox', 'user_id', $user_id);
- if (empty($inbox) || $inbox->fake) {
+ if (empty($inbox)) {
$inbox = Inbox::initialize($user_id);
}
@@ -153,8 +153,19 @@ class Inbox extends Memcached_DataObject
$ids = unpack('N*', $inbox->notice_ids);
- // XXX: handle since_id
- // XXX: handle max_id
+ if (!empty($since_id)) {
+ $i = array_search($since_id, $ids);
+ if ($i !== false) {
+ $ids = array_slice($ids, 0, $i - 1);
+ }
+ }
+
+ if (!empty($max_id)) {
+ $i = array_search($max_id, $ids);
+ if ($i !== false) {
+ $ids = array_slice($ids, $i - 1);
+ }
+ }
$ids = array_slice($ids, $offset, $limit);
diff --git a/lib/iomaster.php b/lib/iomaster.php
index 5d1071a39..ce77b53b2 100644
--- a/lib/iomaster.php
+++ b/lib/iomaster.php
@@ -70,7 +70,7 @@ class IoMaster
$classes = array();
if (Event::handle('StartIoManagerClasses', array(&$classes))) {
$classes[] = 'QueueManager';
- if (common_config('xmpp', 'enabled')) {
+ if (common_config('xmpp', 'enabled') && !defined('XMPP_EMERGENCY_FLAG')) {
$classes[] = 'XmppManager'; // handles pings/reconnects
$classes[] = 'XmppConfirmManager'; // polls for outgoing confirmations
}
diff --git a/lib/queuemanager.php b/lib/queuemanager.php
index a98c0efff..b98e57a1f 100644
--- a/lib/queuemanager.php
+++ b/lib/queuemanager.php
@@ -157,7 +157,7 @@ abstract class QueueManager extends IoManager
}
// XMPP output handlers...
- if (common_config('xmpp', 'enabled')) {
+ if (common_config('xmpp', 'enabled') && !defined('XMPP_EMERGENCY_FLAG')) {
$this->connect('jabber', 'JabberQueueHandler');
$this->connect('public', 'PublicQueueHandler');
diff --git a/lib/xmppmanager.php b/lib/xmppmanager.php
index 0839cda57..dfff63a30 100644
--- a/lib/xmppmanager.php
+++ b/lib/xmppmanager.php
@@ -118,7 +118,11 @@ class XmppManager extends IoManager
*/
public function getSockets()
{
- return array($this->conn->getSocket());
+ if ($this->conn) {
+ return array($this->conn->getSocket());
+ } else {
+ return array();
+ }
}
/**
diff --git a/scripts/queuedaemon.php b/scripts/queuedaemon.php
index 8ef364fe7..f8bade39d 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=');
+$longoptions = array('id=', 'foreground', 'all', 'threads=', 'skip-xmpp');
/**
* Attempts to get a count of the processors available on the current system
@@ -260,6 +260,10 @@ if (!$threads) {
$daemonize = !(have_option('f') || have_option('--foreground'));
$all = have_option('a') || have_option('--all');
+if (have_option('--skip-xmpp')) {
+ define('XMPP_EMERGENCY_FLAG', true);
+}
+
$daemon = new QueueDaemon($id, $daemonize, $threads, $all);
$daemon->runOnce();