X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fexport%2FDump7ZipOutput.php;h=31c945c05e31722b490a7a28e7a6f057cb078b7c;hb=ce166f103108a142d8483dbc8826d6c14c632c59;hp=ec7a6b2d68d61499f4ab3f36577eb62d82c42a95;hpb=c732764ef4764c384eb9e2502ce249fb4a177bee;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/export/Dump7ZipOutput.php b/includes/export/Dump7ZipOutput.php index ec7a6b2d68..31c945c05e 100644 --- a/includes/export/Dump7ZipOutput.php +++ b/includes/export/Dump7ZipOutput.php @@ -2,7 +2,7 @@ /** * Sends dump output via the p7zip compressor. * - * Copyright © 2003, 2005, 2006 Brion Vibber + * Copyright © 2003, 2005, 2006 Brion Vibber * https://www.mediawiki.org/ * * This program is free software; you can redistribute it and/or modify @@ -27,10 +27,17 @@ * @ingroup Dump */ class Dump7ZipOutput extends DumpPipeOutput { + /** + * @var int + */ + protected $compressionLevel; + /** * @param string $file + * @param int $cmpLevel Compression level passed to 7za command's -mx */ - function __construct( $file ) { + function __construct( $file, $cmpLevel = 4 ) { + $this->compressionLevel = $cmpLevel; $command = $this->setup7zCommand( $file ); parent::__construct( $command ); $this->filename = $file; @@ -41,7 +48,9 @@ class Dump7ZipOutput extends DumpPipeOutput { * @return string */ function setup7zCommand( $file ) { - $command = "7za a -bd -si -mx=4 " . wfEscapeShellArg( $file ); + $command = "7za a -bd -si -mx="; + $command .= wfEscapeShellArg( $this->compressionLevel ) . ' '; + $command .= wfEscapeShellArg( $file ); // Suppress annoying useless crap from p7zip // Unfortunately this could suppress real error messages too $command .= ' >' . wfGetNull() . ' 2>&1';