diff --git a/classes/Inbox.php b/classes/Inbox.php index 83cfe8ef82..312b4586b4 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 aff5b145c2..5d1071a392 100644 --- a/lib/iomaster.php +++ b/lib/iomaster.php @@ -231,7 +231,7 @@ class IoMaster return -1; } } else { - return $this->parseMemoryLimit($limit); + return $this->parseMemoryLimit($softLimit); } return $softLimit; } diff --git a/lib/xmppmanager.php b/lib/xmppmanager.php index 9662e97d15..0839cda57a 100644 --- a/lib/xmppmanager.php +++ b/lib/xmppmanager.php @@ -81,7 +81,7 @@ class XmppManager extends IoManager parent::start($master); $this->switchSite(); - require_once "lib/jabber.php"; + require_once INSTALLDIR . "/lib/jabber.php"; # Low priority; we don't want to receive messages diff --git a/plugins/MemcachePlugin.php b/plugins/MemcachePlugin.php index fbc2802f78..bc7fd90765 100644 --- a/plugins/MemcachePlugin.php +++ b/plugins/MemcachePlugin.php @@ -166,7 +166,7 @@ class MemcachePlugin extends Plugin if (is_array($this->servers)) { foreach ($this->servers as $server) { - list($host, $port) = explode(';', $server); + list($host, $port) = @explode(';', $server); if (empty($port)) { $port = 11211; } diff --git a/scripts/initializeinbox.php b/scripts/initializeinbox.php index bc31cba153..44508fe22a 100644 --- a/scripts/initializeinbox.php +++ b/scripts/initializeinbox.php @@ -72,7 +72,7 @@ try { foreach ($ids as $id) { $user = User::staticGet('id', $id); if (empty($user)) { - throw new Exception("Can't find user with id '$id'."); + print "Can't find user with id '$id'.\n"; } initializeInbox($user); } @@ -91,14 +91,20 @@ function initializeInbox($user) 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 (!have_option('q', 'quiet')) { print "SKIP\n"; } } else { - $inbox = Inbox::initialize($user_id); + $inbox = Inbox::initialize($user->id); if (!have_option('q', 'quiet')) { if (empty($inbox)) { print "ERR\n";