diff options
author | Evan Prodromou <evan@status.net> | 2010-01-13 22:57:25 -0800 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-01-13 22:57:25 -0800 |
commit | b59188dc77710a7d3863c640b6689f0d4008269d (patch) | |
tree | eada7a447d4502dcf3575453bc10c785091808f1 | |
parent | 33df3922895e61e4e347a19acba67983ed1c4c23 (diff) | |
parent | 16742d0fde811256c386d1bae9768fcd939b9af8 (diff) |
Merge branch 'master' into 0.9.x
-rw-r--r-- | classes/Inbox.php | 19 | ||||
-rw-r--r-- | lib/iomaster.php | 2 | ||||
-rw-r--r-- | lib/xmppmanager.php | 2 | ||||
-rw-r--r-- | plugins/MemcachePlugin.php | 2 | ||||
-rw-r--r-- | scripts/initializeinbox.php | 12 |
5 files changed, 27 insertions, 10 deletions
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 aff5b145c..5d1071a39 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 9662e97d1..0839cda57 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 fbc2802f7..bc7fd9076 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 bc31cba15..44508fe22 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"; |