xibosignage / xibo

Xibo Digital Signage
https://xibosignage.com
GNU Affero General Public License v3.0
547 stars 160 forks source link

Tidy Library: Unexpected error when using Tidy Library option #3431

Open ifarzana opened 1 month ago

ifarzana commented 1 month ago

CMS Version: 2.3.17 and 3.0.0

Issue: The Tidy Library function is attempting to remove media that is still being referenced by a saved report, which is not currently in use.

Steps:

  1. Create a Report Schedule and Run task to generate a saved report
  2. From the Report Schedule grid click on Reset to Previous run (which will make the saved report as unused)
  3. Go to the Settings page
  4. Click on Tidy Library
  5. Check Remove all media not currently in use?
  6. Click Yes

We encountered the following error: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (cms.saved_report, CONSTRAINT saved_report_ibfk_2 FOREIGN KEY (mediaId) REFERENCES media (mediaId))