Liangent has uploaded a new change for review.

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


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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/72/49472/1

diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php
index f6e0679..5b19eb0 100644
--- a/includes/api/ApiEditPage.php
+++ b/includes/api/ApiEditPage.php
@@ -304,6 +304,12 @@
                $wgTitle = $titleObj;
 
                $articleObject = new Article( $titleObj );
+
+               $articleContext = new DerivativeContext( 
$articleObject->getContext() );
+               $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: newchange
Gerrit-Change-Id: I743942822eb5097d9d98c11088a91395d9e6d47f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Liangent <[email protected]>

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

Reply via email to