Page MenuHomePhabricator

Stop using global RequestContext in EditFilterHookRunner service wiring
Closed, ResolvedPublic

Description

Modify the EditFilterHookRunner so that we are able to construct it without passing a context, we can do this by passing the context into run instead and using that context to obtain the user. See WIP in 679751.

This probably involves changing MediawikiEditEntityFactory::newEditEntity to accept a context parameter instead of the first user parameter.

Event Timeline

Main plan:

  • Wikibase: make MediawikiEditEntityFactory::newEditEntity() accept first argument as IContextSource or User, and update callers
  • WikibaseLexeme: call newEditEntity() with a context instead of a user
  • Wikibase: make newEditEntity() pass context rather than user into EditFilterHookRunner; change EditFilterHookRunner::run()’s second argument from User to IContextSource; make it use that context everywhere (with the code to ensure it’s a MutableContext taken from the constructor); remove IContextSource constructor argument (fortunately it’s the last one, so removing it is not a breaking change)

Independently:

  • WikibaseLexeme: get MediawikiEditFilterHookRunner from service container

Change 681029 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/WikibaseLexeme@master] Get EditFilterHookRunner from service container

https://gerrit.wikimedia.org/r/681029

Insert into the main plan:

  • Wikibase: make EntityRedirectCreationInteractor constructor accept fifth argument as IContextSource or User, and update callers
  • WikibaseLexeme: change MediaWikiLexemeRedirector constructor’s fifth argument from User to IContextSource
  • Wikibase: change EntityRedirectCreationInteractor constructor’s fifth argument to just IContextSource, update its call to EditFilterHookRunner::run()

I think the first two I’ll do as separate commits, and the last one merge into the other big Wikibase change.

Change 681072 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Make newEditEntity() accept context argument

https://gerrit.wikimedia.org/r/681072

Change 681073 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Make EntityRedirectCreationInteractor accept context argument

https://gerrit.wikimedia.org/r/681073

Change 681074 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/WikibaseLexeme@master] Pass context instead of user into newEditEntity()

https://gerrit.wikimedia.org/r/681074

Change 681075 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/WikibaseLexeme@master] Pass context instead of user into EntityRedirectCreationInteractor

https://gerrit.wikimedia.org/r/681075

Change 681076 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Pass context into MediawikiEditEntity and EditFilterHookRunner

https://gerrit.wikimedia.org/r/681076

Change 681029 merged by jenkins-bot:

[mediawiki/extensions/WikibaseLexeme@master] Get EditFilterHookRunner from service container

https://gerrit.wikimedia.org/r/681029

Change 681072 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Make newEditEntity() accept context argument

https://gerrit.wikimedia.org/r/681072

Change 681074 merged by jenkins-bot:

[mediawiki/extensions/WikibaseLexeme@master] Pass context instead of user into newEditEntity()

https://gerrit.wikimedia.org/r/681074

Change 681073 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Make EntityRedirectCreationInteractor accept context argument

https://gerrit.wikimedia.org/r/681073

Change 681075 merged by jenkins-bot:

[mediawiki/extensions/WikibaseLexeme@master] Pass context instead of user into EntityRedirectCreationInteractor

https://gerrit.wikimedia.org/r/681075

Change 681076 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Pass context into MediawikiEditEntity and EditFilterHookRunner

https://gerrit.wikimedia.org/r/681076