MediaWiki REL1_37
Dump7ZipOutput.php
Go to the documentation of this file.
1<?php
27
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( $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()
Get a platform-independent path to the null file, e.g.
__construct( $file, $cmpLevel=4)
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...
checkRenameArgCount( $newname)
renameOrException( $newname)
startCommand( $command)
Executes shell commands.
Definition Shell.php:45
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
Definition router.php:42