X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FProtectionForm.php;h=bb8eba125f20b6bfe8d9290adef8f6d83478125c;hb=a3cd158d8433e41cbeb299f0e268dfef363b2afd;hp=0d0654e8fa894544fd0c3805fc5cac1fd69d7040;hpb=c3089171b006962502a4c0ab156474dbe821b8a4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 0d0654e8fa..2f1059886d 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' ); } @@ -317,7 +321,7 @@ class ProtectionForm { ); if ( !$status->isOK() ) { - $this->show( $out->parseInline( $status->getWikiText() ) ); + $this->show( $out->parseInlineAsInterface( $status->getWikiText() ) ); return false; } @@ -353,13 +357,9 @@ class ProtectionForm { $user = $context->getUser(); $output = $context->getOutput(); $lang = $context->getLanguage(); - $conf = $context->getConfig(); - $cascadingRestrictionLevels = $conf->get( 'CascadingRestrictionLevels' ); - $oldCommentSchema = $conf->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD; $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' ] ); @@ -502,10 +502,10 @@ class ProtectionForm { // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP // (e.g. emojis) count for two each. This limit is overridden in JS to instead count - // Unicode codepoints (or 180 UTF-8 bytes for old schema). + // Unicode codepoints. // Subtract arbitrary 75 to leave some space for the autogenerated null edit's summary // and other texts chosen by dropdown menus on this page. - $maxlength = $oldCommentSchema ? 180 : CommentStore::COMMENT_CHARACTER_LIMIT - 75; + $maxlength = CommentStore::COMMENT_CHARACTER_LIMIT - 75; $out .= Xml::openElement( 'table', [ 'id' => 'mw-protect-table3' ] ) . Xml::openElement( 'tbody' ); @@ -585,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() ); @@ -626,10 +627,9 @@ class ProtectionForm { /** * Show protection long extracts for this page * - * @param OutputPage &$out - * @access 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() ) );