Skip to content

Commit 4dbbc8e

Browse files
committed
update the updated sources file instead of overwriting it
1 parent ec3be16 commit 4dbbc8e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/SPC/command/DownloadCommand.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,11 @@ private function handleUpdate(): int
519519
// Write updated sources to file
520520
$date = date('Y-m-d');
521521
$update_file = DOWNLOAD_PATH . '/.update-' . $date . '.txt';
522+
if (file_exists($update_file)) {
523+
$existing_content = file_get_contents($update_file);
524+
$existing_sources = array_map('trim', explode(',', $existing_content));
525+
$updated_sources = array_unique(array_merge($existing_sources, $updated_sources));
526+
}
522527
$content = implode(',', $updated_sources);
523528
file_put_contents($update_file, $content);
524529
logger()->debug("Updated sources written to: {$update_file}");

0 commit comments

Comments
 (0)