jenkins-bot has submitted this change and it was merged.

Change subject: (bug 45092) Better context for Article initialized by 
ApiEditPage
......................................................................


(bug 45092) Better context for Article initialized by ApiEditPage

After I99a19c93, the $context argument of EditFilterMergedContent hook
is just $editPage->mArticle->getContext() which has a title of [[API]]
when it's created in ApiEditPage called internally (like what WikiLove
does). Now a new context is created for it which simulates a real edit
(title is the title being edited, and request is the derivated one with
a few more fake parameters added).

Change-Id: I743942822eb5097d9d98c11088a91395d9e6d47f
---
M includes/api/ApiEditPage.php
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  Anomie: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php
index f6e0679..1d6dc66 100644
--- a/includes/api/ApiEditPage.php
+++ b/includes/api/ApiEditPage.php
@@ -304,6 +304,12 @@
                $wgTitle = $titleObj;
 
                $articleObject = new Article( $titleObj );
+
+               $articleContext = new RequestContext;
+               $articleContext->setRequest( $req );
+               $articleContext->setTitle( $titleObj );
+               $articleObject->setContext( $articleContext );
+
                $ep = new EditPage( $articleObject );
 
                // allow editing of non-textual content.

-- 
To view, visit https://gerrit.wikimedia.org/r/49472
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I743942822eb5097d9d98c11088a91395d9e6d47f
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Liangent <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Liangent <[email protected]>
Gerrit-Reviewer: btongminh <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to