/** @var array Map of action to the expiry time of the existing protection */
protected $mExistingExpiry = [];
+ /** @var Article */
+ protected $mArticle;
+
+ /** @var Title */
+ protected $mTitle;
+
+ /** @var bool */
+ protected $disabled;
+
+ /** @var array */
+ protected $disabledAttrib;
+
/** @var IContextSource */
private $mContext;
if ( wfReadOnly() ) {
$this->mPermErrors[] = [ 'readonlytext', wfReadOnlyReason() ];
}
- $this->disabled = $this->mPermErrors != [];
+ $this->disabled = $this->mPermErrors !== [];
$this->disabledAttrib = $this->disabled
? [ 'disabled' => 'disabled' ]
: [];
* Loads the current state of protection into the object.
*/
function loadData() {
- $levels = MediaWikiServices::getInstance()->getNamespaceInfo()->getRestrictionLevels(
+ $levels = MediaWikiServices::getInstance()->getPermissionManager()->getNamespaceRestrictionLevels(
$this->mTitle->getNamespace(), $this->mContext->getUser()
);
$this->mCascade = $this->mTitle->areRestrictionsCascading();
*/
function execute() {
if (
- MediaWikiServices::getInstance()->getNamespaceInfo()->getRestrictionLevels(
+ MediaWikiServices::getInstance()->getPermissionManager()->getNamespaceRestrictionLevels(
$this->mTitle->getNamespace()
) === [ '' ]
) {
);
if ( !$status->isOK() ) {
- $this->show( $out->parseInlineAsInterface( $status->getWikiText() ) );
+ $this->show( $out->parseInlineAsInterface(
+ $status->getWikiText( false, false, $this->mContext->getLanguage() )
+ ) );
return false;
}
function buildSelector( $action, $selected ) {
// If the form is disabled, display all relevant levels. Otherwise,
// just show the ones this user can use.
- $levels = MediaWikiServices::getInstance()->getNamespaceInfo()->getRestrictionLevels(
- $this->mTitle->getNamespace(),
- $this->disabled ? null : $this->mContext->getUser()
- );
+ $levels = MediaWikiServices::getInstance()
+ ->getPermissionManager()
+ ->getNamespaceRestrictionLevels(
+ $this->mTitle->getNamespace(),
+ $this->disabled ? null : $this->mContext->getUser()
+ );
$id = 'mwProtect-level-' . $action;