HFP-3065 Allow to delete library if circular dependency#101
Open
otacke wants to merge 1 commit into
Open
Conversation
This was referenced Sep 24, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A long time ago in a galaxy far far away, the
H5PLibraryListclass was created to allow H5P library management - including deletion of libraries. Libraries cannot be deleted, of course, if some content or library still depends on it.Unfortunately, it is possible that a content library is used for the view and the editor alike, e.g. Course Presentation. H5P.CoursePresentation has an "editor" dependency to H5PEditor.CoursePresentation, and H5PEditor.CoursePresentation has a "preloaded" dependency to H5P.CoursePresentation. This direct circular dependency prevents both libraries from being deleted (without manually modifying the relevant entries in the
h5p_libraries_librariesdatabase table.When merged in, the
H5PLibraryListclass will now check the library data for ahasCircularEditorDepencendyflag that needs to be set in the integration. If set and the respective editor library is the only library that requires the library at stake, then it is safe to delete it and the delete button will not be disabled.Setting the
hasCircularEditorDepencendyflag if appropriate and allowing the library to be deleted needs implementation in the integrations. There's a pull request for the WordPress plugin as a reference at h5p/h5p-wordpress-plugin#125. It could easily be ported to other integrations if this pull request is accepted.