Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

otacke
Copy link
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, this pull request will check for a direct circular dependency (no transitive circles of more than two libraries) when calling getLibraryUsage() and set a hasCircularEditorDepencendy flag in the return value if appropriate. That flag will be used to check whether a library can be deleted (if the respective editor library is the only library that requires the library at stake) or not.

In order to allow deletion using the GUI of the H5PLibraryList class, the pull request for the H5P core at h5p/h5p-php-library#101 will have to me merged in as well.

This pull request could easily be ported to other integrations if it is accepted.

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