From 85fc6845f39966d3508da5c05df473b2e1c7cc98 Mon Sep 17 00:00:00 2001 From: Platonides Date: Mon, 4 Oct 2010 15:04:41 +0000 Subject: [PATCH] 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. --- maintenance/7zip.inc | 4 ++-- maintenance/importDump.php | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/maintenance/7zip.inc b/maintenance/7zip.inc index 049bbf1bc0..833e76c76a 100644 --- a/maintenance/7zip.inc +++ b/maintenance/7zip.inc @@ -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' ); \ No newline at end of file +stream_wrapper_register( 'mediawiki.compress.7z', 'SevenZipStream' ); diff --git a/maintenance/importDump.php b/maintenance/importDump.php index 030962b8b8..00b9ccedb0 100644 --- a/maintenance/importDump.php +++ b/maintenance/importDump.php @@ -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 ); } -- 2.20.1