$rootPage = strtok( $title->getText(), '/' );
$userFromTitle = User::newFromName( $rootPage, 'usable' );
if ( !$userFromTitle || $userFromTitle->getId() === 0 ) {
- $elevated = $this->getUser()->isAllowed( 'editinterface' );
+ $elevated = MediaWikiServices::getInstance()->getPermissionManager()
+ ->userHasRight( $this->getUser(), 'editinterface' );
$elevatedText = $elevated ? 'by elevated ' : '';
$log = LoggerFactory::getInstance( "security" );
$log->warning(
* @return string
*/
public function getContentType() {
- // Use getRawVal instead of getVal because we only
- // need to match against known strings, there is no
- // storing of localised content or other user input.
+ // Optimisation: Avoid slow getVal(), this isn't user-generated content.
$ctype = $this->getRequest()->getRawVal( 'ctype' );
if ( $ctype == '' ) {