EditPage: Try to avoid using $wgTitle

The most common code path is from EditAction, so make sure
EditPage::setContextTitle() is called in that case.

Log any uses that fallback to $wgTitle in the GlobalTitleFail log group.

Bug: T144366
Change-Id: Ie6c7dfbaa432239389d210051372427b8fa045b4
This commit is contained in:
Kunal Mehta 2017-09-19 21:30:21 -07:00
parent 748d75d4d8
commit 5cd20435dc
2 changed files with 5 additions and 0 deletions

View file

@ -469,6 +469,10 @@ class EditPage {
*/
public function getContextTitle() {
if ( is_null( $this->mContextTitle ) ) {
wfDebugLog(
'GlobalTitleFail',
__METHOD__ . ' called by ' . wfGetAllCallers( 5 ) . ' with no title set.'
);
global $wgTitle;
return $wgTitle;
} else {

View file

@ -56,6 +56,7 @@ class EditAction extends FormlessAction {
if ( Hooks::run( 'CustomEditor', [ $page, $user ] ) ) {
$editor = new EditPage( $page );
$editor->setContextTitle( $this->getTitle() );
$editor->edit();
}
}