De-globalize EditPage.php and use RequestContext instead
Closed, ResolvedPublic

Description

EditPage uses a ton of global objects ($wgOut, $wgUser, etc.). These should be replaced with the appropriate RequestContext function instead.

A getContext() function and $this->context member variable were added in rMW841c4076574b: EditPage: Add getContext() function.

Then, four commits were made to switch global objects out for context equivalents (1000 line chunks):

These were reverted in rMW5ce43a986133: Revert serie of "EditPage: Use context instead of globals" due to breakage in LiquidThreads: T143889: Replies impossible: The content format json is not supported by the content model.

We need to check other Wikimedia-deployed extensions and then re-apply the de-globalization change.

  • $wgAjaxEditStash: 2 uses
  • $wgAllowUserCss: 2 uses
  • $wgAllowUserJs: 2 uses
  • $wgBrowserBlackList: 3 uses - gone with T67297: Remove $wgBrowserBlackList and associated EditPage methods
  • $wgContentHandlerUseDB: 3 uses
  • $wgContLang: 5 uses - OK, no context based replacement
  • $wgEnableUploads: 1 use - static
  • $wgForeignFileRepos: 2 uses - static
  • $wgLang
  • $wgMaxArticleSize: 4 uses
  • $wgOut: 2 uses - remaining uses will go away with T30856: Remove classic edit toolbar from core
  • $wgParser: 8 uses - OK, no context based replacement
  • $wgPreviewOnOpenNamespaces: 3 uses
  • $wgRawHtml: 2 uses
  • $wgRequest: 13 uses
  • $wgRightsText: 3 uses - static
  • $wgSpamRegex: 4 uses - static
  • $wgSummarySpamRegex: 3 uses - static
  • $wgTitle: 3 uses - only as fallback. Follow-up is T176526: Remove $wgTitle fallback from EditPage in MW1.33
  • $wgUseMediaWikiUIEverywhere: 2 uses
  • $wgUser
Legoktm created this task.Aug 31 2016, 7:46 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 31 2016, 7:46 AM

grep on tin:

