(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
This commit is contained in:
Liangent 2013-02-17 18:59:41 +08:00 committed by Gerrit Code Review
parent f288ae3290
commit 078334ff49

View file

@ -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.