From 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 12 Aug 2013 09:28:15 +0200 Subject: Update to MediaWiki 1.21.1 --- includes/Cdb_PHP.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'includes/Cdb_PHP.php') diff --git a/includes/Cdb_PHP.php b/includes/Cdb_PHP.php index 02be65f3..71b55f87 100644 --- a/includes/Cdb_PHP.php +++ b/includes/Cdb_PHP.php @@ -126,6 +126,7 @@ class CdbReader_PHP extends CdbReader { /** * @param $fileName string + * @throws MWException */ function __construct( $fileName ) { $this->fileName = $fileName; @@ -179,7 +180,7 @@ class CdbReader_PHP extends CdbReader { protected function read( $length, $pos ) { if ( fseek( $this->handle, $pos ) == -1 ) { // This can easily happen if the internal pointers are incorrect - throw new MWException( + throw new MWException( 'Seek failed, file "' . $this->fileName . '" may be corrupted.' ); } @@ -198,12 +199,13 @@ class CdbReader_PHP extends CdbReader { /** * Unpack an unsigned integer and throw an exception if it needs more than 31 bits * @param $s - * @return + * @throws MWException + * @return mixed */ protected function unpack31( $s ) { $data = unpack( 'V', $s ); if ( $data[1] > 0x7fffffff ) { - throw new MWException( + throw new MWException( 'Error in CDB file "' . $this->fileName . '", integer too big.' ); } return $data[1]; @@ -330,10 +332,10 @@ class CdbWriter_PHP extends CdbWriter { */ public function close() { $this->finish(); - if( isset($this->handle) ) { + if( isset( $this->handle ) ) { fclose( $this->handle ); } - if ( wfIsWindows() && file_exists($this->realFileName) ) { + if ( wfIsWindows() && file_exists( $this->realFileName ) ) { unlink( $this->realFileName ); } if ( !rename( $this->tmpFileName, $this->realFileName ) ) { @@ -349,7 +351,7 @@ class CdbWriter_PHP extends CdbWriter { protected function write( $buf ) { $len = fwrite( $this->handle, $buf ); if ( $len !== strlen( $buf ) ) { - $this->throwException( 'Error writing to CDB file "'.$this->tmpFileName.'".' ); + $this->throwException( 'Error writing to CDB file "' . $this->tmpFileName . '".' ); } } @@ -361,7 +363,7 @@ class CdbWriter_PHP extends CdbWriter { $newpos = $this->pos + $len; if ( $newpos > 0x7fffffff ) { $this->throwException( - 'A value in the CDB file "'.$this->tmpFileName.'" is too large.' ); + 'A value in the CDB file "' . $this->tmpFileName . '" is too large.' ); } $this->pos = $newpos; } @@ -390,10 +392,10 @@ class CdbWriter_PHP extends CdbWriter { */ protected function addbegin( $keylen, $datalen ) { if ( $keylen > 0x7fffffff ) { - $this->throwException( 'Key length too long in file "'.$this->tmpFileName.'".' ); + $this->throwException( 'Key length too long in file "' . $this->tmpFileName . '".' ); } if ( $datalen > 0x7fffffff ) { - $this->throwException( 'Data length too long in file "'.$this->tmpFileName.'".' ); + $this->throwException( 'Data length too long in file "' . $this->tmpFileName . '".' ); } $buf = pack( 'VV', $keylen, $datalen ); $this->write( $buf ); @@ -468,14 +470,14 @@ class CdbWriter_PHP extends CdbWriter { // Write the pointer array at the start of the file rewind( $this->handle ); if ( ftell( $this->handle ) != 0 ) { - $this->throwException( 'Error rewinding to start of file "'.$this->tmpFileName.'".' ); + $this->throwException( 'Error rewinding to start of file "' . $this->tmpFileName . '".' ); } $this->write( $final ); } /** * Clean up the temp file and throw an exception - * + * * @param $msg string * @throws MWException */ -- cgit v1.2.2