X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FProtectionForm.php;h=3e639b92a2e8e21bf3e58bdb9e8b45801610ab13;hb=96fa73b3cf7b697942826e4aeaa2778e74ebcc02;hp=adca805168364105c89eec893c5e014d591b183c;hpb=1d286560d2cd4f2adf6138f62a8dfcfad5991c14;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index adca805168..3e639b92a2 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -58,6 +58,18 @@ class ProtectionForm { /** @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; @@ -78,7 +90,7 @@ class ProtectionForm { if ( wfReadOnly() ) { $this->mPermErrors[] = [ 'readonlytext', wfReadOnlyReason() ]; } - $this->disabled = $this->mPermErrors != []; + $this->disabled = $this->mPermErrors !== []; $this->disabledAttrib = $this->disabled ? [ 'disabled' => 'disabled' ] : []; @@ -90,7 +102,7 @@ class ProtectionForm { * 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(); @@ -180,7 +192,7 @@ class ProtectionForm { */ function execute() { if ( - MediaWikiServices::getInstance()->getNamespaceInfo()->getRestrictionLevels( + MediaWikiServices::getInstance()->getPermissionManager()->getNamespaceRestrictionLevels( $this->mTitle->getNamespace() ) === [ '' ] ) { @@ -321,7 +333,9 @@ class ProtectionForm { ); if ( !$status->isOK() ) { - $this->show( $out->parseInlineAsInterface( $status->getWikiText() ) ); + $this->show( $out->parseInlineAsInterface( + $status->getWikiText( false, false, $this->mContext->getLanguage() ) + ) ); return false; } @@ -586,10 +600,12 @@ class ProtectionForm { 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;