X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FEditPage.php;h=08c4a7286b33913747d09cb0de948af1c8e75357;hb=af94acdc4c65041250655a7402110a0e4a71e364;hp=6fbeed7b4d3f008d5be6e0cc6efe2840bcb88132;hpb=99d4c6b5777c703f95cefd387ac2b40b97dca125;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/EditPage.php b/includes/EditPage.php index 6fbeed7b4d..08c4a7286b 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -238,30 +238,6 @@ class EditPage { /** @var bool */ public $isConflict = false; - /** - * @deprecated since 1.30 use Title::isCssJsSubpage() - * @var bool - */ - public $isCssJsSubpage = false; - - /** - * @deprecated since 1.30 use Title::isCssSubpage() - * @var bool - */ - public $isCssSubpage = false; - - /** - * @deprecated since 1.30 use Title::isJsSubpage() - * @var bool - */ - public $isJsSubpage = false; - - /** - * @deprecated since 1.30 - * @var bool - */ - public $isWrongCaseCssJsPage = false; - /** @var bool New page or new section */ public $isNew = false; @@ -325,7 +301,7 @@ class EditPage { /** @var bool Has a summary been preset using GET parameter &summary= ? */ public $hasPresetSummary = false; - /** @var Revision|bool */ + /** @var Revision|bool|null */ public $mBaseRevision = false; /** @var bool */ @@ -660,13 +636,6 @@ class EditPage { } $this->isConflict = false; - // css / js subpages of user pages get a special treatment - // The following member variables are deprecated since 1.30, - // the functions should be used instead. - $this->isCssJsSubpage = $this->mTitle->isCssJsSubpage(); - $this->isCssSubpage = $this->mTitle->isCssSubpage(); - $this->isJsSubpage = $this->mTitle->isJsSubpage(); - $this->isWrongCaseCssJsPage = $this->isWrongCaseCssJsPage(); # Show applicable editing introductions if ( $this->formtype == 'initial' || $this->firsttime ) { @@ -877,9 +846,9 @@ class EditPage { * * @return bool */ - protected function isWrongCaseCssJsPage() { - if ( $this->mTitle->isCssJsSubpage() ) { - $name = $this->mTitle->getSkinFromCssJsSubpage(); + protected function isWrongCaseUserConfigPage() { + if ( $this->mTitle->isUserConfigPage() ) { + $name = $this->mTitle->getSkinFromConfigSubpage(); $skins = array_merge( array_keys( Skin::getSkinNames() ), [ 'common' ] @@ -2369,7 +2338,7 @@ ERROR; /** * @note: this method is very poorly named. If the user opened the form with ?oldid=X, * one might think of X as the "base revision", which is NOT what this returns. - * @return Revision Current version when the edit was started + * @return Revision|null Current version when the edit was started */ public function getBaseRevision() { if ( !$this->mBaseRevision ) { @@ -2879,7 +2848,7 @@ ERROR; $out->addHTML( $editConflictHelper->getEditFormHtmlBeforeContent() ); } - if ( !$this->mTitle->isCssJsSubpage() && $showToolbar && $user->getOption( 'showtoolbar' ) ) { + if ( !$this->mTitle->isUserConfigPage() && $showToolbar && $user->getOption( 'showtoolbar' ) ) { $out->addHTML( self::getEditToolbar( $this->mTitle ) ); } @@ -3116,22 +3085,26 @@ ERROR; ); } } else { - if ( $this->mTitle->isCssJsSubpage() ) { + if ( $this->mTitle->isUserConfigPage() ) { # Check the skin exists - if ( $this->isWrongCaseCssJsPage() ) { + if ( $this->isWrongCaseUserConfigPage() ) { $out->wrapWikiMsg( - "
\n$1\n
", - [ 'userinvalidcssjstitle', $this->mTitle->getSkinFromCssJsSubpage() ] + "
\n$1\n
", + [ 'userinvalidconfigtitle', $this->mTitle->getSkinFromConfigSubpage() ] ); } if ( $this->getTitle()->isSubpageOf( $user->getUserPage() ) ) { - $isCssSubpage = $this->mTitle->isCssSubpage(); - $out->wrapWikiMsg( '
$1
', - $isCssSubpage ? 'usercssispublic' : 'userjsispublic' - ); + $isUserCssConfig = $this->mTitle->isUserCssConfigPage(); + + $warning = $isUserCssConfig + ? 'usercssispublic' + : 'userjsispublic'; + + $out->wrapWikiMsg( '
$1
', $warning ); + if ( $this->formtype !== 'preview' ) { $config = $this->context->getConfig(); - if ( $isCssSubpage && $config->get( 'AllowUserCss' ) ) { + if ( $isUserCssConfig && $config->get( 'AllowUserCss' ) ) { $out->wrapWikiMsg( "
\n$1\n
", [ 'usercssyoucanpreview' ] @@ -3165,11 +3138,15 @@ ERROR; * @return array */ private function getSummaryInputAttributes( array $inputAttrs = null ) { - // Note: the maxlength is overridden in JS to 255 and to make it use UTF-8 bytes, not characters. + $conf = $this->context->getConfig(); + $oldCommentSchema = $conf->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD; + // 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 255 UTF-8 bytes for old schema). return ( is_array( $inputAttrs ) ? $inputAttrs : [] ) + [ 'id' => 'wpSummary', 'name' => 'wpSummary', - 'maxlength' => '200', + 'maxlength' => $oldCommentSchema ? 200 : CommentStore::COMMENT_CHARACTER_LIMIT, 'tabindex' => 1, 'size' => 60, 'spellcheck' => 'true', @@ -3702,7 +3679,7 @@ ERROR; $out->addHTML( $this->editFormTextAfterWarn ); $out->addHTML( "
\n" ); - $out->addHTML( implode( $this->getEditButtons( $tabindex ), "\n" ) . "\n" ); + $out->addHTML( implode( "\n", $this->getEditButtons( $tabindex ) ) . "\n" ); $cancel = $this->getCancelLink(); @@ -3812,30 +3789,30 @@ ERROR; protected function getLastDelete() { $dbr = wfGetDB( DB_REPLICA ); $commentQuery = CommentStore::getStore()->getJoin( 'log_comment' ); + $actorQuery = ActorMigration::newMigration()->getJoin( 'log_user' ); $data = $dbr->selectRow( - [ 'logging', 'user' ] + $commentQuery['tables'], + array_merge( [ 'logging' ], $commentQuery['tables'], $actorQuery['tables'], [ 'user' ] ), [ 'log_type', 'log_action', 'log_timestamp', - 'log_user', 'log_namespace', 'log_title', 'log_params', 'log_deleted', 'user_name' - ] + $commentQuery['fields'], [ + ] + $commentQuery['fields'] + $actorQuery['fields'], + [ 'log_namespace' => $this->mTitle->getNamespace(), 'log_title' => $this->mTitle->getDBkey(), 'log_type' => 'delete', 'log_action' => 'delete', - 'user_id=log_user' ], __METHOD__, [ 'LIMIT' => 1, 'ORDER BY' => 'log_timestamp DESC' ], [ - 'user' => [ 'JOIN', 'user_id=log_user' ], - ] + $commentQuery['joins'] + 'user' => [ 'JOIN', 'user_id=' . $actorQuery['fields']['log_user'] ], + ] + $commentQuery['joins'] + $actorQuery['joins'] ); // Quick paranoid permission checks... if ( is_object( $data ) ) { @@ -3913,10 +3890,10 @@ ERROR; } # don't parse non-wikitext pages, show message about preview - if ( $this->mTitle->isCssJsSubpage() || $this->mTitle->isCssOrJsPage() ) { - if ( $this->mTitle->isCssJsSubpage() ) { + if ( $this->mTitle->isUserConfigPage() || $this->mTitle->isSiteConfigPage() ) { + if ( $this->mTitle->isUserConfigPage() ) { $level = 'user'; - } elseif ( $this->mTitle->isCssOrJsPage() ) { + } elseif ( $this->mTitle->isSiteConfigPage() ) { $level = 'site'; } else { $level = false; @@ -4028,7 +4005,6 @@ ERROR; $this->mTitle, $pstContent, $user ); $parserOutput = $pstContent->getParserOutput( $this->mTitle, null, $parserOptions ); ScopedCallback::consume( $scopedCallback ); - $parserOutput->setEditSectionTokens( false ); // no section edit links return [ 'parserOutput' => $parserOutput, 'html' => $parserOutput->getText( [