diff options
author | Evan Prodromou <evan@status.net> | 2010-01-01 11:20:25 -1000 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-01-01 11:20:25 -1000 |
commit | a9d835920824c48caef2a66686d6605ff54586b3 (patch) | |
tree | e8c9e297d46d36a5e3a3b3d47bbd51865e6123bf | |
parent | 053b8c600d7db73ec19e5f1d3e26c4c98fdf3d8c (diff) | |
parent | b0527801d9c2b84408bbfdf82bbdc5b778f72cfc (diff) |
Merge branch 'master' into 0.9.x
Conflicts:
classes/Memcached_DataObject.php
-rw-r--r-- | classes/Memcached_DataObject.php | 31 | ||||
-rw-r--r-- | lib/noticelist.php | 8 |
2 files changed, 29 insertions, 10 deletions
diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index be8137573..4f81bef75 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -60,18 +60,17 @@ class Memcached_DataObject extends DB_DataObject if ($i) { return $i; } else { - $i = DB_DataObject::staticGet($cls, $k, $v); - if ($i) { - // DB_DataObject's in-process lookup cache interferes with GC - // to cause massive memory leaks in long-running processes. - if (php_sapi_name() == 'cli') { - $i->_clear_cache(); - } - - // Now store it into the shared memcached, if present... + $i = DB_DataObject::factory($cls); + if (empty($i)) { + return null; + } + $result = $i->get($k, $v); + if ($result) { $i->encache(); + return $i; + } else { + return null; } - return $i; } } @@ -263,6 +262,18 @@ class Memcached_DataObject extends DB_DataObject return new ArrayWrapper($cached); } + function cleanup() + { + global $_DB_DATAOBJECT; + + if (isset($_DB_DATAOBJECT['RESULTFIELDS'][$this->_DB_resultid])) { + unset($_DB_DATAOBJECT['RESULTFIELDS'][$this->_DB_resultid]); + } + if (isset($_DB_DATAOBJECT['RESULTS'][$this->_DB_resultid])) { + unset($_DB_DATAOBJECT['RESULTS'][$this->_DB_resultid]); + } + } + // We overload so that 'SET NAMES "utf8"' is called for // each connection diff --git a/lib/noticelist.php b/lib/noticelist.php index 4c11ceed6..5eb2633ac 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -191,6 +191,14 @@ class NoticeListItem extends Widget function show() { + if (empty($this->notice)) { + common_log(LOG_WARNING, "Trying to show missing notice; skipping."); + return; + } else if (empty($this->profile)) { + common_log(LOG_WARNING, "Trying to show missing profile (" . $this->notice->profile_id . "); skipping."); + return; + } + $this->showStart(); if (Event::handle('StartShowNoticeItem', array($this))) { $this->showNotice(); |