]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Memcached_DataObject.php
fillAvatars would avoid the *ProfileGetAvatar events
[quix0rs-gnu-social.git] / classes / Memcached_DataObject.php
index 7689ea979bd14976da7efa8e49902442901c399c..0df9164b40c81217636137dca29f948132c0a7a3 100644 (file)
@@ -32,9 +32,6 @@ class Memcached_DataObject extends Safe_DataObject
      */
     static function getClassKV($cls, $k, $v=null)
     {
-        if (!is_a($cls, __CLASS__, true)) {
-            throw new Exception('Trying to fetch ' . __CLASS__ . ' into a non-related class');
-        }
         if (is_null($v)) {
             $v = $k;
             $keys = self::pkeyCols($cls);
@@ -105,9 +102,6 @@ class Memcached_DataObject extends Safe_DataObject
      */
     static function pivotGetClass($cls, $keyCol, array $keyVals, array $otherCols = array())
     {
-        if (!is_a($cls, __CLASS__, true)) {
-            throw new Exception('Trying to fetch ' . __CLASS__ . ' into a non-related class');
-        }
         if (is_array($keyCol)) {
             foreach ($keyVals as $keyVal) {
                 $result[implode(',', $keyVal)] = null;
@@ -246,9 +240,6 @@ class Memcached_DataObject extends Safe_DataObject
 
     static function pkeyCols($cls)
     {
-        if (!is_a($cls, __CLASS__, true)) {
-            throw new Exception('Trying to fetch ' . __CLASS__ . ' into a non-related class');
-        }
         $i = new $cls;
         $types = $i->keyTypes();
         ksort($types);
@@ -266,25 +257,17 @@ class Memcached_DataObject extends Safe_DataObject
 
     static function listFindClass($cls, $keyCol, array $keyVals)
     {
-        if (!is_a($cls, __CLASS__, true)) {
-            throw new Exception('Trying to fetch ' . __CLASS__ . ' into a non-related class');
-        }
-
         $i = new $cls;
         $i->whereAddIn($keyCol, $keyVals, $i->columnType($keyCol));
         if (!$i->find()) {
             throw new NoResultException($i);
         }
 
-        sprintf(__CLASS__ . "() got {$i->N} results for class $cls key $keyCol");
         return $i;
     }
 
     static function listGetClass($cls, $keyCol, array $keyVals)
     {
-        if (!is_a($cls, __CLASS__, true)) {
-            throw new Exception('Trying to fetch ' . __CLASS__ . ' into a non-related class');
-        }
         $pkeyMap = array_fill_keys($keyVals, array());
         $result = array_fill_keys($keyVals, array());
 
@@ -335,7 +318,7 @@ class Memcached_DataObject extends Safe_DataObject
                     $pkeyMap[$i->$keyCol][] = $pkeyVal;
                 }
             } catch (NoResultException $e) {
-                // no results foudn for our keyVals, so we leave them as empty arrays
+                // no results found for our keyVals, so we leave them as empty arrays
             }
             foreach ($toFetch as $keyVal) {
                 self::cacheSet(sprintf("%s:list-ids:%s:%s", strtolower($cls), $keyCol, $keyVal),
@@ -367,9 +350,6 @@ class Memcached_DataObject extends Safe_DataObject
      */
     static function pkeyGetClass($cls, array $kv)
     {
-        if (!is_a($cls, __CLASS__, true)) {
-            throw new Exception('Trying to fetch ' . __CLASS__ . ' into a non-related class');
-        }
         $i = Memcached_DataObject::multicache($cls, $kv);
         if ($i !== false) { // false == cache miss
             return $i;
@@ -751,12 +731,12 @@ class Memcached_DataObject extends Safe_DataObject
 
     function _connect()
     {
-        global $_DB_DATAOBJECT;
+        global $_DB_DATAOBJECT, $_PEAR;
 
         $sum = $this->_getDbDsnMD5();
 
         if (!empty($_DB_DATAOBJECT['CONNECTIONS'][$sum]) &&
-            !PEAR::isError($_DB_DATAOBJECT['CONNECTIONS'][$sum])) {
+            !$_PEAR->isError($_DB_DATAOBJECT['CONNECTIONS'][$sum])) {
             $exists = true;
         } else {
             $exists = false;