Revert r28215: incorrectly moved files
[lhc/web/wiklou.git] / includes / CacheDependency.php
index 6a59176..1d48c38 100644 (file)
@@ -4,6 +4,7 @@
  * This class stores an arbitrary value along with its dependencies. 
  * Users should typically only use DependencyWrapper::getFromCache(), rather
  * than instantiating one of these objects directly.
+ * @addtogroup Cache
  */
 class DependencyWrapper {
        var $value;
@@ -81,7 +82,7 @@ class DependencyWrapper {
                $callbackParams = array(), $deps = array() ) 
        {
                $obj = $cache->get( $key );
-               if ( $obj && !$obj->isExpired() ) {
+               if ( is_object( $obj ) && $obj instanceof DependencyWrapper && !$obj->isExpired() ) {
                        $value = $obj->value;
                } elseif ( $callback ) {
                        $value = call_user_func_array( $callback, $callbackParams );
@@ -95,6 +96,9 @@ class DependencyWrapper {
        }
 }
 
+/**
+ * @addtogroup Cache
+ */
 abstract class CacheDependency {
        /**
         * Returns true if the dependency is expired, false otherwise
@@ -107,6 +111,9 @@ abstract class CacheDependency {
        function loadDependencyValues() {}
 }
 
+/**
+ * @addtogroup Cache
+ */
 class FileDependency extends CacheDependency {
        var $filename, $timestamp;
 
@@ -163,6 +170,9 @@ class FileDependency extends CacheDependency {
        }
 }
 
+/**
+ * @addtogroup Cache
+ */
 class TitleDependency extends CacheDependency {
        var $titleObj;
        var $ns, $dbk;
@@ -219,6 +229,9 @@ class TitleDependency extends CacheDependency {
        }
 }
 
+/**
+ * @addtogroup Cache
+ */
 class TitleListDependency extends CacheDependency {
        var $linkBatch;
        var $timestamps;
@@ -244,7 +257,7 @@ class TitleListDependency extends CacheDependency {
 
                # Do the query
                if ( count( $timestamps ) ) {
-                       $dbr =& wfGetDB( DB_SLAVE );
+                       $dbr = wfGetDB( DB_SLAVE );
                        $where = $this->getLinkBatch()->constructSet( 'page', $dbr );
                        $res = $dbr->select( 'page', 
                                array( 'page_namespace', 'page_title', 'page_touched' ),
@@ -299,6 +312,9 @@ class TitleListDependency extends CacheDependency {
        }
 }
 
+/**
+ * @addtogroup Cache
+ */
 class GlobalDependency extends CacheDependency {
        var $name, $value;
        
@@ -312,6 +328,9 @@ class GlobalDependency extends CacheDependency {
        }
 }
 
+/**
+ * @addtogroup Cache
+ */
 class ConstantDependency extends CacheDependency {
        var $name, $value;
 
@@ -325,4 +344,4 @@ class ConstantDependency extends CacheDependency {
        }
 }
 
-?>
+