mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-12-01 04:40:45 +09:00
Add stored_filename attribute for downloadable files (#3670)
* Add `stored_filename` for downloadable files * Remove orphaned stored files when a new downloadable file is uploaded When uploading a new product file or directly replacing a service's file, the old stored_filename was left on disk indefinitely. - Add isStoredFilenameReferenced() to check whether a stored filename is still referenced by any product config, order config, or service_downloadable row before deleting. - Add removeStoredFileIfOrphaned() that deletes the physical file only when no references remain (protects against the patch65 migration scenario where one stored_filename may be shared by multiple sibling records). - In uploadProductFile(), capture the old stored filename before saving the new config and remove it after all records are updated. - In updateProductFile(), capture the old stored filename when a new file is directly uploaded for a service/order and remove it after all records are updated. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
05b3395c2b
commit
bb1f7079e9
5 files changed
+332
-28
No files matched your search
@@ -938,6 +938,7 @@ CREATE TABLE `service_downloadable` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`client_id` bigint(20) DEFAULT NULL,
|
||||
`filename` varchar(100) DEFAULT NULL,
|
||||
`stored_filename` varchar(100) DEFAULT NULL,
|
||||
`downloads` int(11) DEFAULT NULL,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
|
||||
Reference in new issue
Block a user