Bug 38352

Summary: cleanup_database.pl is not deleting the upload file from the server
Product: Koha Reporter: Aleisha Amohia <aleisha>
Component: Command-line UtilitiesAssignee: Bugs List <koha-bugs>
Status: CLOSED WORKSFORME QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: robin
Version: 24.05   
Hardware: All   
OS: All   
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:

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!