Skip to content

Commit

Permalink
do not overwrite files with same content
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubkulhan committed May 13, 2015
1 parent 8ab91b1 commit 7441ce8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Skrz/Meta/AbstractMetaSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,13 @@ public function processFiles(array $fileNames)
}
}

if (!file_put_contents($outputFileName, (string)$file)) {
throw new MetaException("Could not write output to file '{$outputFileName}'.");
$content = (string)$file;

// do not overwrite files with same content
if (!file_exists($outputFileName) || md5_file($outputFileName) !== md5($content)) {
if (!file_put_contents($outputFileName, $content)) {
throw new MetaException("Could not write output to file '{$outputFileName}'.");
}
}

break;
Expand Down

0 comments on commit 7441ce8

Please sign in to comment.