}
if ( $newname ) {
fclose( $this->handle );
- rename( $this->filename, $newname );
- if ( $open ) {
+ if (! rename( $this->filename, $newname ) ) {
+ throw new MWException( __METHOD__ . ": rename of file {$this->filename} to $newname failed\n" );
+ }
+ elseif ( $open ) {
$this->handle = fopen( $this->filename, "wt" );
}
}
if ( $newname ) {
fclose( $this->handle );
proc_close( $this->procOpenResource );
- rename( $this->filename, $newname );
- if ( $open ) {
+ if (! rename( $this->filename, $newname ) ) {
+ throw new MWException( __METHOD__ . ": rename of file {$this->filename} to $newname failed\n" );
+ }
+ elseif ( $open ) {
$command = $this->command;
$command .= " > " . wfEscapeShellArg( $this->filename );
$this->startCommand( $command );
if ( $newname ) {
fclose( $this->handle );
proc_close( $this->procOpenResource );
- rename( $this->filename, $newname );
- if ( $open ) {
+ if (! rename( $this->filename, $newname ) ) {
+ throw new MWException( __METHOD__ . ": rename of file {$this->filename} to $newname failed\n" );
+ }
+ elseif ( $open ) {
$command = "7za a -bd -si " . wfEscapeShellArg( $file );
// Suppress annoying useless crap from p7zip
// Unfortunately this could suppress real error messages too