Fix issues after r54561 which avoided use of the 7z wrapper.

popen() doesn't like two-letter modes but the approach checked for it at 
too high level, used as mode the letter t, not r, which was an invalid 
option for SevenZipStream, and is still an invalid argument for popen.
This commit is contained in:
Platonides 2010-10-04 15:04:41 +00:00
parent adf4822d18
commit 85fc6845f3
2 changed files with 3 additions and 5 deletions

View file

@ -35,7 +35,7 @@ class SevenZipStream {
// Suppress the stupid messages on stderr
$command .= ' 2>/dev/null';
}
$this->stream = popen( $command, $mode );
$this->stream = popen( $command, $mode[0] ); // popen() doesn't like two-letter modes
return ( $this->stream !== false );
}
@ -73,4 +73,4 @@ class SevenZipStream {
return fseek( $this->stream, $offset, $whence );
}
}
stream_wrapper_register( 'mediawiki.compress.7z', 'SevenZipStream' );
stream_wrapper_register( 'mediawiki.compress.7z', 'SevenZipStream' );

View file

@ -115,7 +115,6 @@ class BackupReader {
}
function importFromFile( $filename ) {
$t = true;
if ( preg_match( '/\.gz$/', $filename ) ) {
$filename = 'compress.zlib://' . $filename;
}
@ -124,10 +123,9 @@ class BackupReader {
}
elseif ( preg_match( '/\.7z$/', $filename ) ) {
$filename = 'mediawiki.compress.7z://' . $filename;
$t = false;
}
$file = fopen( $filename, $t ? 'rt' : 't' ); // our 7zip wrapper uses popen, which seems not to like two-letter modes
$file = fopen( $filename, 'rt' );
return $this->importFromHandle( $file );
}