Page MenuHomePhabricator

EditPage is not working with WikiPage
Open, Needs TriagePublic

Description

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CollaborationKit/+/573647/6/includes/content/CollaborationHubContent.php#1189

EditPage is not working with WikiPage since 2012-01
EditPage uses $page->getContext()
Most of external Extensions also use similar logic

Petr Pchelko says:

However, this is a hook handler for CustomEditor hook. The documentation[1] for the CustomEditor hook states, that $page is an instance of Page. Page can be either Article or WikiPage. Same is stated in the phpdoc comment. Because of this, the caller, EditAction, can actually pass a WikiPage instance, which the hook will silently ignore now.
What is the end goal here? To make the 'CustomEditor' hook accept only Article? If that is the case, phpdoc comment is incorrect. If the goal is to make the hook accept WikiPage|Article - the hook should indeed work with both.


What is the end goal here?

Better to avoid using of Article::getContext everywhere

If the goal is to make the hook accept WikiPage|Article - the hook should indeed work with both.

EditAction can't work with both Page type now

So We must construct Article from WikiPage and use it (I not sure about the problem of using)
Or create a new EditWikiPageAction with WikiPage support without getContext wrapper/hack (if it's possible)
Or declare supporting only for Article, because Hooks with WikiPage just ignored now(bad work)