Skip to content

HFP-3065 Allow to delete library if circular dependency#101

Open
otacke wants to merge 1 commit into
h5p:masterfrom
otacke:HFP-3065-delete-with-circular-dependency
Open

HFP-3065 Allow to delete library if circular dependency#101
otacke wants to merge 1 commit into
h5p:masterfrom
otacke:HFP-3065-delete-with-circular-dependency

Conversation

@otacke
Copy link
Copy Markdown
Contributor

@otacke otacke commented Jun 4, 2021

A long time ago in a galaxy far far away, the H5PLibraryList class 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_libraries database table.

When merged in, the H5PLibraryList class will now check the library data for a hasCircularEditorDepencendy flag 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 hasCircularEditorDepencendy flag 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.

@otacke otacke changed the title H5P-3065 Allow to delete library if circular dependency HFP-3065 Allow to delete library if circular dependency Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant