Skip to content
Permalink
Browse files

EZP-21825: Delete destination file if copy is considered unsuccessful

  • Loading branch information...
Jérôme Gamez
Jérôme Gamez committed Jul 9, 2014
1 parent 3d25c66 commit 7a46d3a1402c65e577724341113a70c208b290d9
@@ -100,6 +100,11 @@ public function copyFromDFS( $srcFilePath, $dstFilePath = false )
$ret = $this->copyTimestamp( $srcFilePath, $dstFilePath );
}
if ( !$ret && file_exists( $dstFilePath ) )
{
unlink( $dstFilePath );
}
$this->accumulatorStop();
return $ret;
@@ -696,7 +696,12 @@ public function _fetch( $filePath, $uniqueName = false )
if ( $uniqueName !== true )
{
eZFile::rename( $tmpFilePath, $filePath, false, eZFile::CLEAN_ON_FAILURE | eZFile::APPEND_DEBUG_ON_FAILURE );
if( !eZFile::rename( $tmpFilePath, $filePath, false, eZFile::CLEAN_ON_FAILURE | eZFile::APPEND_DEBUG_ON_FAILURE ) )
{
usleep( self::TIME_UNTIL_RETRY );
++$loopCount;
continue;
}
}
$filePath = ($uniqueName) ? $tmpFilePath : $filePath ;
@@ -715,8 +720,7 @@ public function _fetch( $filePath, $uniqueName = false )
while ( $dfsFileSize > $localFileSize && $loopCount < $this->maxCopyTries );
// Copy from DFS has failed :-(
eZDebug::writeError( "Size ($localFileSize) of written data for file '$tmpFilePath' does not match expected size {$metaData['size']}", __METHOD__ );
unlink( $tmpFilePath );
eZDebug::writeError( "Size ({$localFileSize}) of written data for file '{$filePath}' does not match expected size {$metaData['size']}", __METHOD__ );
return false;
}

0 comments on commit 7a46d3a

Please sign in to comment.
You can’t perform that action at this time.