Make the deprecation notice actually useful by listing the class
[lhc/web/wiklou.git] / includes / HistoryBlob.php
index da54673..d0cae36 100644 (file)
@@ -25,8 +25,7 @@
  * two-part external storage URLs. Used for represent efficient concatenated
  * storage, and migration-related pointer objects.
  */
-interface HistoryBlob
-{
+interface HistoryBlob {
        /**
         * Adds an item of text, returns a stub object which points to the item.
         * You must call setLocation() on the stub object before storing it to the
@@ -71,8 +70,7 @@ interface HistoryBlob
  * Concatenated gzip (CGZ) storage
  * Improves compression ratio by concatenating like objects before gzipping
  */
-class ConcatenatedGzipHistoryBlob implements HistoryBlob
-{
+class ConcatenatedGzipHistoryBlob implements HistoryBlob {
        public $mVersion = 0, $mCompressed = false, $mItems = array(), $mDefaultHash = '';
        public $mSize = 0;
        public $mMaxSize = 10000000;
@@ -83,7 +81,8 @@ class ConcatenatedGzipHistoryBlob implements HistoryBlob
         */
        public function __construct() {
                if ( !function_exists( 'gzdeflate' ) ) {
-                       throw new MWException( "Need zlib support to read or write this kind of history object (ConcatenatedGzipHistoryBlob)\n" );
+                       throw new MWException( "Need zlib support to read or write this "
+                               . "kind of history object (ConcatenatedGzipHistoryBlob)\n" );
                }
        }
 
@@ -190,14 +189,21 @@ class ConcatenatedGzipHistoryBlob implements HistoryBlob
  */
 class HistoryBlobStub {
        /**
-        * One-step cache variable to hold base blobs; operations that
-        * pull multiple revisions may often pull multiple times from
-        * the same blob. By keeping the last-used one open, we avoid
-        * redundant unserialization and decompression overhead.
+        * @var array One-step cache variable to hold base blobs; operations that
+        * pull multiple revisions may often pull multiple times from the same
+        * blob. By keeping the last-used one open, we avoid redundant
+        * unserialization and decompression overhead.
         */
        protected static $blobCache = array();
 
-       var $mOldId, $mHash, $mRef;
+       /** @var int */
+       public $mOldId;
+
+       /** @var string */
+       public $mHash;
+
+       /** @var  */
+       public $mRef;
 
        /**
         * @param string $hash The content hash of the text
@@ -240,10 +246,16 @@ class HistoryBlobStub {
                        $obj = self::$blobCache[$this->mOldId];
                } else {
                        $dbr = wfGetDB( DB_SLAVE );
-                       $row = $dbr->selectRow( 'text', array( 'old_flags', 'old_text' ), array( 'old_id' => $this->mOldId ) );
+                       $row = $dbr->selectRow(
+                               'text',
+                               array( 'old_flags', 'old_text' ),
+                               array( 'old_id' => $this->mOldId )
+                       );
+
                        if ( !$row ) {
                                return false;
                        }
+
                        $flags = explode( ',', $row->old_flags );
                        if ( in_array( 'external', $flags ) ) {
                                $url = $row->old_text;
@@ -254,6 +266,7 @@ class HistoryBlobStub {
                                $row->old_text = ExternalStore::fetchFromUrl( $url );
 
                        }
+
                        if ( !in_array( 'object', $flags ) ) {
                                return false;
                        }
@@ -276,6 +289,7 @@ class HistoryBlobStub {
                        $obj->uncompress();
                        self::$blobCache = array( $this->mOldId => $obj );
                }
+
                return $obj->getItem( $this->mHash );
        }
 
@@ -298,7 +312,8 @@ class HistoryBlobStub {
  * on conversion if $wgLegacySchemaConversion is set to true.
  */
 class HistoryBlobCurStub {
-       var $mCurId;
+       /** @var int */
+       public $mCurId;
 
        /**
         * @param int $curid The cur_id pointed to
@@ -335,50 +350,43 @@ class HistoryBlobCurStub {
  * Requires xdiff 1.5+ and zlib
  */
 class DiffHistoryBlob implements HistoryBlob {
-       /** Uncompressed item cache */
-       var $mItems = array();
+       /** @var array Uncompressed item cache */
+       protected $mItems = array();
 
-       /** Total uncompressed size */
-       var $mSize = 0;
+       /** @var int Total uncompressed size */
+       protected $mSize = 0;
 
        /**
-        * Array of diffs. If a diff D from A to B is notated D = B - A, and Z is
-        * an empty string:
+        * @var array Array of diffs. If a diff D from A to B is notated D = B - A,
+        * and Z is an empty string:
         *
         *              { item[map[i]] - item[map[i-1]]   where i > 0
         *    diff[i] = {
         *              { item[map[i]] - Z                where i = 0
         */
-       var $mDiffs;
+       protected $mDiffs;
 
-       /** The diff map, see above */
-       var $mDiffMap;
+       /** @var array The diff map, see above */
+       protected $mDiffMap;
 
-       /**
-        * The key for getText()
+       /** @var int The key for getText()
         */
-       var $mDefaultKey;
+       protected $mDefaultKey;
 
-       /**
-        * Compressed storage
-        */
-       var $mCompressed;
+       /** @var string Compressed storage */
+       public $mCompressed;
 
-       /**
-        * True if the object is locked against further writes
-        */
-       var $mFrozen = false;
+       /** @var bool True if the object is locked against further writes */
+       protected $mFrozen = false;
 
        /**
-        * The maximum uncompressed size before the object becomes sad
+        * @var int The maximum uncompressed size before the object becomes sad
         * Should be less than max_allowed_packet
         */
-       var $mMaxSize = 10000000;
+       public $mMaxSize = 10000000;
 
-       /**
-        * The maximum number of text items before the object becomes sad
-        */
-       var $mMaxCount = 100;
+       /** @var int The maximum number of text items before the object becomes sad */
+       public $mMaxCount = 100;
 
        /** Constants from xdiff.h */
        const XDL_BDOP_INS = 1;
@@ -460,7 +468,8 @@ class DiffHistoryBlob implements HistoryBlob {
                );
                $smallFactor = 0.5;
 
-               for ( $i = 0; $i < count( $this->mItems ); $i++ ) {
+               $mItemsCount = count( $this->mItems );
+               for ( $i = 0; $i < $mItemsCount; $i++ ) {
                        $text = $this->mItems[$i];
                        if ( $i == 0 ) {
                                $seqName = 'main';
@@ -496,7 +505,8 @@ class DiffHistoryBlob implements HistoryBlob {
                                $this->mDiffs[] = $this->diff( $tail, $head );
                        }
                        $this->mDiffMap[] = $seq['map'][0];
-                       for ( $i = 1; $i < count( $seq['diffs'] ); $i++ ) {
+                       $diffsCount = count( $seq['diffs'] );
+                       for ( $i = 1; $i < $diffsCount; $i++ ) {
                                $this->mDiffs[] = $seq['diffs'][$i];
                                $this->mDiffMap[] = $seq['map'][$i];
                        }
@@ -606,7 +616,8 @@ class DiffHistoryBlob implements HistoryBlob {
                        return;
                }
                $tail = '';
-               for ( $diffKey = 0; $diffKey < count( $this->mDiffs ); $diffKey++ ) {
+               $mDiffsCount = count( $this->mDiffs );
+               for ( $diffKey = 0; $diffKey < $mDiffsCount; $diffKey++ ) {
                        $textKey = $this->mDiffMap[$diffKey];
                        $text = $this->patch( $tail, $this->mDiffs[$diffKey] );
                        $this->mItems[$textKey] = $text;