Commit e7be2559 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Bug 1773247: bad sql query in files bulk_delete"

parents 9b8b8ad5 5f6a89a7
...@@ -1480,7 +1480,11 @@ class ArtefactTypeFile extends ArtefactTypeFileBase { ...@@ -1480,7 +1480,11 @@ class ArtefactTypeFile extends ArtefactTypeFileBase {
// Get all files so that we can delete the files on filesystem // Get all files so that we can delete the files on filesystem
$filerecords = get_records_sql_assoc(' $filerecords = get_records_sql_assoc('
SELECT aff1.*, a.artefacttype SELECT aff.*, art.artefacttype
FROM {artefact_file_files} aff
JOIN {artefact} art ON aff.artefact = art.id
WHERE fileid IN (
SELECT fileid
FROM {artefact_file_files} aff1 FROM {artefact_file_files} aff1
JOIN {artefact} a ON aff1.artefact = a.id JOIN {artefact} a ON aff1.artefact = a.id
WHERE artefact IN (' . $idstr . ') WHERE artefact IN (' . $idstr . ')
...@@ -1488,7 +1492,8 @@ class ArtefactTypeFile extends ArtefactTypeFileBase { ...@@ -1488,7 +1492,8 @@ class ArtefactTypeFile extends ArtefactTypeFileBase {
HAVING COUNT(aff1.artefact) IN HAVING COUNT(aff1.artefact) IN
(SELECT COUNT(aff2.artefact) (SELECT COUNT(aff2.artefact)
FROM {artefact_file_files} aff2 FROM {artefact_file_files} aff2
WHERE aff1.fileid = aff2.fileid)' WHERE aff1.fileid = aff2.fileid)
)'
); );
// The current rule is that file deletion should be logged in the artefact_log table // The current rule is that file deletion should be logged in the artefact_log table
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment