From 360fdb219dde7cb46b919aa18826df8ce5f4fdc6 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 29 Dec 2009 12:25:41 -0800 Subject: [PATCH 1/3] don't show notices with deleted profiles --- lib/noticelist.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/noticelist.php b/lib/noticelist.php index 4c11ceed6c..5eb2633ac2 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(); From 727978332ae7e074024ac7f9900570ebb0e9ba80 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 1 Jan 2010 10:57:22 -1000 Subject: [PATCH 2/3] stop using DB_DataObject's staticGet() which caches --- classes/Memcached_DataObject.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index d8b0db5a69..f511335083 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -51,11 +51,17 @@ class Memcached_DataObject extends DB_DataObject if ($i) { return $i; } else { - $i = DB_DataObject::staticGet($cls, $k, $v); - if ($i) { - $i->encache(); + $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; } } From b0527801d9c2b84408bbfdf82bbdc5b778f72cfc Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 1 Jan 2010 11:02:56 -1000 Subject: [PATCH 3/3] add cleanup method to cleanup a single row --- classes/Memcached_DataObject.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index f511335083..cf7fb4340a 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -253,6 +253,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