return;
}
+ function closeAndRename( $newname ) {
+ return;
+ }
+
function rename( $newname ) {
return;
}
}
}
+ function closeAndRename( $newname ) {
+ if ( is_array($newname) ) {
+ if (count($newname) > 1) {
+ throw new MWException("Export closeRenameAndReopen: passed multiple argumnts for rename of single file\n");
+ }
+ else {
+ $newname = $newname[0];
+ }
+ }
+ if ( $newname ) {
+ fclose( $this->handle );
+ rename( $this->filename, $newname );
+ }
+ }
+
function rename( $newname ) {
if ( is_array($newname) ) {
if (count($newname) > 1) {
if ( !is_null( $file ) ) {
$command .= " > " . wfEscapeShellArg( $file );
}
- $this->handle = popen( $command, "w" );
+
+ $this->startCommand($command);
$this->command = $command;
$this->filename = $file;
}
+ function startCommand($command) {
+ $spec = array(
+ 0 => array( "pipe", "r" ),
+ );
+ $pipes = array();
+ $this->procOpenResource = proc_open( $command, $spec, $pipes );
+ $this->handle = $pipes[0];
+ }
+
/**
* Close the old file, move it to a specified name,
* and reopen new file with the old name.
}
}
if ( $newname ) {
- pclose( $this->handle );
+ fclose( $this->handle );
+ proc_close($this->procOpenResource);
rename( $this->filename, $newname );
$command = $this->command;
$command .= " > " . wfEscapeShellArg( $this->filename );
- $this->handle = popen( $command, "w" );
+ $this->startCommand($command);
+ }
+ }
+
+ function closeAndRename( $newname ) {
+ if ( is_array($newname) ) {
+ if (count($newname) > 1) {
+ throw new MWException("Export closeRenameAndReopen: passed multiple argumnts for rename of single file\n");
+ }
+ else {
+ $newname = $newname[0];
+ }
+ }
+ if ( $newname ) {
+# pclose( $this->handle );
+ fclose( $this->handle );
+ proc_close($this->procOpenResource);
+ rename( $this->filename, $newname );
}
}
}
}
if ( $newname ) {
- pclose( $this->handle );
+ fclose( $this->handle );
+ proc_close($this->procOpenResource);
rename( $this->filename, $newname );
$command = "7za a -bd -si " . wfEscapeShellArg( $file );
$command .= ' >' . wfGetNull() . ' 2>&1';
- $this->handle = popen( $command, "w" );
+ $this->startCommand($command);
+ }
+ }
+
+ function closeAndRename( $newname ) {
+ if ( is_array($newname) ) {
+ if (count($newname) > 1) {
+ throw new MWException("Export closeRenameAndReopen: passed multiple argumnts for rename of single file\n");
+ }
+ else {
+ $newname = $newname[0];
+ }
+ }
+ if ( $newname ) {
+ fclose( $this->handle );
+ proc_close($this->procOpenResource);
+ rename( $this->filename, $newname );
}
}
$this->sink->closeRenameAndReopen( $newname );
}
+ function closeAndRename( $newname ) {
+ $this->sink->closeAndRename( $newname );
+ }
+
function rename( $newname ) {
$this->sink->rename( $newname );
}
}
}
+ function closeAndRename( $newname ) {
+ for( $i = 0; $i < $this->count; $i++ ) {
+ $this->sinks[$i]->closeAndRename( $newnames[$i] );
+ }
+ }
function rename( $newnames ) {
for( $i = 0; $i < $this->count; $i++ ) {
$this->sinks[$i]->rename( $newnames[$i] );