Don't pass USE INDEX to a $dbType parameter
[lhc/web/wiklou.git] / includes / page / Article.php
index 343c4c8..8fff614 100644 (file)
@@ -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(
+                                                       "<div id='mw-clearyourcache' lang='$lang' dir='$dir' class='mw-content-$dir'>\n$1\n</div>",
+                                                       'clearyourcache'
+                                               );
+                                       } elseif ( !Hooks::run( 'ArticleContentViewCustom',
                                                [ $this->fetchContentObject(), $this->getTitle(), $outputPage ] )
                                        ) {
                                                # Allow extensions do their own custom view for certain pages
@@ -1058,8 +1065,7 @@ class Article implements Page {
                                                'rc_namespace' => NS_FILE,
                                                'rc_cur_id' => $title->getArticleID()
                                        ],
-                                       __METHOD__,
-                                       [ 'USE INDEX' => 'rc_timestamp' ]
+                                       __METHOD__
                                );
                                if ( $rc ) {
                                        // Use patrol message specific to files
@@ -1251,7 +1257,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 +1532,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 +1691,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 +1736,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,