X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fpage%2FArticle.php;h=48f2ab3861bd64677a9bb2f6f7850de4cef0254e;hb=904210492c7ec20b09d0d85819d84be857825c8f;hp=dadf311da048c9ae84160fd9e392673c00056a09;hpb=8a95833baed3b8071fcbd8cd2bc8c3449409f665;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/page/Article.php b/includes/page/Article.php index dadf311da0..48f2ab3861 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -480,12 +480,10 @@ class Article implements Page { # Render printable version, use printable version cache if ( $outputPage->isPrintable() ) { $parserOptions->setIsPrintable( true ); - $parserOptions->setEditSection( false ); $poOptions['enableSectionEditLinks'] = false; } elseif ( $this->disableSectionEditForRender || !$this->isCurrent() || !$this->getTitle()->quickUserCan( 'edit', $user ) ) { - $parserOptions->setEditSection( false ); $poOptions['enableSectionEditLinks'] = false; } @@ -579,7 +577,16 @@ class Article implements Page { # Preload timestamp to avoid a DB hit $outputPage->setRevisionTimestamp( $this->mPage->getTimestamp() ); - if ( !Hooks::run( 'ArticleContentViewCustom', + # Pages containing custom CSS or JavaScript get special treatment + if ( $this->getTitle()->isSiteConfigPage() || $this->getTitle()->isUserConfigPage() ) { + $dir = $this->getContext()->getLanguage()->getDir(); + $lang = $this->getContext()->getLanguage()->getHtmlCode(); + + $outputPage->wrapWikiMsg( + "
\n$1\n
", + 'clearyourcache' + ); + } elseif ( !Hooks::run( 'ArticleContentViewCustom', [ $this->fetchContentObject(), $this->getTitle(), $outputPage ] ) ) { # Allow extensions do their own custom view for certain pages @@ -967,7 +974,7 @@ class Article implements Page { * @return bool */ public function showPatrolFooter() { - global $wgUseNPPatrol, $wgUseRCPatrol, $wgUseFilePatrol, $wgEnableAPI, $wgEnableWriteAPI; + global $wgUseNPPatrol, $wgUseRCPatrol, $wgUseFilePatrol; $outputPage = $this->getContext()->getOutput(); $user = $this->getContext()->getUser(); @@ -1102,7 +1109,7 @@ class Article implements Page { } $outputPage->preventClickjacking(); - if ( $wgEnableAPI && $wgEnableWriteAPI && $user->isAllowed( 'writeapi' ) ) { + if ( $user->isAllowed( 'writeapi' ) ) { $outputPage->addModules( 'mediawiki.page.patrol.ajax' ); } @@ -1251,7 +1258,7 @@ class Article implements Page { } $dir = $this->getContext()->getLanguage()->getDir(); - $lang = $this->getContext()->getLanguage()->getCode(); + $lang = $this->getContext()->getLanguage()->getHtmlCode(); $outputPage->addWikiText( Xml::openElement( 'div', [ 'class' => "noarticletext mw-content-$dir", 'dir' => $dir, @@ -1526,7 +1533,6 @@ class Article implements Page { public function render() { $this->getContext()->getRequest()->response()->header( 'X-Robots-Tag: noindex' ); $this->getContext()->getOutput()->setArticleBodyOnly( true ); - $this->getContext()->getOutput()->enableSectionEditLinks( false ); $this->disableSectionEditForRender = true; $this->view(); } @@ -1686,6 +1692,7 @@ class Article implements Page { $outputPage->setPageTitle( wfMessage( 'delete-confirm', $title->getPrefixedText() ) ); $outputPage->addBacklinkSubtitle( $title ); $outputPage->setRobotPolicy( 'noindex,nofollow' ); + $outputPage->addModules( 'mediawiki.action.delete' ); $backlinkCache = $title->getBacklinkCache(); if ( $backlinkCache->hasLinks( 'pagelinks' ) || $backlinkCache->hasLinks( 'templatelinks' ) ) { @@ -1730,12 +1737,17 @@ class Article implements Page { ] ); + // 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). + $conf = $this->getContext()->getConfig(); + $oldCommentSchema = $conf->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD; $fields[] = new OOUI\FieldLayout( new OOUI\TextInputWidget( [ 'name' => 'wpReason', 'inputId' => 'wpReason', 'tabIndex' => 2, - 'maxLength' => 255, + 'maxLength' => $oldCommentSchema ? 255 : CommentStore::COMMENT_CHARACTER_LIMIT, 'infusable' => true, 'value' => $reason, 'autofocus' => true, @@ -2553,7 +2565,7 @@ class Article implements Page { * @see WikiPage::updateRedirectOn */ public function updateRedirectOn( $dbw, $redirectTitle, $lastRevIsRedirect = null ) { - return $this->mPage->updateRedirectOn( $dbw, $redirectTitle, $lastRevIsRedirect = null ); + return $this->mPage->updateRedirectOn( $dbw, $redirectTitle, $lastRevIsRedirect ); } /**