Repository navigation
feat!: report the usages of media, media categories and articles via typed extension points - #6780
Merged
Merged
Conversation
…typed extension points The usage checks collect their findings in a `UsageList` (group, label, url as plain text), which renders the list centrally, instead of extensions building and escaping HTML snippets themselves. MEDIA_IS_IN_USE -> MediaPool\ExtensionPoint\MediaUsageCheck MEDIA_CATEGORY_IS_IN_USE -> MediaPool\ExtensionPoint\MediaCategoryUsageCheck (new) -> Content\ExtensionPoint\ArticleUsageCheck `MediaPool::mediaIsInUse()` and `MediaCategoryHandler::isInUse()` are replaced by `findUsages()`, which return the `UsageList`; `ArticleHandler::findUsages()` is added. Deleting an article now also checks the article picker meta fields (skipping the article itself and its category) and lists the usages like the media pool does. Usage links are plain links now; in the media pool popup, links leading out of the media pool open in the main window.
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.
The in-use checks of media and media categories become typed extension points, and articles get the same check, so addons can block the deletion of an article they still reference (e.g. YForm relations).
Changes
Util\UsageList: extensions add usages viaadd($group, $label, ?$url)(all plain text); the core renders and escapes the list in one place. Extensions no longer build HTML snippets.$usages):MEDIA_IS_IN_USE→MediaPool\ExtensionPoint\MediaUsageCheckMEDIA_CATEGORY_IS_IN_USE→MediaPool\ExtensionPoint\MediaCategoryUsageCheckContent\ExtensionPoint\ArticleUsageCheckMediaPool::mediaIsInUse()andMediaCategoryHandler::isInUse()are replaced byfindUsages()returning theUsageList;ArticleHandler::findUsages()is added. The rector mappings to the old methods are removed, since the signatures changed.MetaInfo\MediaUsagebecomesMetaInfo\MetaUsagewithaddMediaUsages()andaddArticleUsages(), called directly (no extension point). Articles referenced in article picker meta fields can no longer be deleted; the article itself and the category it is the start article of are skipped.openPage()only works in the media pool popup, somediapool.jsredirects usage links leading out of the media pool to the main window only there.minfo_media_in_use_*→minfo_usage_*,pool_file_in_use_articles→usage_articles_content.Testing
UsageListand for an extension blocking the deletion viaArticleUsageCheck.