X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FHistoryBlob.php;h=984ee2d4f808d6e429a4f9ea4d1acb68565fbe97;hb=1e7e73444a9357be1c58301e8707c029f31f5ef7;hp=eb4b7eb5c0d0faaad430ee50d50db3803994b468;hpb=266d41f165fe23e85f70f90891f951b0b0bcda7a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/HistoryBlob.php b/includes/HistoryBlob.php index eb4b7eb5c0..984ee2d4f8 100644 --- a/includes/HistoryBlob.php +++ b/includes/HistoryBlob.php @@ -1,82 +1,86 @@ uncompress(); $this->mItems['meta'] = $metaData; } /** @todo document */ - function getMeta() { + public function getMeta() { $this->uncompress(); return $this->mItems['meta']; } /** @todo document */ - function addItem( $text ) { + public function addItem( $text ) { $this->uncompress(); $hash = md5( $text ); $this->mItems[$hash] = $text; @@ -87,7 +91,7 @@ class ConcatenatedGzipHistoryBlob extends HistoryBlob } /** @todo document */ - function getItem( $hash ) { + public function getItem( $hash ) { $this->uncompress(); if ( array_key_exists( $hash, $this->mItems ) ) { return $this->mItems[$hash]; @@ -97,13 +101,29 @@ class ConcatenatedGzipHistoryBlob extends HistoryBlob } /** @todo document */ - function removeItem( $hash ) { + public function setText( $text ) { + $this->uncompress(); + $stub = $this->addItem( $text ); + $this->mDefaultHash = $stub->mHash; + } + + /** @todo document */ + public function getText() { + $this->uncompress(); + return $this->getItem( $this->mDefaultHash ); + } + + # HistoryBlob implemented. + + + /** @todo document */ + public function removeItem( $hash ) { $this->mSize -= strlen( $this->mItems[$hash] ); unset( $this->mItems[$hash] ); } /** @todo document */ - function compress() { + public function compress() { if ( !$this->mCompressed ) { $this->mItems = gzdeflate( serialize( $this->mItems ) ); $this->mCompressed = true; @@ -111,25 +131,13 @@ class ConcatenatedGzipHistoryBlob extends HistoryBlob } /** @todo document */ - function uncompress() { + public function uncompress() { if ( $this->mCompressed ) { $this->mItems = unserialize( gzinflate( $this->mItems ) ); $this->mCompressed = false; } } - /** @todo document */ - function getText() { - $this->uncompress(); - return $this->getItem( $this->mDefaultHash ); - } - - /** @todo document */ - function setText( $text ) { - $this->uncompress(); - $stub = $this->addItem( $text ); - $this->mDefaultHash = $stub->mHash; - } /** @todo document */ function __sleep() { @@ -145,7 +153,7 @@ class ConcatenatedGzipHistoryBlob extends HistoryBlob /** * Determines if this object is happy */ - function isHappy( $maxFactor, $factorThreshold ) { + public function isHappy( $maxFactor, $factorThreshold ) { if ( count( $this->mItems ) == 0 ) { return true; } @@ -179,7 +187,7 @@ $wgBlobCache = array(); /** - * @package MediaWiki + * @todo document (needs one-sentence top-level class description + some function descriptions). */ class HistoryBlobStub { var $mOldId, $mHash, $mRef; @@ -197,28 +205,28 @@ class HistoryBlobStub { $this->mOldId = $id; } - /** - * Sets the location (old_id) of the referring object - */ - function setReferrer( $id ) { - $this->mRef = $id; - } + /** + * Sets the location (old_id) of the referring object + */ + function setReferrer( $id ) { + $this->mRef = $id; + } - /** - * Gets the location of the referring object - */ - function getReferrer() { - return $this->mRef; - } + /** + * Gets the location of the referring object + */ + function getReferrer() { + return $this->mRef; + } /** @todo document */ function getText() { - $fname = 'HistoryBlob::getText'; + $fname = 'HistoryBlobStub::getText'; global $wgBlobCache; if( isset( $wgBlobCache[$this->mOldId] ) ) { $obj = $wgBlobCache[$this->mOldId]; } else { - $dbr =& wfGetDB( DB_SLAVE ); + $dbr = wfGetDB( DB_SLAVE ); $row = $dbr->selectRow( 'text', array( 'old_flags', 'old_text' ), array( 'old_id' => $this->mOldId ) ); if( !$row ) { return false; @@ -226,12 +234,11 @@ class HistoryBlobStub { $flags = explode( ',', $row->old_flags ); if( in_array( 'external', $flags ) ) { $url=$row->old_text; - @list($proto,$path)=explode('://',$url,2); + @list( /* $proto */ ,$path)=explode('://',$url,2); if ($path=="") { wfProfileOut( $fname ); return false; } - require_once('ExternalStore.php'); $row->old_text=ExternalStore::fetchFromUrl($url); } @@ -274,8 +281,6 @@ class HistoryBlobStub { * * Serialized HistoryBlobCurStub objects will be inserted into the text table * on conversion if $wgFastSchemaUpgrades is set to true. - * - * @package MediaWiki */ class HistoryBlobCurStub { var $mCurId; @@ -295,7 +300,7 @@ class HistoryBlobCurStub { /** @todo document */ function getText() { - $dbr =& wfGetDB( DB_SLAVE ); + $dbr = wfGetDB( DB_SLAVE ); $row = $dbr->selectRow( 'cur', array( 'cur_text' ), array( 'cur_id' => $this->mCurId ) ); if( !$row ) { return false; @@ -305,4 +310,4 @@ class HistoryBlobCurStub { } -?> +