Cleanup for r27897:
[lhc/web/wiklou.git] / includes / LinkCache.php
index 355f157..7c49d88 100644 (file)
@@ -1,28 +1,22 @@
 <?php
 /**
  * Cache for article titles (prefixed DB keys) and ids linked from one source
- * @package MediaWiki
- * @subpackage Cache
- */
-
-/**
- * @package MediaWiki
- * @subpackage Cache
+ * 
+ * @addtogroup Cache
  */
 class LinkCache {
        // Increment $mClassVer whenever old serialized versions of this class
        // becomes incompatible with the new version.
-       private
-               $mBadLinks,
-               $mClassVer = 3,
-               $mForUpdate,
-               $mGoodLinks,
-               $mPageLinks ;
+       /* private */ var $mClassVer = 3;
+
+       /* private */ var $mPageLinks;
+       /* private */ var $mGoodLinks, $mBadLinks;
+       /* private */ var $mForUpdate;
 
        /**
         * Get an instance of this class
         */
-       function &singleton() {
+       static function &singleton() {
                static $instance;
                if ( !isset( $instance ) ) {
                        $instance = new LinkCache;
@@ -30,7 +24,7 @@ class LinkCache {
                return $instance;
        }
 
-       function LinkCache() {
+       function __construct() {
                $this->mForUpdate = false;
                $this->mPageLinks = array();
                $this->mGoodLinks = array();
@@ -38,8 +32,7 @@ class LinkCache {
        }
 
        /* private */ function getKey( $title ) {
-               global $wgDBname;
-               return $wgDBname.':lc:title:'.$title;
+               return wfMemcKey( 'lc', 'title', $title );
        }
 
        /**
@@ -137,14 +130,14 @@ class LinkCache {
                        $id = $wgMemc->get( $key = $this->getKey( $title ) );
                if( ! is_integer( $id ) ) {
                        if ( $this->mForUpdate ) {
-                               $db =& wfGetDB( DB_MASTER );
+                               $db = wfGetDB( DB_MASTER );
                                if ( !( $wgAntiLockFlags & ALF_NO_LINK_LOCK ) ) {
                                        $options = array( 'FOR UPDATE' );
                                } else {
                                        $options = array();
                                }
                        } else {
-                               $db =& wfGetDB( DB_SLAVE );
+                               $db = wfGetDB( DB_SLAVE );
                                $options = array();
                        }
 
@@ -176,4 +169,4 @@ class LinkCache {
                $this->mBadLinks = array();
        }
 }
-?>
+