diff options
author | Brion Vibber <brion@pobox.com> | 2010-06-07 10:19:40 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-06-07 10:19:40 -0700 |
commit | d88b208edcb75ec864e09bb3ab29785b35064400 (patch) | |
tree | 6a3b2eb35fb792bffb7ebaf3b4f81fb1131466d1 /classes | |
parent | a7e33ac89df9f05b7497bfb34c6e69b3329a87e5 (diff) | |
parent | 41e9dba7297d43b7de0cb7665901869910d1047a (diff) |
Merge branch 'testing' of gitorious.org:statusnet/mainline into 0.9.x
Conflicts:
plugins/OpenID/openid.php
Diffstat (limited to 'classes')
-rw-r--r-- | classes/Inbox.php | 9 | ||||
-rw-r--r-- | classes/Notice.php | 12 | ||||
-rw-r--r-- | classes/Status_network.php | 29 |
3 files changed, 38 insertions, 12 deletions
diff --git a/classes/Inbox.php b/classes/Inbox.php index 2533210b7..430419ba5 100644 --- a/classes/Inbox.php +++ b/classes/Inbox.php @@ -115,9 +115,12 @@ class Inbox extends Memcached_DataObject */ static function insertNotice($user_id, $notice_id) { - $inbox = DB_DataObject::staticGet('inbox', 'user_id', $user_id); - - if (empty($inbox)) { + // Going straight to the DB rather than trusting our caching + // during an update. Note: not using DB_DataObject::staticGet, + // which is unsafe to use directly (in-process caching causes + // memory leaks, which accumulate in queue processes). + $inbox = new Inbox(); + if (!$inbox->get('user_id', $user_id)) { $inbox = Inbox::initialize($user_id); } diff --git a/classes/Notice.php b/classes/Notice.php index c8cfb5abb..cf6f9c279 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -1865,4 +1865,16 @@ class Notice extends Memcached_DataObject return $ns; } + /** + * Determine whether the notice was locally created + * + * @return boolean locality + */ + + public function isLocal() + { + return ($this->is_local == Notice::LOCAL_PUBLIC || + $this->is_local == Notice::LOCAL_NONPUBLIC); + } + } diff --git a/classes/Status_network.php b/classes/Status_network.php index a452c32ce..4a1f2c374 100644 --- a/classes/Status_network.php +++ b/classes/Status_network.php @@ -149,21 +149,15 @@ class Status_network extends Safe_DataObject $this->decache(); # while we still have the values! return parent::delete(); } - + /** * @param string $servername hostname - * @param string $pathname URL base path * @param string $wildcard hostname suffix to match wildcard config + * @return mixed Status_network or null */ - static function setupSite($servername, $pathname, $wildcard) + static function getFromHostname($servername, $wildcard) { - global $config; - $sn = null; - - // XXX I18N, probably not crucial for hostnames - // XXX This probably needs a tune up - if (0 == strncasecmp(strrev($wildcard), strrev($servername), strlen($wildcard))) { // special case for exact match if (0 == strcasecmp($servername, $wildcard)) { @@ -182,6 +176,23 @@ class Status_network extends Safe_DataObject } } } + return $sn; + } + + /** + * @param string $servername hostname + * @param string $pathname URL base path + * @param string $wildcard hostname suffix to match wildcard config + */ + static function setupSite($servername, $pathname, $wildcard) + { + global $config; + + $sn = null; + + // XXX I18N, probably not crucial for hostnames + // XXX This probably needs a tune up + $sn = self::getFromHostname($servername, $wildcard); if (!empty($sn)) { |