]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' into 0.9.x
authorEvan Prodromou <evan@status.net>
Fri, 1 Jan 2010 21:20:25 +0000 (11:20 -1000)
committerEvan Prodromou <evan@status.net>
Fri, 1 Jan 2010 21:20:25 +0000 (11:20 -1000)
Conflicts:
classes/Memcached_DataObject.php

classes/Memcached_DataObject.php
lib/noticelist.php

index be8137573d31530862a1e63f05bd63d605c89902..4f81bef75c4fb4da016919fd3baf30c8c7262371 100644 (file)
@@ -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
 
index 4c11ceed6cecf60dcf4b191bece29d503745d0fa..5eb2633ac288ccbf479df5b84369374b94430022 100644 (file)
@@ -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();