Prevent files from being deleted upon module deletion if they belong to documents or comments that have since been moved to a different module

This commit is contained in:
Kijin Sung 2025-03-13 22:57:38 +09:00
parent b213fc1968
commit beec50f217
2 changed files with 39 additions and 4 deletions

View file

@ -1723,14 +1723,18 @@ class FileController extends File
// Get a full list of attachments
$args = new stdClass;
$args->module_srl = $module_srl;
$output = executeQueryArray('file.getModuleFiles', $args);
if(!$output->toBool() || empty($file_list = $output->data))
$output = executeQueryArray('file.getModuleFilesProper', $args);
if (!$output->toBool())
{
return $output;
}
if (!$output->data)
{
return;
}
// Delete the file
return $this->deleteFile($file_list);
// Delete each file.
return $this->deleteFile($output->data);
}
/**