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