Unicornisaurous has uploaded a new change for review.
https://gerrit.wikimedia.org/r/261755
Change subject: Add 7zip-compression param
......................................................................
Add 7zip-compression param
Change-Id: I9ee8169daf30b4d8251c7a344b593c29c81eb799
---
M includes/export/Dump7ZipOutput.php
M maintenance/backup.inc
M maintenance/dumpTextPass.php
3 files changed, 25 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/55/261755/1
diff --git a/includes/export/Dump7ZipOutput.php
b/includes/export/Dump7ZipOutput.php
index c299166..66a6469 100644
--- a/includes/export/Dump7ZipOutput.php
+++ b/includes/export/Dump7ZipOutput.php
@@ -28,9 +28,16 @@
*/
class Dump7ZipOutput extends DumpPipeOutput {
/**
- * @param string $file
+ * @var int
*/
- function __construct( $file ) {
+ public $compressionLevel;
+
+ /**
+ * @param string $file
+ * @param int $cmpLevel Compression level passed to 7za command's -mx
+ */
+ function __construct( $file, $cmpLevel = 4 ) {
+ $compressionLevel = $cmpLevel;
$command = $this->setup7zCommand( $file );
parent::__construct( $command );
$this->filename = $file;
@@ -41,7 +48,10 @@
* @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 );
+ echo( $command );
// Suppress annoying useless crap from p7zip
// Unfortunately this could suppress real error messages too
$command .= ' >' . wfGetNull() . ' 2>&1';
diff --git a/maintenance/backup.inc b/maintenance/backup.inc
index f91ef6f..5aed21d 100644
--- a/maintenance/backup.inc
+++ b/maintenance/backup.inc
@@ -27,6 +27,10 @@
/**
* @ingroup Dump Maintenance
*/
+
+require_once __DIR__ . '/Maintenance.php';
+require_once __DIR__ . '/../includes/export/DumpFilter.php';
+
class BackupDumper extends Maintenance {
public $reporting = true;
public $pages = null; // all pages
@@ -93,6 +97,8 @@
$this->addOption( 'report', 'Report position and speed after
every n pages processed. ' .
'Default: 100.', false, true );
$this->addOption( 'server', 'Force reading from MySQL server',
false, true );
+ $this->addOption( '7ziplevel', '7zip compression level for all
7zip outputs. Used for' .
+ '-mx option to 7za command.', false, true );
}
/**
@@ -169,7 +175,11 @@
$this->fatalError(
"Unrecognized output sink type '$type'" );
}
$type = $this->outputTypes[$type];
- $sink = new $type( $file );
+ if ( $type === "7zip" ) {
+ $sink = new $type( $file,
$this->getOption( '7ziplevel' ) );
+ } else {
+ $sink = new $type( $file );
+ }
break;
case 'filter':
diff --git a/maintenance/dumpTextPass.php b/maintenance/dumpTextPass.php
index f41676c..98be7b2 100644
--- a/maintenance/dumpTextPass.php
+++ b/maintenance/dumpTextPass.php
@@ -25,7 +25,7 @@
*/
require_once __DIR__ . '/backup.inc';
-
+require_once __DIR__ . '/../includes/export/WikiExporter.php';
/**
* @ingroup Maintenance
*/
--
To view, visit https://gerrit.wikimedia.org/r/261755
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ee8169daf30b4d8251c7a344b593c29c81eb799
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Unicornisaurous <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits