X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FProtectionForm.php;h=4bead3464c52e3f0a81cb9953e281f54657f315c;hb=3a458a32e7bb6ade4cbbc6bc83d7f1392461518b;hp=c677a0910228542b535b9ba8ecfc68153c8b7959;hpb=f9c735e3ed316b8d1601375b68b0a0b60cf06b59;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index c677a09102..4bead3464c 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -90,7 +90,7 @@ class ProtectionForm { * Loads the current state of protection into the object. */ function loadData() { - $levels = MWNamespace::getRestrictionLevels( + $levels = MediaWikiServices::getInstance()->getNamespaceInfo()->getRestrictionLevels( $this->mTitle->getNamespace(), $this->mContext->getUser() ); $this->mCascade = $this->mTitle->areRestrictionsCascading(); @@ -179,7 +179,11 @@ class ProtectionForm { * Main entry point for action=protect and action=unprotect */ function execute() { - if ( MWNamespace::getRestrictionLevels( $this->mTitle->getNamespace() ) === [ '' ] ) { + if ( + MediaWikiServices::getInstance()->getNamespaceInfo()->getRestrictionLevels( + $this->mTitle->getNamespace() + ) === [ '' ] + ) { throw new ErrorPageError( 'protect-badnamespace-title', 'protect-badnamespace-text' ); } @@ -196,7 +200,7 @@ class ProtectionForm { /** * Show the input form with optional error message * - * @param string|null $err Error message or null if there's no error + * @param string|string[]|null $err Error message or null if there's no error */ function show( $err = null ) { $out = $this->mContext->getOutput(); @@ -353,12 +357,9 @@ class ProtectionForm { $user = $context->getUser(); $output = $context->getOutput(); $lang = $context->getLanguage(); - $conf = $context->getConfig(); - $cascadingRestrictionLevels = $conf->get( 'CascadingRestrictionLevels' ); $out = ''; if ( !$this->disabled ) { $output->addModules( 'mediawiki.legacy.protect' ); - $output->addJsConfigVars( 'wgCascadeableLevels', $cascadingRestrictionLevels ); $out .= Xml::openElement( 'form', [ 'method' => 'post', 'action' => $this->mTitle->getLocalURL( 'action=protect' ), 'id' => 'mw-Protect-Form' ] ); @@ -584,7 +585,8 @@ 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 = MWNamespace::getRestrictionLevels( $this->mTitle->getNamespace(), + $levels = MediaWikiServices::getInstance()->getNamespaceInfo()->getRestrictionLevels( + $this->mTitle->getNamespace(), $this->disabled ? null : $this->mContext->getUser() ); @@ -625,10 +627,9 @@ class ProtectionForm { /** * Show protection long extracts for this page * - * @param OutputPage &$out - * @private + * @param OutputPage $out */ - function showLogExtract( &$out ) { + private function showLogExtract( OutputPage $out ) { # Show relevant lines from the protection log: $protectLogPage = new LogPage( 'protect' ); $out->addHTML( Xml::element( 'h2', null, $protectLogPage->getName()->text() ) );