MediaWiki
master
Dump7ZipOutput.php
Go to the documentation of this file.
1
<?php
26
use
MediaWiki\Shell\Shell
;
27
31
class
Dump7ZipOutput
extends
DumpPipeOutput
{
35
protected
$compressionLevel
;
36
41
public
function
__construct
( $file, $cmpLevel = 4 ) {
42
$this->compressionLevel = $cmpLevel;
43
$command
= $this->setup7zCommand( $file );
44
parent::__construct(
$command
);
45
$this->filename = $file;
46
}
47
52
private
function
setup7zCommand( $file ) {
53
$command
=
"7za a -bd -si -mx="
;
54
$command
.= Shell::escape( (
string
)$this->compressionLevel ) .
' '
;
55
$command
.= Shell::escape( $file );
56
// Suppress annoying useless crap from p7zip
57
// Unfortunately this could suppress real error messages too
58
$command
.=
' >'
.
wfGetNull
() .
' 2>&1'
;
59
return
$command
;
60
}
61
65
public
function
closeAndRename
( $newname, $open =
false
) {
66
$newname = $this->
checkRenameArgCount
( $newname );
67
if
( $newname ) {
68
fclose( $this->handle );
69
proc_close( $this->procOpenResource );
70
$this->
renameOrException
( $newname );
71
if
( $open ) {
72
$command
= $this->setup7zCommand( $this->filename );
73
$this->
startCommand
(
$command
);
74
}
75
}
76
}
77
}
wfGetNull
wfGetNull()
Get a platform-independent path to the null file, e.g.
Definition
GlobalFunctions.php:1877
Dump7ZipOutput
Definition
Dump7ZipOutput.php:31
Dump7ZipOutput\$compressionLevel
int $compressionLevel
Definition
Dump7ZipOutput.php:35
Dump7ZipOutput\__construct
__construct( $file, $cmpLevel=4)
Definition
Dump7ZipOutput.php:41
Dump7ZipOutput\closeAndRename
closeAndRename( $newname, $open=false)
Close the old file, and move it to a specified name.Use this for the last piece of a file written out...
Definition
Dump7ZipOutput.php:65
DumpFileOutput\checkRenameArgCount
checkRenameArgCount( $newname)
Definition
DumpFileOutput.php:82
DumpFileOutput\renameOrException
renameOrException( $newname)
Definition
DumpFileOutput.php:71
DumpPipeOutput
Definition
DumpPipeOutput.php:33
DumpPipeOutput\$command
string $command
Definition
DumpPipeOutput.php:35
DumpPipeOutput\startCommand
startCommand( $command)
Definition
DumpPipeOutput.php:69
MediaWiki\Shell\Shell
Executes shell commands.
Definition
Shell.php:46
includes
export
Dump7ZipOutput.php
Generated on Thu Oct 3 2024 20:23:58 for MediaWiki by
1.10.0