From 078334ff4959b856cc84782f3cead1509bcd540e Mon Sep 17 00:00:00 2001 From: Liangent Date: Sun, 17 Feb 2013 18:59:41 +0800 Subject: [PATCH] (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 --- includes/api/ApiEditPage.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index f6e0679bf3..1d6dc66059 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -304,6 +304,12 @@ class ApiEditPage extends ApiBase { $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. -- 2.20.1