1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-03-13 04:44:53 +01:00
phorge-phorge/src/applications/files
Dylan F 2b7c0ec92f Destroy file attachments when file is deleted, or object is deleted
Summary:
Adds file attachment deletion logics:

- PhabricatorFile: delete the attachment if file is deleted
- destruction engine extension: delete attachment if object is deleted
- SQL patch: delete existing leftover attachments from deleted files

To apply the cleanup, as usual, run:

    ./bin/storage upgrade

This cleanup may take some time, proportionally to the size of these tables:

    phabricator_file.file
    phabricator_file.file_attachment

Just as an indication: the storage upgrade, in a Phorge with `file` count 1.3M rows and `file_attachment` consisting in 9K rows, it may delete 170K rows in less than 1 second on average hardware.

Closes T15110

Test Plan:
Apply the patch, run `./bin/storage/upgrade`:

- no "Unknown Object" in any "Referenced Files" curtain of any object.

Have phd daemon running.

Upload file, attach the file to a task, delete the file from the web interface:

- no "Unknown Object" in "Referenced Files" curtain of that task.
- the query `SELECT * FROM file_attachment WHERE filePHID = '<file phid>'` returns empty result

Upload file, attach the file to a task, delete the task from the `./bin/remove destroy` workflow:

- the query `SELECT * FROM file_attachment WHERE objectPHID = '<task phid>'` returns empty result

Reviewers: O1 Blessed Committers, avivey, valerio.bozzolan

Reviewed By: O1 Blessed Committers, avivey, valerio.bozzolan

Subscribers: Ekubischta, speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Tags: #files

Maniphest Tasks: T15110

Differential Revision: https://we.phorge.it/D25051
2024-08-10 22:16:53 +02:00
..
action Simplify implementation of "SysetemAction->getSystemActionConstant()" 2019-07-19 15:45:37 -07:00
application Show more in Application Detail and List view 2023-11-21 11:22:23 -07:00
applicationpanel Allow diffusion.filecontentquery to load data for arbitrarily large files 2016-01-21 09:52:43 -08:00
builtin Avoid exception setting project profile image when GD not installed 2024-01-23 15:10:56 +01:00
capability Add default policy to Files application 2014-11-21 11:17:20 -08:00
conduit Fix PHP 8.1 "base64_decode(null)" exception calling Conduit's file.upload with no data passed 2023-06-11 16:34:16 +02:00
config Enforce viewable MIME types config on PDF documents 2023-11-13 00:12:50 +08:00
constants Prettier file embeds 2016-11-27 14:57:06 -08:00
controller Fix PHP 8.1 "strlen(null)" exception opening a File overlay (Lightbox comment frame) 2023-07-05 19:38:44 +02:00
diff Fix two rendering issues with Jupyter notebooks 2020-05-22 11:53:55 -07:00
document Fix PHP 8.1 "strlen(null)" exception rendering files/documents 2024-05-15 17:30:58 +02:00
editor Make misc get*ApplicationClass[Name]() calls return ::class constant instead of string 2024-02-05 14:11:36 +01:00
engine Fix 404 link in Diviner to "Configuring File Storage" article 2024-08-07 17:40:55 +02:00
engineextension Destroy file attachments when file is deleted, or object is deleted 2024-08-10 22:16:53 +02:00
exception Store and verify content integrity checksums for files 2017-04-05 11:12:31 -07:00
favicon Recover more gracefully when favicon configuration points at a corrupt/damaged file 2018-04-27 12:02:32 -07:00
format Fix some test suite stragglers with PHP 8.1 compatibility 2022-05-19 12:04:09 -07:00
garbagecollector Implement ngram search for File objects 2017-04-17 17:37:20 -07:00
iconset Fix call to non-existing newIcons() in PhabricatorIconSet 2024-06-05 17:15:45 +02:00
keyring Support AES256 at-rest encryption in Files 2016-06-16 08:08:56 -07:00
lipsum Make bin/lipsum generate hanldle generator keys and arguments more clearly 2017-02-27 09:09:28 -08:00
mail Remove "metamta.*.subject-prefix" options 2019-01-17 19:18:50 -08:00
management Fix PHP 8.1 "strlen(null)" exception for "/bin/files encode" without --as parameter 2024-04-17 09:16:58 +02:00
markup Fix PHP 8.1 exceptions which block adding an embedded File preview as a Comment 2023-05-23 11:55:03 +02:00
phid Make misc get*ApplicationClass[Name]() calls return ::class constant instead of string 2024-02-05 14:11:36 +01:00
query Make misc get*ApplicationClass[Name]() calls return ::class constant instead of string 2024-02-05 14:11:36 +01:00
storage Destroy file attachments when file is deleted, or object is deleted 2024-08-10 22:16:53 +02:00
transform Fix view policy inheritance on image transforms 2023-11-12 07:09:10 +08:00
typeahead Make misc get*ApplicationClass[Name]() calls return ::class constant instead of string 2024-02-05 14:11:36 +01:00
uploadsource Support export of data in files larger than 8MB 2018-01-29 15:58:34 -08:00
view Fix numerous PHP 8.1 "strlen(null)" exceptions preventing homepage to display 2023-04-27 14:08:48 +02:00
worker Make daemons perform file deletion 2017-04-18 11:09:41 -07:00
xaction Fix PHP 8.1 "strlen(null)" exception removing custom alt text from image file 2023-11-28 14:52:00 +01:00
PhabricatorImageTransformer.php Somewhat improve meme transform code so it is merely very bad 2018-03-08 11:08:55 -08:00