Merge "Don't wrap output added by OutputPage::addWikiText*()"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 26 Sep 2018 10:50:27 +0000 (10:50 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 26 Sep 2018 10:50:27 +0000 (10:50 +0000)
includes/installer/Installer.php
includes/installer/WebInstallerDocument.php
includes/installer/WebInstallerOutput.php
includes/installer/WebInstallerWelcome.php
includes/page/ImageHistoryPseudoPager.php
includes/specials/SpecialExport.php
resources/src/mediawiki.searchSuggest/searchSuggest.js
resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js
tests/phpunit/includes/OutputPageTest.php

index 367149d..0f8a5b0 100644 (file)
@@ -454,6 +454,7 @@ abstract class Installer {
 
                $this->parserTitle = Title::newFromText( 'Installer' );
                $this->parserOptions = new ParserOptions( $wgUser ); // language will be wrong :(
+               $this->parserOptions->setTidy( true );
                // Don't try to access DB before user language is initialised
                $this->setParserLanguage( Language::factory( 'en' ) );
        }
index fc1c33f..43fe748 100644 (file)
@@ -29,7 +29,7 @@ abstract class WebInstallerDocument extends WebInstallerPage {
        public function execute() {
                $text = $this->getFileContents();
                $text = InstallDocFormatter::format( $text );
-               $this->parent->output->addWikiText( $text );
+               $this->parent->output->addWikiTextInterface( $text );
                $this->startForm();
                $this->endForm( false );
        }
index cb0092d..dd76ce9 100644 (file)
@@ -89,8 +89,17 @@ class WebInstallerOutput {
 
        /**
         * @param string $text
+        * @deprecated since 1.32; use addWikiTextInterface instead
         */
        public function addWikiText( $text ) {
+               wfDeprecated( __METHOD__, '1.32' );
+               $this->addWikiTextInterface( $text );
+       }
+
+       /**
+        * @param string $text
+        */
+       public function addWikiTextInterface( $text ) {
                $this->addHTML( $this->parent->parse( $text ) );
        }
 
index 44ff0bb..0d79484 100644 (file)
@@ -30,12 +30,12 @@ class WebInstallerWelcome extends WebInstallerPage {
                                return 'continue';
                        }
                }
-               $this->parent->output->addWikiText( wfMessage( 'config-welcome' )->plain() );
+               $this->parent->output->addWikiTextInterface( wfMessage( 'config-welcome' )->plain() );
                $status = $this->parent->doEnvironmentChecks();
                if ( $status->isGood() ) {
                        $this->parent->output->addHTML( '<span class="success-message">' .
                                wfMessage( 'config-env-good' )->escaped() . '</span>' );
-                       $this->parent->output->addWikiText( wfMessage( 'config-copyright',
+                       $this->parent->output->addWikiTextInterface( wfMessage( 'config-copyright',
                                SpecialVersion::getCopyrightAndAuthorList() )->plain() );
                        $this->startForm();
                        $this->endForm();
index 20bc614..799c33a 100644 (file)
@@ -18,6 +18,8 @@
  * @file
  */
 
+use Wikimedia\Timestamp\TimestampException;
+
 class ImageHistoryPseudoPager extends ReverseChronologicalPager {
        protected $preventClickjacking = false;
 
@@ -138,6 +140,14 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager {
                if ( !$this->mImg->exists() ) {
                        return;
                }
+               // Make sure the date (probably from user input) is valid; if not, drop it.
+               if ( $this->mOffset !== null ) {
+                       try {
+                               $sadlyWeCannotPassThisTimestampDownTheStack = $this->mDb->timestamp( $this->mOffset );
+                       } catch ( TimestampException $e ) {
+                               $this->mOffset = null;
+                       }
+               }
                $queryLimit = $this->mLimit + 1; // limit plus extra row
                if ( $this->mIsBackwards ) {
                        // Fetch the file history
index be79cae..3a7e9cd 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
+use MediaWiki\Logger\LoggerFactory;
 
 /**
  * A special page that allows users to export pages in a XML file
@@ -98,6 +99,15 @@ class SpecialExport extends SpecialPage {
                        $page = '';
                        $history = '';
                } elseif ( $request->wasPosted() && $par == '' ) {
+                       // Log to see if certain parameters are actually used.
+                       // If not, we could deprecate them and do some cleanup, here and in WikiExporter.
+                       LoggerFactory::getInstance( 'export' )->debug(
+                               'Special:Export POST, dir: [{dir}], offset: [{offset}], limit: [{limit}]', [
+                               'dir' => $request->getRawVal( 'dir' ),
+                               'offset' => $request->getRawVal( 'offset' ),
+                               'limit' => $request->getRawVal( 'limit' ),
+                       ] );
+
                        $page = $request->getText( 'pages' );
                        $this->curonly = $request->getCheck( 'curonly' );
                        $rawOffset = $request->getVal( 'offset' );
index d3b64b0..044ac3f 100644 (file)
@@ -22,6 +22,7 @@
                        } ).done( function ( data, jqXHR ) {
                                response( data[ 1 ], {
                                        type: jqXHR.getResponseHeader( 'X-OpenSearch-Type' ),
+                                       searchId: jqXHR.getResponseHeader( 'X-Search-ID' ),
                                        query: query
                                } );
                        } );
                                action: 'impression-results',
                                numberOfResults: context.config.suggestions.length,
                                resultSetType: metadata.type || 'unknown',
+                               searchId: metadata.searchId || null,
                                query: metadata.query,
                                inputLocation: getInputLocation( context )
                        } );
index e821ce8..18cd68a 100644 (file)
                // tracking purposes
                promise.done( function ( data, jqXHR ) {
                        self.requestType = jqXHR.getResponseHeader( 'X-OpenSearch-Type' );
+                       self.searchId = jqXHR.getResponseHeader( 'X-Search-ID' );
                } );
 
                return promise;
                        data: response || {},
                        metadata: {
                                type: this.requestType || 'unknown',
+                               searchId: this.searchId || null,
                                query: this.getQueryValue()
                        }
                };
                this.requestType = undefined;
+               this.searchId = undefined;
 
                return resp;
        };
                        action: 'impression-results',
                        numberOfResults: items.length,
                        resultSetType: data.metadata.type,
+                       searchId: data.metadata.searchId,
                        query: data.metadata.query,
                        inputLocation: this.dataLocation || 'header'
                } );
index 9fedc4e..9d6122d 100644 (file)
@@ -12,6 +12,16 @@ class OutputPageTest extends MediaWikiTestCase {
        const SCREEN_MEDIA_QUERY = 'screen and (min-width: 982px)';
        const SCREEN_ONLY_MEDIA_QUERY = 'only screen and (min-width: 982px)';
 
+       // Ensure that we don't affect the global ResourceLoader state.
+       protected function setUp() {
+               parent::setUp();
+               ResourceLoader::clearCache();
+       }
+       protected function tearDown() {
+               parent::tearDown();
+               ResourceLoader::clearCache();
+       }
+
        /**
         * @dataProvider provideRedirect
         *