Move attachments issues & lack of documentation

General discussion of Mantis.

Moderators: Developer, Contributor

Post Reply
Alex_Sitnam
Posts: 1
Joined: 31 Aug 2023, 15:29

Move attachments issues & lack of documentation

Post by Alex_Sitnam »

Hello folks,

Posting here as I couldn't find any documentation in the internet regarding the admin system utility to move attachments (from db) to disk.

After testing this feature, I have noted the following caveats with the move attachment utility:

# Please feel free to correct me if I am wrong.

1- Attachments cannot be moved unless $g_file_upload_method is set to "DISK".

After hitting the "Move Attachments to Disk" button, a query to search the number of attachments to move and their project is performed, which brings you to the next window where you can see the results. However, one can only select/check the attachments to move if $g_file_upload_method is set to "DISK".

2- Executing this query can take some time to complete, depending on your database, which might lead to wasted time.

Arguably, if one needs/wants to move attachments to "DISK" from "DATABASE", it is safe to assume that person currently has or had at some point $g_file_upload_method to "DATABASE". I am no php developer but introducing a check to validate whether $g_file_upload_method is set to the correct option previous to executing this query, should be an easy and fast solution to avoid this problem. Alternatively, a functionality change to allow moving attachments despite the value of $g_file_upload_method.

3- This process can easily exceed decent values of php's memory_limit and/or max_execution_time.

This also relates to #2, leading to wasted time(and possibly corrupting data?) given that the `memory_limit` is exceeded. A simple warning message telling the user about this can possibly help in this regard. See error message:
"Fatal error: Allowed memory size of 3221225472 bytes exhausted (tried to allocate 97612888 bytes) in /path/to/mantis/vendor/adodb/adodb-php/drivers/adodb-mysqli.inc.php on line 808"
I love the mantis project, and it has been extremely stable for many years, which is why I believe that these should be addressed and/or documented in some form even though not many people might use this feature.

Thanks a lot,
Regards A.
Post Reply