1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 10:12:41 +01:00

When using "bin/bulk export --overwrite", actually overwrite the file

Summary: Depends on D19738. Ref T13210. Currently, when you use "--overwrite", we just //append// the new content. Instead, actually overwrite the file.

Test Plan: Used `--overwrite`, saw an actual clean overwrite instead of an append.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13210

Differential Revision: https://secure.phabricator.com/D19739
This commit is contained in:
epriestley 2018-10-08 11:20:58 -07:00
parent 4928c34d00
commit 4f557ff075

View file

@ -114,6 +114,10 @@ final class PhabricatorBulkManagementExportWorkflow
$iterator = $file->getFileDataIterator();
if (strlen($output_path)) {
// Empty the file before we start writing to it. Otherwise, "--overwrite"
// will really mean "--append".
Filesystem::writeFile($output_path, '');
foreach ($iterator as $chunk) {
Filesystem::appendFile($output_path, $chunk);
}