Distinguish newly added files from updates

This commit is contained in:
Sebastian Meyer 2017-12-12 16:21:13 +01:00
parent 8aba6243af
commit ce2d4ea1eb
1 changed files with 16 additions and 1 deletions

View File

@ -127,7 +127,22 @@ foreach ($todo as $identifier => $task) {
if ($task === 'update') { if ($task === 'update') {
if (md5_file($sourceDir.$identifier.'.xml') !== md5_file($dataDir.$identifier.'.xml')) { if (!file_exists($dataDir.$identifier.'.xml')) {
// Add file
if (copy($sourceDir.$identifier.'.xml', $dataDir.$identifier.'.xml')) {
echo format('added', 'green')."\n";
} else {
echo format('addition failed', 'red')."\n";
$error = true;
}
} elseif (md5_file($sourceDir.$identifier.'.xml') !== md5_file($dataDir.$identifier.'.xml')) {
// Replace file // Replace file
if (copy($sourceDir.$identifier.'.xml', $dataDir.$identifier.'.xml')) { if (copy($sourceDir.$identifier.'.xml', $dataDir.$identifier.'.xml')) {