Bug 38352 - cleanup_database.pl is not deleting the upload file from the server
Summary: cleanup_database.pl is not deleting the upload file from the server
Status: CLOSED WORKSFORME
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: 24.05
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-05 03:51 UTC by Aleisha Amohia
Modified: 2024-11-06 00:46 UTC (History)
1 user (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Crowdfunding committed: 0
Crowdfunding contact:
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aleisha Amohia 2024-11-05 03:51:50 UTC
When running cleanup_database.pl with --temp-uploads it should delete the associated file from the server when it clears the record from the uploaded_files table in the database.

This works as expected in main/upstream.

It does not appear to work in 24.05.x

Severity = normal because this could cause the disk to fill up and break uploads of all types including staging MARC files.

To reproduce:

1. Check out origin/main
2. Go to Tools -> Upload and upload a temporary file (not using an upload category)
3. In your KTD, look at the files in /var/lib/koha/kohadev/tmp/koha_kohadev_upload/ and notice your upload is there
4. Run cleanup_database.pl like

koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/cleanup_database.pl --confirm --temp-uploads --verbose

5. Confirm your uploaded file is gone from the Uploads interface in Koha, and from /var/lib/koha/kohadev/tmp/koha_kohadev_upload/

6. Repeat the above plan with 24.05.x checked out and notice the file is still in /var/lib/koha/kohadev/tmp/koha_kohadev_upload/
Comment 1 Aleisha Amohia 2024-11-06 00:46:51 UTC
I think maybe this actually does work ... not sure what I was doing wrong yesterday!