Page MenuHomePhabricator

Find replacement for EditPage::$textbox2 and deprecate the public access
Closed, ResolvedPublic

Description

After deprecation of EditPage::$textbox2 there was a production error T305028

Find a long term solution to allow extensions consuming the content of the second textbox with the EditPageBeforeConflictDiff hook.

More details:

I just had a look at this code again and realized that we are talking about an EditPageBeforeConflictDiff hook handler here. A hook that is called when a conflict happened, right before the normal conflict handling screen would be shown to the user, to give extensions (like Two-Column-Edit-Conflict-Merge) a chance to give the user something different instead. That's how it's documented on mediawiki.org since 2008. To do this it must be possible to access both versions of the conflicting content. Accessing the version that's already in the database is not a problem. But the conflicting one doesn't exist anywhere but in memory at this point, specifically in EditPage::$textbox2.

Problem is: The only parameters of the hook are the EditPage instance that just called the hook (i.e. $this) and the current OutputPage. There is no parameter for the conflicting text. It appears like the hook was build with the assumption that it can access EditPage::$textbox2. From today's perspective that wasn't good design. But it is what it is.

Possible ways forward include a new public getter that returns the contents of EditPage::$textbox2. Hook handlers can call this. Or we append EditPage::$textbox2 as a new parameter to the hook. The hook appears to be rarely used, so it's probably not much of a problem to change, replace, or even remove it (after replacing all known callers with something else that works for them).

At the moment the WMDE team doesn't have much resources for something like this that seems to be more on the nice-to-have side of things, unless we are told this is urgent and blocks other teams. I see this is now linked to T252907, but textbox2 is currently not mentioned there. I suggest to close this logspam ticket here and make a new one to track the usages, changes or possibly even the deprecation of the EditPageBeforeConflictDiff hook. Please link or copy what we analyzed here. I hope it will be helpful.