Merge branch 'master' into 0.9.x

This commit is contained in:
Evan Prodromou 2010-01-13 22:57:25 -08:00
commit b59188dc77
5 changed files with 27 additions and 10 deletions

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

@ -231,7 +231,7 @@ class IoMaster
return -1; return -1;
} }
} else { } else {
return $this->parseMemoryLimit($limit); return $this->parseMemoryLimit($softLimit);
} }
return $softLimit; return $softLimit;
} }

View File

@ -81,7 +81,7 @@ class XmppManager extends IoManager
parent::start($master); parent::start($master);
$this->switchSite(); $this->switchSite();
require_once "lib/jabber.php"; require_once INSTALLDIR . "/lib/jabber.php";
# Low priority; we don't want to receive messages # Low priority; we don't want to receive messages

View File

@ -166,7 +166,7 @@ class MemcachePlugin extends Plugin
if (is_array($this->servers)) { if (is_array($this->servers)) {
foreach ($this->servers as $server) { foreach ($this->servers as $server) {
list($host, $port) = explode(';', $server); list($host, $port) = @explode(';', $server);
if (empty($port)) { if (empty($port)) {
$port = 11211; $port = 11211;
} }

View File

@ -72,7 +72,7 @@ try {
foreach ($ids as $id) { foreach ($ids as $id) {
$user = User::staticGet('id', $id); $user = User::staticGet('id', $id);
if (empty($user)) { if (empty($user)) {
throw new Exception("Can't find user with id '$id'."); print "Can't find user with id '$id'.\n";
} }
initializeInbox($user); initializeInbox($user);
} }
@ -91,14 +91,20 @@ function initializeInbox($user)
print "Initializing inbox for $user->nickname..."; print "Initializing inbox for $user->nickname...";
} }
$inbox = Inbox::staticGet('user_id', $user_id); $inbox = Inbox::staticGet('user_id', $user->id);
if ($inbox && !empty($inbox->fake)) {
if (!have_option('q', 'quiet')) {
echo "(replacing faux cached inbox)";
}
$inbox = false;
}
if (!empty($inbox)) { if (!empty($inbox)) {
if (!have_option('q', 'quiet')) { if (!have_option('q', 'quiet')) {
print "SKIP\n"; print "SKIP\n";
} }
} else { } else {
$inbox = Inbox::initialize($user_id); $inbox = Inbox::initialize($user->id);
if (!have_option('q', 'quiet')) { if (!have_option('q', 'quiet')) {
if (empty($inbox)) { if (empty($inbox)) {
print "ERR\n"; print "ERR\n";