1legoktm@tin:/srv/mediawiki-staging/php-1.28.0-wmf.17/extensions$ ack-grep "EditPage" --php
2ContentTranslation/ContentTranslation.hooks.php
3194: * Hook: EditPage::showEditForm:initial
4196: public static function newArticleCampaign( EditPage $newPage, OutputPage $out ) {
5
6MobileFrontend/includes/skins/SkinMinerva.php
7963: $menu['edit'] = $this->createEditPageAction();
8988: protected function createEditPageAction() {
9
10LiquidThreads/classes/View.php
11514: $e = new EditPage( $article );
12631: $e = new EditPage( $article );
13744: $e = new EditPage( $article );
14847: $e = new EditPage( $article );
151808: // as it would involve rewriting EditPage, which I do NOT intend to do.
162075: Hooks::run( 'EditPageBeforeEditToolbar', array( &$html ) );
17
18LiquidThreads/classes/Hooks.php
19306: * @param $editPage EditPage
20
21LiquidThreads/api/ApiThreadAction.php
223:class ApiThreadAction extends ApiEditPage {
23
24TemplateSandbox/TemplateSandbox.hooks.php
254: * Hook for EditPage::importFormData to parse our new form fields, and if
2610: * @param EditPage $editpage
2747: * @param EditPage $editpage
28124: ' [[#' . EditPage::EDITFORM_ID . '|' . $wgLang->getArrow() . ' ' .
29178: * Hook for EditPage::showStandardInputs:options to add our form fields to
30181: * @param EditPage $editpage
31
32TemplateSandbox/SpecialTemplateSandbox.php
33106: if ( is_callable( 'EditPage::getPreviewLimitReport' ) ) {
34108: EditPage::getPreviewLimitReport( $this->output ) ) );
35
36EventLogging/includes/JsonSchemaHooks.php
3761: * @param EditPage $editor
38
39WikimediaMessages/WikimediaMessages.hooks.php
40158: public static function onEditPageCopyrightWarning( $title, &$msg ) {
41
42ProofreadPage/includes/index/EditProofreadIndexPage.php
4323:class EditProofreadIndexPage extends EditPage {
44
45ProofreadPage/includes/page/EditPagePage.php
467:use EditPage;
4717:class EditPagePage extends EditPage {
4849: * @see EditPage::isSectionEditSupported
4956: * @see EditPage::isSupportedContentModel
5065: * @see EditPage::showContentForm
5175: * @see EditPage::showContentForm
52143: * @see EditPage::getCheckBoxes
53192: * @see EditPage::importContentFormData
54209: * @see EditPage::internalAttemptSave
55
56ProofreadPage/includes/page/PageSubmitAction.php
5721: $editor = new EditPagePage( $this->page, $pagePage, Context::getDefaultContext() );
58
59ProofreadPage/includes/page/PageEditAction.php
6021: $editor = new EditPagePage( $this->page, $pagePage, Context::getDefaultContext() );
61
62ProofreadPage/ProofreadPage.body.php
63627: $ourStatus->value = EditPage::AS_HOOK_ERROR;
64
65GlobalCssJs/GlobalCssJs.hooks.php
66115: * @param EditPage $editPage
67119: static function onEditPageshowEditForminitial( EditPage $editPage, OutputPage $output ) {
68
69SemanticForms/includes/SF_AutoeditAPI.php
70340: protected function setupEditPage( $targetContent ) {
71354: $editor = new EditPage( $article );
72412: Hooks::run( 'EditPage::showEditForm:initial', array( &$editor, &$wgOut ) );
73432: protected function doStore( EditPage $editor ) {
74476: case EditPage::AS_HOOK_ERROR_EXPECTED: // A hook function returned an error
75481: Hooks::register('EditPageBeforeEditButtons', function( &$editor, &$buttons, &$tabindex ){
76495: case EditPage::AS_CONTENT_TOO_BIG: // Content too big (> $wgMaxArticleSize)
77496: case EditPage::AS_ARTICLE_WAS_DELETED: // article was deleted while editting and param wpRecreate == false or form was not posted
78497: case EditPage::AS_CONFLICT_DETECTED: // (non-resolvable) edit conflict
79498: case EditPage::AS_SUMMARY_NEEDED: // no edit summary given and the user has forceeditsummary set and the user is not editting in his own userspace or talkspace and wpIgnoreBlankSummary == false
80499: case EditPage::AS_TEXTBOX_EMPTY: // user tried to create a new section without content
81500: case EditPage::AS_MAX_ARTICLE_SIZE_EXCEEDED: // article is too big (> $wgMaxArticleSize), after merging in the new section
82501: case EditPage::AS_END: // WikiPage::doEdit() was unsuccessfull
83505: case EditPage::AS_HOOK_ERROR: // Article update aborted by a hook function
84513:// case EditPage::AS_PARSE_ERROR: // can't parse content
85518: case EditPage::AS_SUCCESS_NEW_ARTICLE: // Article successfully created
86534: case EditPage::AS_SUCCESS_UPDATE: // Article successfully updated
87562: case EditPage::AS_BLANK_ARTICLE: // user tried to create a blank page
88571: case EditPage::AS_SPAM_ERROR: // summary contained spam according to one of the regexes in $wgSummarySpamRegex
89580: case EditPage::AS_BLOCKED_PAGE_FOR_USER: // User is blocked from editting editor page
90583: case EditPage::AS_IMAGE_REDIRECT_ANON: // anonymous user is not allowed to upload (User::isAllowed('upload') == false)
91584: case EditPage::AS_IMAGE_REDIRECT_LOGGED: // logged in user is not allowed to upload (User::isAllowed('upload') == false)
92587: case EditPage::AS_READ_ONLY_PAGE_ANON: // editor anonymous user is not allowed to edit editor page
93588: case EditPage::AS_READ_ONLY_PAGE_LOGGED: // editor logged in user is not allowed to edit editor page
94591: case EditPage::AS_READ_ONLY_PAGE: // wiki is in readonly mode (wfReadOnly() == true)
95594: case EditPage::AS_RATE_LIMITED: // rate limiter for action 'edit' was tripped
96597: case EditPage::AS_NO_CREATE_PERMISSION: // user tried to create editor page, but is not allowed to do that ( Title->usercan('create') == false )
97992: $editor = $this->setupEditPage( $targetContent );
98
99SemanticForms/includes/SF_Hooks.php
10074: $GLOBALS['wgEditPageFrameOptions'] = 'SAMEORIGIN';
101305: public static function showFormPreview( EditPage $editpage, WebRequest $request ) {
102
103SemanticForms/includes/SF_FormUtils.php
10499: // this code borrowed from /includes/EditPage.php
105263: // Much of this function is based on MediaWiki's EditPage::showEditForm()
106299: // based on MediaWiki's EditPage::getPreloadedText()
107
108SemanticForms/includes/SF_FormPrinter.php
109702: // $userCanEditPage = ( $wgUser->isAllowed( 'edit' ) && $this->mPageTitle->userCan( 'edit' ) );
110709: $userCanEditPage = count( $permissionErrors ) == 0;
111710: Hooks::run( 'sfUserCanEditPage', array( $this->mPageTitle, &$userCanEditPage ) );
112713: if ( $is_query || $userCanEditPage ) {
113718: // Based on code in MediaWiki's EditPage.php.
114947: // borrowed from EditPage::showEditTools()
115
116SemanticForms/includes/forminputs/SF_TextAreaInput.php
117166: $editPage = new EditPage( $article );
118
119SemanticForms/SemanticForms.php
120148:$GLOBALS['wgHooks']['EditPage::importFormData'][] = 'SFHooks::showFormPreview';
121264:$GLOBALS['wgEditPageFrameOptions'] = 'SAMEORIGIN';
122
123Math/Math.hooks.php
124391: static function onEditPageBeforeEditToolbar( &$toolbar ) {
125
126Wikidata/extensions/Wikibase/repo/includes/EditEntity.php
127772: * @note Keep in sync with logic in EditPage!
128791: * @note Keep in sync with logic in EditPage!
129
130Wikidata/extensions/Wikibase/repo/includes/Api/ResultBuilder.php
1311114: // like core's ApiEditPage
132
133Wikidata/extensions/Wikibase/repo/includes/Store/Sql/WikiPageEntityStore.php
134323: * @see EditPage::userWasLastToEdit()
135364: * @note keep in sync with logic in EditPage
136
137Wikidata/extensions/Wikibase/repo/includes/Actions/EditEntityAction.php
138446: * Generate standard summary input and label (wgSummary), compatible to EditPage.
139
140Wikidata/extensions/Wikibase/repo/Wikibase.hooks.php
1416:use ApiEditPage;
142550: * This implementation causes the execution of ApiEditPage (action=edit) to fail
143565: if ( $module instanceof ApiEditPage ) {
144575: // trying to use ApiEditPage on an entity namespace
145
146Wikidata/extensions/Wikibase/repo/tests/phpunit/includes/Api/EditPageTest.php
14721: * @group EditPageTest
14827:class EditPageTest extends WikibaseApiTestCase {
14937: $item->setLabel( "en", "EditPageTest" );
15040: $item->setLabel( "de", "EditPageTest" );
151
152Wikidata/extensions/Wikibase/lib/includes/Store/EntityStore.php
153104: * @see EditPage::userWasLastToEdit()
154
155Wikidata/extensions/Wikibase/lib/tests/phpunit/MockRepository.php
156565: * @see EditPage::userWasLastToEdit
157
158Wikidata/vendor/composer/autoload_classmap.php
1591302: 'Wikibase\\Test\\Repo\\Api\\EditPageTest' => $baseDir . '/extensions/Wikibase/repo/tests/phpunit/includes/Api/EditPageTest.php',
160
161SpamBlacklist/SpamBlacklistHooks.php
16265: // Always return true, EditPage will look at $status->isOk().
163119: * @param $editPage EditPage
164
165WikimediaEvents/WikimediaEventsHooks.php
166375: * @see https://www.mediawiki.org/wiki/Manual:Hooks/EditPageBeforeConflictDiff
167377: * @param EditPage &$editor
168381: public static function onEditPageBeforeConflictDiff( &$editor, &$out ) {
169
170UploadWizard/includes/CampaignHooks.php
171126: * @param EditPage $editor
172
173Translate/tag/PageTranslationHooks.php
174389: * edit conflict if there wasn't tpSyntaxCheckForEditPage.
175
176Translate/utils/TranslationHelpers.php
177635: $jsEdit = TranslationEditPage::jsEdit( $target, $groupId, 'dialog' );
178
179Translate/utils/MessageTable.php
180193: $linkAttribs += TranslationEditPage::jsEdit( $title, $this->group->getId() );
181
182Translate/utils/TranslationEditPage.php
18315:class TranslationEditPage {
18432: * @return TranslationEditPage
185
186Translate/specials/SpecialTranslate.php
18761: $editpage = TranslationEditPage::newFromRequest( $request );
188
189Translate/TranslateEditAddons.php
19022: public static function suppressIntro( EditPage $editPage ) {
19163: * Hook: EditPage::showEditForm:initial
19265: public static function addTools( EditPage $object ) {
19379: * Hook: EditPageBeforeEditButtons
19481: public static function buttonHack( EditPage $editpage, &$buttons, $tabindex ) {
195127: * @param EditPage $editpage
196130: private static function editBoxes( EditPage $editpage ) {
197
198Translate/Translate.php
199101:$wgHooks['EditPage::showEditForm:initial'][] = 'TranslateEditAddons::addTools';
200104:$wgHooks['EditPageBeforeEditButtons'][] = 'TranslateEditAddons::buttonHack';
201
202Translate/Autoload.php
203105:$al['TranslationEditPage'] = "$dir/utils/TranslationEditPage.php";
204
205MoodBar/MoodBar.hooks.php
206109: if ( class_exists('EditPageTracking') ) {
207110: return ((bool)EditPageTracking::getFirstEditPage( $skin->getUser() ) );
208
209MassMessage/includes/SpecialMassMessage.php
210150: $m['message']['help'] = EditPage::getCopyrightWarning( $this->getPageTitle( false ), 'parse' );
211263: * The preview generation code was hacked up from EditPage.php
212285: // Parser stuff. Taken from EditPage::getPreviewText()
213292: // Hooks not being run: EditPageGetPreviewContent, EditPageGetPreviewText
214
215MassMessage/includes/SpecialEditMassMessageList.php
216104: // Edit notices; modified from EditPage::showHeader()
217111: // Protection warnings; modified from EditPage::showHeader()
218212: return EditPage::getCopyrightWarning( $this->title, 'parse' );
219
220ConfirmEdit/includes/ConfirmEditHooks.php
22182: static function confirmEditPage( $editpage, $buttons, $tabindex ) {
222221: * @param EditPage $editor
223227: public static function onAlternateEditPreview( EditPage $editor, &$content, &$html, &$po ) {
224
225ConfirmEdit/SimpleCaptcha/Captcha.php
226180: * Show error message for missing or incorrect captcha on EditPage.
227181: * @param EditPage $editPage
228199: * @param EditPage $editPage
229909: $status->value = EditPage::AS_HOOK_ERROR_EXPECTED;
2301064: return $module instanceof ApiEditPage || $module instanceof ApiCreateAccount;
231
232WikiEditor/WikiEditor.hooks.php
233173: * EditPage::showEditForm:initial hook
234177: * @param EditPage $editPage the current EditPage object.
235231: * EditPage::showEditForm:fields hook
236235: * @param EditPage $editPage the current EditPage object.
237265: * EditPageBeforeEditToolbar hook
238272: public static function EditPageBeforeEditToolbar( &$toolbar ) {
239395: * This is attached to the MediaWiki 'EditPage::attemptSave' hook.
240397: * @param EditPage $editPage
241401: public static function editPageAttemptSave( EditPage $editPage ) {
242416: * This is attached to the MediaWiki 'EditPage::attemptSave:after' hook.
243418: * @param EditPage $editPage
244422: public static function editPageAttemptSaveAfter( EditPage $editPage, Status $status ) {
245439: if ( $status->value === EditPage::AS_CONFLICT_DETECTED ) {
246441: } elseif ( $status->value === EditPage::AS_ARTICLE_WAS_DELETED ) {
247
248TemplateData/TemplateData.hooks.php
24984: // Specify format the same way the API and EditPage do to avoid extra parsing
250102: * @param EditPage $editPage
251106: public static function onEditPage( $editPage, $output ) {
252
253Scribunto/Scribunto.php
25471:$wgHooks['EditPageBeforeEditChecks'][] = 'ScribuntoHooks::beforeEditChecks';
25572:$wgHooks['EditPage::showReadOnlyForm:initial'][] = 'ScribuntoHooks::showReadOnlyFormInitial';
25673:$wgHooks['EditPageBeforeEditButtons'][] = 'ScribuntoHooks::beforeEditButtons';
257
258Scribunto/common/Hooks.php
259325: * EditPageBeforeEditChecks hook
260327: * @param EditPage $editor
261332: public static function beforeEditChecks( EditPage &$editor, &$checkboxes, &$tabindex ) {
262342: * EditPage::showReadOnlyForm:initial hook
263344: * @param EditPage $editor
264347: public static function showReadOnlyFormInitial( EditPage $editor, OutputPage $output ) {
265356: * EditPageBeforeEditButtons hook
266358: * @param EditPage $editor
267363: public static function beforeEditButtons( EditPage &$editor, array &$buttons, &$tabindex ) {
268371: * @param EditPage $editor
269377: public static function validateScript( EditPage $editor, $text, &$error, $summary ) {
270
271TitleBlacklist/TitleBlacklist.hooks.php
272245: * @param $editor EditPage
273
274FlaggedRevs/backend/FlaggedRevs.hooks.php
275391: # Get edit timestamp. Existance already validated by EditPage.php.
276
277FlaggedRevs/frontend/FlaggedRevsUI.setup.php
27839: $hooks['EditPage::showEditForm:initial'][] = 'FlaggedRevsUIHooks::addToEditView';
27942: $hooks['EditPageBeforeEditButtons'][] = 'FlaggedRevsUIHooks::onBeforeEditButtons';
28044: $hooks['EditPageBeforeEditChecks'][] = 'FlaggedRevsUIHooks::addReviewCheck';
28145: $hooks['EditPage::showEditForm:fields'][] = 'FlaggedRevsUIHooks::addRevisionIDField';
28247: $hooks['EditPageNoSuchSection'][] = 'FlaggedRevsUIHooks::onNoSuchSection';
283
284FlaggedRevs/frontend/FlaggablePageView.php
285922: // HACK: EditPage invokes addToEditView() before this function, so $this->noticesDone
286923: // will only be true if we're being called by EditPage, in which case we need to do nothing
287929: // HACK fake EditPage
288930: $editPage = new EditPage( new Article( $title, $oldid ) );
289970: public function addToEditView( EditPage $editPage ) {
2901076: public function addToNoSuchSection( EditPage $editPage, &$s ) {
2911776: $extraQuery .= wfArrayToCgi( $params ); // note: EditPage will add initial "&"
2921785: public function changeSaveButton( EditPage $editPage, array &$buttons ) {
2931810: * @param EditPage $editPage
2941813: protected function editWillRequireReview( EditPage $editPage ) {
2951826: * @param EditPage $editPage
2961829: protected function editRequiresReview( EditPage $editPage ) {
2971841: * @param EditPage $editPage
2981844: protected function editWillBeAutoreviewed( EditPage $editPage ) {
2991873: public function addReviewCheck( EditPage $editPage, array &$checkboxes, &$tabindex ) {
3001922: public function addRevisionIDField( EditPage $editPage, OutputPage $out ) {
3011935: * @param EditPage $editPage
3021939: protected static function getBaseRevId( EditPage $editPage, WebRequest $request ) {
3031968: * @param EditPage $editPage
3041972: protected static function getAltBaseRevId( EditPage $editPage, WebRequest $request ) {
305
306VisualEditor/VisualEditorDataModule.php
30752: // Copyright warning (based on EditPage::getCopyrightWarning)
30862: // EditPage supports customisation based on title, we can't support that
30964: Hooks::run( 'EditPageCopyrightWarning', [ $title, &$copywarnMsgArgs ] );
310
311VisualEditor/ApiVisualEditor.php
312480: // HACK of course this code is partly duplicated from EditPage.php :(
313517: // HACK: Build a fake EditPage so we can get checkboxes from it
314519: $ep = new EditPage( $article );
315
316VisualEditor/VisualEditor.hooks.php
317390: * @param $editPage EditPage
318394: public static function onEditPageShowEditFormFields( EditPage $editPage, OutputPage $output ) {

From that grep, I've already checked or submitted patches for everything but SemanticForms and FlaggedRevs. Both of which look kind of scary.

New grep:

1Math/Math.hooks.php
2401: static function onEditPageBeforeEditToolbar( &$toolbar ) {
3
4CodeEditor/CodeEditor.hooks.php
545: * @param EditPage $editpage
6
7ParserMigration/includes/EditAction.php
815: $page = new MigrationEditPage( $this->getContext(), $this->getTitle() );
9
10ParserMigration/includes/MigrationEditPage.php
115:class MigrationEditPage extends \EditPage {
12
13JsonConfig/includes/JCSingleton.php
14669: $editor = new \EditPage( $article );
15732: public static function onEditPageCopyrightWarning( $title, &$msg ) {
16
17TemplateSandbox/SpecialTemplateSandbox.php
18103: EditPage::getPreviewLimitReport( $this->output ) ) );
19
20TemplateSandbox/TemplateSandbox.hooks.php
214: * Hook for EditPage::importFormData to parse our new form fields, and if
2210: * @param EditPage $editpage
2347: * @param EditPage $editpage
2453: public static function templateSandboxPreview( EditPage $editpage, &$content, &$out,
25130: ' [[#' . EditPage::EDITFORM_ID . '|' . $lang->getArrow() . ' ' .
26179: * Hook for EditPage::showStandardInputs:options to add our form fields to
27182: * @param EditPage $editpage
28
29FlaggedRevs/backend/FlaggedRevs.hooks.php
30400: # Get edit timestamp. Existance already validated by EditPage.php.
31
32FlaggedRevs/FlaggedRevs.php
33557:$wgHooks['EditPage::showEditForm:initial'][] = 'FlaggedRevsUIHooks::addToEditView';
34560:$wgHooks['EditPageBeforeEditButtons'][] = 'FlaggedRevsUIHooks::onBeforeEditButtons';
35563: $wgHooks['EditPageBeforeEditChecks'][] = 'FlaggedRevsUIHooks::onEditPageBeforeEditChecks';
36565: $wgHooks['EditPageGetCheckboxesDefinition'][] =
37566: 'FlaggedRevsUIHooks::onEditPageGetCheckboxesDefinition';
38568:$wgHooks['EditPage::showEditForm:fields'][] = 'FlaggedRevsUIHooks::addRevisionIDField';
39570:$wgHooks['EditPageNoSuchSection'][] = 'FlaggedRevsUIHooks::onNoSuchSection';
40
41FlaggedRevs/frontend/FlaggedRevsUI.hooks.php
42684: public static function onEditPageBeforeEditChecks( $editPage, &$checks, &$tabindex ) {
43690: public static function onEditPageGetCheckboxesDefinition( $editPage, &$checkboxes ) {
44
45FlaggedRevs/frontend/FlaggablePageView.php
46951: // HACK: EditPage invokes addToEditView() before this function, so $this->noticesDone
47952: // will only be true if we're being called by EditPage, in which case we need to do nothing
48958: // HACK fake EditPage
49959: $editPage = new EditPage( new Article( $title, $oldid ) );
501005: * @param EditPage $editPage
511008: public function addToEditView( EditPage $editPage ) {
521116: public function addToNoSuchSection( EditPage $editPage, &$s ) {
531833: $extraQuery .= wfArrayToCgi( $params ); // note: EditPage will add initial "&"
541842: public function changeSaveButton( EditPage $editPage, array &$buttons ) {
551872: * @param EditPage $editPage
561875: protected function editWillRequireReview( EditPage $editPage ) {
571888: * @param EditPage $editPage
581891: protected function editRequiresReview( EditPage $editPage ) {
591903: * @param EditPage $editPage
601906: protected function editWillBeAutoreviewed( EditPage $editPage ) {
611935: public function addReviewCheck( EditPage $editPage, array &$checkboxes, &$tabindex = null ) {
622001: public function addRevisionIDField( EditPage $editPage, OutputPage $out ) {
632014: * @param EditPage $editPage
642018: protected static function getBaseRevId( EditPage $editPage, WebRequest $request ) {
652047: * @param EditPage $editPage
662051: protected static function getAltBaseRevId( EditPage $editPage, WebRequest $request ) {
67
68ContentTranslation/ContentTranslation.hooks.php
69208: * Hook: EditPage::showEditForm:initial
70210: public static function newArticleCampaign( EditPage $newPage, OutputPage $out ) {
71
72Wikidata/vendor/composer/autoload_classmap.php
731347: 'Wikibase\\Repo\\Tests\\Api\\EditPageTest' => $baseDir . '/extensions/Wikibase/repo/tests/phpunit/includes/Api/EditPageTest.php',
74
75Wikidata/vendor/composer/autoload_static.php
761638: 'Wikibase\\Repo\\Tests\\Api\\EditPageTest' => __DIR__ . '/../..' . '/extensions/Wikibase/repo/tests/phpunit/includes/Api/EditPageTest.php',
77
78Wikidata/extensions/Wikibase/lib/includes/Store/EntityStore.php
7999: * @see EditPage::userWasLastToEdit()
80
81Wikidata/extensions/Wikibase/lib/tests/phpunit/MockRepository.php
82557: * @see EditPage::userWasLastToEdit
83
84Wikidata/extensions/Wikibase/repo/Wikibase.hooks.php
856:use ApiEditPage;
86511: * This implementation causes the execution of ApiEditPage (action=edit) to fail
87526: if ( $module instanceof ApiEditPage ) {
88538: // trying to use ApiEditPage on an entity namespace
89
90Wikidata/extensions/Wikibase/repo/includes/Api/ResultBuilder.php
911074: // like core's ApiEditPage
92
93Wikidata/extensions/Wikibase/repo/includes/EditEntity.php
94732: * @note Keep in sync with logic in EditPage!
95751: * @note Keep in sync with logic in EditPage!
96
97Wikidata/extensions/Wikibase/repo/includes/Store/Sql/WikiPageEntityStore.php
98351: * @see EditPage::userWasLastToEdit()
99395: * @note keep in sync with logic in EditPage
100
101Wikidata/extensions/Wikibase/repo/includes/Actions/EditEntityAction.php
102385: * Generate standard summary input and label (wgSummary), compatible to EditPage.
103
104Wikidata/extensions/Wikibase/repo/tests/phpunit/includes/Api/EditPageTest.php
10526:class EditPageTest extends WikibaseApiTestCase {
10636: $item->setLabel( "en", "EditPageTest" );
10739: $item->setLabel( "de", "EditPageTest" );
108
109Wikidata/extensions/Wikibase/client/includes/Hooks/EditActionHookHandler.php
1105:use EditPage;
11184: public function handle( EditPage $editor ) {
112
113Wikidata/extensions/Wikibase/client/WikibaseClient.hooks.php
1148:use EditPage;
115326: * @param EditPage $editor
116330: public static function onEditAction( EditPage $editor, OutputPage $output, &$tabindex ) {
117
118Wikidata/extensions/Wikibase/client/tests/phpunit/includes/Hooks/EditActionHookHandlerTest.php
1195:use EditPage;
12042: $editor = $this->getEditPage();
121192: * @return EditPage
122194: private function getEditPage() {
123197: $editor = $this->getMockBuilder( EditPage::class )
124
125Wikidata/extensions/Wikibase/client/WikibaseClient.php
126139: $wgHooks['EditPage::showStandardInputs:options'][] = '\Wikibase\ClientHooks::onEditAction';
127
128CollaborationKit/includes/CollaborationHubContentEditor.php
12910:class CollaborationHubContentEditor extends EditPage {
130
131CollaborationKit/includes/CollaborationListContentEditor.php
1325: * Extends the notorious EditPage class.
13311:class CollaborationListContentEditor extends EditPage {
134
135SpamBlacklist/SpamBlacklistHooks.php
13669: // Always return true, EditPage will look at $status->isOk().
137125: * @param $editPage EditPage
138
139TemplateData/TemplateData.hooks.php
14083: // Specify format the same way the API and EditPage do to avoid extra parsing
141101: * @param EditPage $editPage
142105: public static function onEditPage( $editPage, $output ) {
143
144TwoColConflict/includes/TwoColConflictPage.php
1458:class TwoColConflictPage extends EditPage {
146
147TwoColConflict/includes/TwoColConflictHooks.php
14841: * @param EditPage $editPage
14944: public static function onAttemptSaveAfter( EditPage $editPage, Status $status ) {
15051: if ( $status->value == EditPage::AS_SUCCESS_UPDATE ) {
151
152MassMessage/includes/SpecialMassMessage.php
153150: $m['message']['help'] = EditPage::getCopyrightWarning( $this->getPageTitle( false ), 'parse' );
154262: * The preview generation code was hacked up from EditPage.php
155284: // Parser stuff. Taken from EditPage::getPreviewText()
156291: // Hooks not being run: EditPageGetPreviewContent, EditPageGetPreviewText
157
158MassMessage/includes/SpecialEditMassMessageList.php
159104: // Edit notices; modified from EditPage::showHeader()
160111: // Protection warnings; modified from EditPage::showHeader()
161212: return EditPage::getCopyrightWarning( $this->title, 'parse' );
162
163WikiEditor/WikiEditor.hooks.php
164158: * EditPage::showEditForm:initial hook
165162: * @param EditPage $editPage the current EditPage object.
166214: * EditPage::showEditForm:fields hook
167218: * @param EditPage $editPage the current EditPage object.
168248: * EditPageBeforeEditToolbar hook
169255: public static function EditPageBeforeEditToolbar( &$toolbar ) {
170381: * This is attached to the MediaWiki 'EditPage::attemptSave' hook.
171383: * @param EditPage $editPage
172386: public static function editPageAttemptSave( EditPage $editPage ) {
173401: * This is attached to the MediaWiki 'EditPage::attemptSave:after' hook.
174403: * @param EditPage $editPage
175407: public static function editPageAttemptSaveAfter( EditPage $editPage, Status $status ) {
176424: if ( $status->value === EditPage::AS_CONFLICT_DETECTED ) {
177426: } elseif ( $status->value === EditPage::AS_ARTICLE_WAS_DELETED ) {
178
179WikimediaEvents/WikimediaEventsHooks.php
180393: * @see https://www.mediawiki.org/wiki/Manual:Hooks/EditPageBeforeConflictDiff
181395: * @param EditPage &$editor
182399: public static function onEditPageBeforeConflictDiff( &$editor, &$out ) {
183
184VisualEditor/VisualEditor.hooks.php
185173: private static function isSupportedEditPage( Title $title, User $user, WebRequest $req ) {
186245: if ( self::isSupportedEditPage( $title, $user, $req ) ) {
187489: * @param EditPage $editPage The edit page view.
188493: public static function onEditPageShowEditFormFields( EditPage $editPage, OutputPage $output ) {
189
190VisualEditor/ApiVisualEditor.php
191307: // From EditPage#showCustomIntro
192391: // HACK of course this code is partly duplicated from EditPage.php :(
193437: // HACK: Build a fake EditPage so we can get checkboxes from it
194440: $editPage = new EditPage( $article );
195
196VisualEditor/VisualEditorDataModule.php
19763: 'copyrightwarning' => EditPage::getCopyrightWarning(
198
199ConfirmEdit/includes/ConfirmEditHooks.php
20059: static function confirmEditPage( $editpage, $buttons, $tabindex ) {
201180: * @param EditPage $editor
202186: public static function onAlternateEditPreview( EditPage $editor, &$content, &$html, &$po ) {
203
204ConfirmEdit/SimpleCaptcha/Captcha.php
205189: * Show error message for missing or incorrect captcha on EditPage.
206190: * @param EditPage $editPage
207208: * @param EditPage $editPage
208806: $status->value = EditPage::AS_HOOK_ERROR_EXPECTED;
209894: return $module instanceof ApiEditPage;
210
211WikimediaMessages/WikimediaMessages.hooks.php
212161: public static function onEditPageCopyrightWarning( $title, &$msg ) {
213
214TitleBlacklist/TitleBlacklist.hooks.php
215256: * @param EditPage $editor
216
217Newsletter/includes/NewsletterEditPage.php
2188:class NewsletterEditPage {
219
220Newsletter/includes/specials/SpecialNewsletter.php
221365: $reasonSpamMatch = EditPage::matchSummarySpamRegex( $data['summary'] );
222
223Newsletter/Newsletter.hooks.php
224168: * @param EditPage $editPage
225171: public static function onAlternateEdit( EditPage $editPage ) {
226202: $editPage = new NewsletterEditPage( $article->getContext(), $newsletter );
227207: $editPage = new NewsletterEditPage( $article->getContext() );
228
229Scribunto/common/Hooks.php
230312: * EditPage::showStandardInputs:options hook
231314: * @param EditPage $editor
232319: public static function showStandardInputsOptions( EditPage $editor, OutputPage $output, &$tab ) {
233328: * EditPage::showReadOnlyForm:initial hook
234330: * @param EditPage $editor
235333: public static function showReadOnlyFormInitial( EditPage $editor, OutputPage $output ) {
236342: * EditPageBeforeEditButtons hook
237344: * @param EditPage $editor
238349: public static function beforeEditButtons( EditPage &$editor, array &$buttons, &$tabindex ) {
239
240Translate/Autoload.php
241104:$al['TranslationEditPage'] = "$dir/utils/TranslationEditPage.php";
242
243Translate/TranslateEditAddons.php
24422: public static function suppressIntro( EditPage $editPage ) {
24585: * Hook: EditPage::showEditForm:initial
24687: public static function addTools( EditPage $object ) {
247101: * Hook: EditPageBeforeEditButtons
248103: public static function buttonHack( EditPage $editpage, &$buttons, $tabindex ) {
249174: * @param EditPage $editpage
250177: private static function editBoxes( EditPage $editpage ) {
251
252Translate/tag/PageTranslationHooks.php
253403: * edit conflict if there wasn't tpSyntaxCheckForEditPage.
254
255Translate/Translate.php
256101:$wgHooks['EditPage::showEditForm:initial'][] = 'TranslateEditAddons::addTools';
257104:$wgHooks['EditPageBeforeEditButtons'][] = 'TranslateEditAddons::buttonHack';
258
259Translate/utils/TranslationEditPage.php
26015:class TranslationEditPage {
26132: * @return TranslationEditPage
262
263Translate/utils/TranslationHelpers.php
264633: $jsEdit = TranslationEditPage::jsEdit( $target, $groupId, 'dialog' );
265
266Translate/utils/MessageTable.php
267193: $linkAttribs += TranslationEditPage::jsEdit( $title, $this->group->getId() );
268
269Translate/specials/SpecialTranslate.php
27063: $editpage = TranslationEditPage::newFromRequest( $request );
271
272ProofreadPage/includes/page/PageSubmitAction.php
27321: $editor = new EditPagePage( $this->page, $pagePage, Context::getDefaultContext() );
274
275ProofreadPage/includes/page/EditPagePage.php
2767:use EditPage;
27717:class EditPagePage extends EditPage {
27849: * @see EditPage::isSectionEditSupported
27956: * @see EditPage::isSupportedContentModel
28065: * @see EditPage::showContentForm
28175: * @see EditPage::showContentForm
282148: * @see EditPage::getCheckBoxes
283199: * @see EditPage::importContentFormData
284217: * @see EditPage::internalAttemptSave
285
286ProofreadPage/includes/page/PageEditAction.php
28721: $editor = new EditPagePage( $this->page, $pagePage, Context::getDefaultContext() );
288
289ProofreadPage/includes/index/EditIndexPage.php
2906:use EditPage;
29119:class EditIndexPage extends EditPage {
29233: * @see EditPage::isSectionEditSupported
29340: * @see EditPage::isSupportedContentModel
29447: * @see EditPage::showContentForm
295138: * @see EditPage::importContentFormData
296192: * @see EditPage::internalAttemptSave
297
298LiquidThreads/classes/Hooks.php
299313: * Handle EditPageGetCheckboxesDefinition hook
300315: * @param $editPage EditPage
301
302LiquidThreads/classes/View.php
303543: $e = new EditPage( $article );
304661: $e = new EditPage( $article );
305775: $e = new EditPage( $article );
306880: $e = new EditPage( $article );
3071851: // as it would involve rewriting EditPage, which I do NOT intend to do.
3082132: Hooks::run( 'EditPageBeforeEditToolbar', [ &$html ] );
309
310LiquidThreads/api/ApiThreadAction.php
3113:class ApiThreadAction extends ApiEditPage {
312
313GlobalCssJs/GlobalCssJs.hooks.php
314113: * @param EditPage $editPage
315117: static function onEditPageshowEditForminitial( EditPage $editPage, OutputPage $output ) {

I've gotten as far as WikiEditor in that grep and submitted a set of patches to TwoColConflict.

Change 375951 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/core@master] EditPage: Don't use $wgOut

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

Change 375951 merged by jenkins-bot:
[mediawiki/core@master] EditPage: Don't use $wgOut

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

Change 378340 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/core@master] EditPage: Don't use $wgUser

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

Change 378340 merged by jenkins-bot:
[mediawiki/core@master] EditPage: Don't use $wgUser

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

Change 379163 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/core@master] EditPage: Don't use $wgRequest

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

The last remaining usage of $wgOut will go away with T30856: Remove classic edit toolbar from core so I'm tempted to leave it for now.

Change 379166 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/core@master] EditPage: Try to avoid using $wgTitle

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

Legoktm updated the task description. (Show Details)Sep 20 2017, 4:57 AM

Change 379163 merged by jenkins-bot:
[mediawiki/core@master] EditPage: Don't use $wgRequest

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

Change 379166 merged by jenkins-bot:
[mediawiki/core@master] EditPage: Try to avoid using $wgTitle

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

Change 379462 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/core@master] EditPage: Stop using globals for configuration in non-static functions

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

With the above patch I think we're as close to finishing this task as reasonably possible. The rest of the code is static or globals without a replacement ($wgContLang, $wgParser).

Change 379462 merged by jenkins-bot:
[mediawiki/core@master] EditPage: Stop using globals for configuration in non-static functions

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

Change 379858 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/core@REL1_30] EditPage: Don't use $wgRequest

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

Change 379859 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/core@REL1_30] EditPage: Try to avoid using $wgTitle

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

Change 379863 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/core@REL1_30] EditPage: Stop using globals for configuration in non-static functions

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

Change 379858 merged by jenkins-bot:
[mediawiki/core@REL1_30] EditPage: Don't use $wgRequest

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

Change 379859 merged by jenkins-bot:
[mediawiki/core@REL1_30] EditPage: Try to avoid using $wgTitle

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

Legoktm updated the task description. (Show Details)Sep 22 2017, 9:32 PM
Legoktm updated the task description. (Show Details)Sep 22 2017, 9:38 PM
Legoktm closed this task as Resolved.

There are still some global config variables left, but those require further refactoring (most of which is already planned). The only global context variable left is $wgTitle, and that's only in fallback mode. T176526: Remove $wgTitle fallback from EditPage in MW1.33 is tracked to kill it entirely.

Change 379863 merged by jenkins-bot:
[mediawiki/core@REL1_30] EditPage: Stop using globals for configuration in non-static functions

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