<?php
+use MediaWiki\MediaWikiServices;
+
class SpecialChangeContentModel extends FormSpecialPage {
public function __construct() {
throw new ErrorPageError(
'changecontentmodel-emptymodels-title',
'changecontentmodel-emptymodels-text',
- $this->title->getPrefixedText()
+ [ $this->title->getPrefixedText() ]
);
}
$fields['pagetitle']['readonly'] = true;
$fields += [
+ 'currentmodel' => [
+ 'type' => 'text',
+ 'name' => 'currentcontentmodel',
+ 'default' => $this->title->getContentModel(),
+ 'label-message' => 'changecontentmodel-current-label',
+ 'readonly' => true
+ ],
'model' => [
'type' => 'select',
'name' => 'model',
}
public function onSubmit( array $data ) {
- global $wgContLang;
-
if ( $data['pagetitle'] === '' ) {
// Initial form view of special page, pass
return false;
$flags = $this->oldRevision ? EDIT_UPDATE : EDIT_NEW;
$flags |= EDIT_INTERNAL;
- if ( $user->isAllowed( 'bot' ) ) {
+ if ( MediaWikiServices::getInstance()
+ ->getPermissionManager()
+ ->userHasRight( $user, 'bot' )
+ ) {
$flags |= EDIT_FORCE_BOT;
}
if ( $data['reason'] !== '' ) {
$reason .= $this->msg( 'colon-separator' )->inContentLanguage()->text() . $data['reason'];
}
- # Truncate for whole multibyte characters.
- $reason = $wgContLang->truncate( $reason, 255 );
// Run edit filters
$derivativeContext = new DerivativeContext( $this->getContext() );