Skip to content

Commit

Permalink
Bugfix: log real filename, not temporary filenames, when creating fil…
Browse files Browse the repository at this point in the history
…e copies using parallel_copying = yes
  • Loading branch information
gboudreau committed Jan 23, 2024
1 parent fedaddd commit 6ecd4e6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions includes/StorageFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public static function create_file_copies($source_file, &$metafiles) {
$original_file_infos = StorageFile::get_file_permissions($copy_source);

$file_copies_to_create = [];
$tmp_file_copies_to_create = [];
foreach ($metafiles as $key => $metafile) {
$destination_file = $metafile->path;
if (gh_is_file($source_file)) {
Expand All @@ -180,7 +181,8 @@ public static function create_file_copies($source_file, &$metafiles) {

$temp_path = static::get_temp_filename($destination_file);

$file_copies_to_create[] = $temp_path;
$file_copies_to_create[] = $destination_file;
$tmp_file_copies_to_create[] = $temp_path;
}

if (isset($source_size)) {
Expand All @@ -190,8 +192,8 @@ public static function create_file_copies($source_file, &$metafiles) {
}

$start_time = time();
if (!empty($file_copies_to_create)) {
$copy_cmd = "cat " . escapeshellarg($copy_source) . " | tee " . implode(' ' , array_map('escapeshellarg', $file_copies_to_create));
if (!empty($tmp_file_copies_to_create)) {
$copy_cmd = "cat " . escapeshellarg($copy_source) . " | tee " . implode(' ' , array_map('escapeshellarg', $tmp_file_copies_to_create));
if (Config::get(CONFIG_CALCULATE_MD5_DURING_COPY)) {
$copy_cmd .= " | md5sum";
}
Expand All @@ -207,7 +209,7 @@ public static function create_file_copies($source_file, &$metafiles) {
foreach ($metafiles as $key => $metafile) {
$destination_file = $metafile->path;
$temp_path = static::get_temp_filename($destination_file);
if (!array_contains($file_copies_to_create, $temp_path)) {
if (!array_contains($tmp_file_copies_to_create, $temp_path)) {
continue;
}

Expand Down

0 comments on commit 6ecd4e6

Please sign in to comment.