Skip to content

Commit

Permalink
Bugfix: only saving one tombstone, when creating file copies, render …
Browse files Browse the repository at this point in the history
…the previous tombstone file invalid: they will still contain 'Pending' tombstones, which is not true.
  • Loading branch information
gboudreau committed May 16, 2011
1 parent 8bf5753 commit 9770667
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions greyhole
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ function create_copies_from_tombstones($tombstones, $share, $full_path, $source_
$tombstone->state = 'OK';
$tombstones[$key] = $tombstone;
}
save_tombstones($share, $path, $filename, array_values($tombstones), get_storage_volume_from_path($tombstone->path));
save_tombstones($share, $path, $filename, array_values($tombstones));
}
}

Expand Down Expand Up @@ -1698,19 +1698,16 @@ function remove_tombstones($share, $path, $filename) {
}
}

function save_tombstones($share, $path, $filename, $tombstones, $only_target_drive=NULL) {
function save_tombstones($share, $path, $filename, $tombstones) {
if (count($tombstones) == 0) {
remove_tombstones($share, $path, $filename);
return;
}

gh_log(DEBUG, " Saving " . (empty($only_target_drive) ? count($tombstones) : 1) . " tombstones for $share" . (!empty($path) ? "/$path" : "") . ($filename!== null ? "/$filename" : ""));
gh_log(DEBUG, " Saving " . count($tombstones) . " tombstones for $share" . (!empty($path) ? "/$path" : "") . ($filename!== null ? "/$filename" : ""));
$paths_used = array();
foreach (get_graveyards() as $graveyard) {
$target_drive = str_replace('/.gh_graveyard', '', $graveyard);
if (!empty($only_target_drive) && $only_target_drive != $target_drive) {
continue;
}
$data_filepath = "$graveyard/$share/$path";
$has_tombstone = FALSE;
foreach ($tombstones as $tombstone) {
Expand All @@ -1730,7 +1727,7 @@ function save_tombstones($share, $path, $filename, $tombstones, $only_target_dri
unlink("$data_filepath/$filename");
}
}
if (count($paths_used) == 1 && empty($only_target_drive)) {
if (count($paths_used) == 1) {
// Also save a backup on another drive
global $graveyard_backup_directories;
if (count($graveyard_backup_directories) > 0) {
Expand Down

0 comments on commit 9770667

Please sign in to comment.