Fixed a bug where duplicate files weren't actually being deleted.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 1 year ago
parent 74ddb7f3a9
commit ed91435211
  1. 14
      Anvil/Tools/Database.pm

@ -3835,7 +3835,7 @@ WHERE
if ($delete_file_uuid) if ($delete_file_uuid)
{ {
# Log which we're deleting # Log which we're deleting
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0813", variables => { full_uuid => $delete_file_uuid }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0813", variables => { file_uuid => $delete_file_uuid }});
# As we delete file_locations, we need to make sure that there are # As we delete file_locations, we need to make sure that there are
# file_location_file_uuid entries for the other file. # file_location_file_uuid entries for the other file.
@ -3844,11 +3844,19 @@ WHERE
my $query = "DELETE FROM history.file_locations WHERE file_location_file_uuid = ".$anvil->Database->quote($delete_file_uuid).";"; my $query = "DELETE FROM history.file_locations WHERE file_location_file_uuid = ".$anvil->Database->quote($delete_file_uuid).";";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
$anvil->Database->write({query => $query, source => $THIS_FILE, line => __LINE__}); $anvil->Database->write({debug => $debug, query => $query, source => $THIS_FILE, line => __LINE__});
$query = "DELETE FROM file_locations WHERE file_location_file_uuid = ".$anvil->Database->quote($delete_file_uuid).";"; $query = "DELETE FROM file_locations WHERE file_location_file_uuid = ".$anvil->Database->quote($delete_file_uuid).";";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
$anvil->Database->write({query => $query, source => $THIS_FILE, line => __LINE__}); $anvil->Database->write({debug => $debug, query => $query, source => $THIS_FILE, line => __LINE__});
$query = "DELETE FROM history.files WHERE file_uuid = ".$anvil->Database->quote($delete_file_uuid).";";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
$anvil->Database->write({debug => $debug, query => $query, source => $THIS_FILE, line => __LINE__});
$query = "DELETE FROM files WHERE file_uuid = ".$anvil->Database->quote($delete_file_uuid).";";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
$anvil->Database->write({debug => $debug, query => $query, source => $THIS_FILE, line => __LINE__});
delete $anvil->data->{files}{file_uuid}{$delete_file_uuid}; delete $anvil->data->{files}{file_uuid}{$delete_file_uuid};
next; next;

Loading…
Cancel
Save