From 92606ec14b59745ddefcc355e92009b044952647 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 29 Oct 2016 20:06:15 +0200 Subject: [PATCH] Fix linking Special:ChangeContentModel from action=info Just link the special page, when it is there, means checking $wgContentHandlerUseDB Change Title::quickUserCan to Title::userCan and pass a user object to avoid a global.. Change some other places to use the local variable, instead of calling the context source again. Change-Id: I561899446235165fb77b626b55f35ce716d798c9 --- includes/actions/InfoAction.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index be3be85e43..705f5fd3d8 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -262,7 +262,7 @@ class InfoAction extends FormlessAction { $pageLang = $title->getPageLanguage()->getCode(); if ( $config->get( 'PageLanguageUseDB' ) - && $this->getTitle()->userCan( 'pagelang', $this->getUser() ) + && $title->userCan( 'pagelang', $user ) ) { // Link to Special:PageLanguage with pre-filled page title if user has permissions $titleObj = SpecialPage::getTitleFor( 'PageLanguage', $title->getPrefixedText() ); @@ -282,7 +282,9 @@ class InfoAction extends FormlessAction { // Content model of the page $modelHtml = htmlspecialchars( ContentHandler::getLocalizedName( $title->getContentModel() ) ); // If the user can change it, add a link to Special:ChangeContentModel - if ( $title->quickUserCan( 'editcontentmodel' ) ) { + if ( $config->get( 'ContentHandlerUseDB' ) + && $title->userCan( 'editcontentmodel', $user ) + ) { $modelHtml .= ' ' . $this->msg( 'parentheses' )->rawParams( $linkRenderer->makeLink( SpecialPage::getTitleValueFor( 'ChangeContentModel', $title->getPrefixedText() ), $this->msg( 'pageinfo-content-model-change' )->text() @@ -474,7 +476,7 @@ class InfoAction extends FormlessAction { } $expiry = $title->getRestrictionExpiry( $restrictionType ); $formattedexpiry = $this->msg( 'parentheses', - $this->getLanguage()->formatExpiry( $expiry ) )->escaped(); + $lang->formatExpiry( $expiry ) )->escaped(); $message .= $this->msg( 'word-separator' )->escaped() . $formattedexpiry; // Messages: restriction-edit, restriction-move, restriction-create, -- 2.20.1