Merge branch 'master' of gitorious.org:statusnet/mainline into 0.9.x

This commit is contained in:
Brion Vibber 2010-01-15 09:52:50 -08:00
commit ef016dca45
7 changed files with 28 additions and 10 deletions

View File

@ -81,7 +81,7 @@ class AllAction extends ProfileAction
function title() function title()
{ {
if ($this->page > 1) { 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 { } else {
return sprintf(_("%s and friends"), $this->user->nickname); return sprintf(_("%s and friends"), $this->user->nickname);
} }

View File

@ -72,7 +72,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
function prepare($args) function prepare($args)
{ {
parent::prepare($args); parent::prepare($args);
common_debug("api friends_timeline");
$this->user = $this->getTargetUser($this->arg('id')); $this->user = $this->getTargetUser($this->arg('id'));
if (empty($this->user)) { if (empty($this->user)) {

View File

@ -103,9 +103,9 @@ class Inbox extends Memcached_DataObject
static function insertNotice($user_id, $notice_id) 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); $inbox = Inbox::initialize($user_id);
} }
@ -153,8 +153,19 @@ class Inbox extends Memcached_DataObject
$ids = unpack('N*', $inbox->notice_ids); $ids = unpack('N*', $inbox->notice_ids);
// XXX: handle since_id if (!empty($since_id)) {
// XXX: handle max_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); $ids = array_slice($ids, $offset, $limit);

View File

@ -70,7 +70,7 @@ class IoMaster
$classes = array(); $classes = array();
if (Event::handle('StartIoManagerClasses', array(&$classes))) { if (Event::handle('StartIoManagerClasses', array(&$classes))) {
$classes[] = 'QueueManager'; $classes[] = 'QueueManager';
if (common_config('xmpp', 'enabled')) { if (common_config('xmpp', 'enabled') && !defined('XMPP_EMERGENCY_FLAG')) {
$classes[] = 'XmppManager'; // handles pings/reconnects $classes[] = 'XmppManager'; // handles pings/reconnects
$classes[] = 'XmppConfirmManager'; // polls for outgoing confirmations $classes[] = 'XmppConfirmManager'; // polls for outgoing confirmations
} }

View File

@ -157,7 +157,7 @@ abstract class QueueManager extends IoManager
} }
// XMPP output handlers... // XMPP output handlers...
if (common_config('xmpp', 'enabled')) { if (common_config('xmpp', 'enabled') && !defined('XMPP_EMERGENCY_FLAG')) {
$this->connect('jabber', 'JabberQueueHandler'); $this->connect('jabber', 'JabberQueueHandler');
$this->connect('public', 'PublicQueueHandler'); $this->connect('public', 'PublicQueueHandler');

View File

@ -118,7 +118,11 @@ class XmppManager extends IoManager
*/ */
public function getSockets() public function getSockets()
{ {
return array($this->conn->getSocket()); if ($this->conn) {
return array($this->conn->getSocket());
} else {
return array();
}
} }
/** /**

View File

@ -21,7 +21,7 @@
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
$shortoptions = 'fi:at:'; $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 * 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')); $daemonize = !(have_option('f') || have_option('--foreground'));
$all = have_option('a') || have_option('--all'); $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 = new QueueDaemon($id, $daemonize, $threads, $all);
$daemon->runOnce(); $daemon->runOnce();