X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FHistoryBlob.php;h=3772926dfdb553d784a5d2d21dcaaabe1004f714;hb=3857496fe2bda374229d0652a9cf51817cab165b;hp=282a7f53935bde692477cc217b7dd9fd87d7bfc3;hpb=5fef2333d43faed0571878e848d6c40ade2c9810;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/HistoryBlob.php b/includes/HistoryBlob.php index 282a7f5393..3772926dfd 100644 --- a/includes/HistoryBlob.php +++ b/includes/HistoryBlob.php @@ -1,81 +1,83 @@ 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; @@ -86,7 +88,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]; @@ -96,13 +98,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; @@ -110,25 +128,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() { @@ -144,7 +150,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; } @@ -299,6 +305,3 @@ class HistoryBlobCurStub { return $row->cur_text; } } - - -?>