Merge "Note that jquery.json will be removed in 1.25"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 11 Jul 2014 21:17:45 +0000 (21:17 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 11 Jul 2014 21:17:45 +0000 (21:17 +0000)
includes/page/Article.php
includes/parser/CoreParserFunctions.php
languages/i18n/en.json
languages/i18n/qqq.json
languages/messages/MessagesEn.php
resources/src/mediawiki/mediawiki.js
tests/qunit/data/testrunner.js

index 0e989d3..2f27826 100644 (file)
@@ -480,7 +480,7 @@ class Article implements Page {
         * page of the given title.
         */
        public function view() {
-               global $wgUseFileCache, $wgUseETag, $wgDebugToolbar;
+               global $wgUseFileCache, $wgUseETag, $wgDebugToolbar, $wgMaxRedirects;
 
                wfProfileIn( __METHOD__ );
 
@@ -542,8 +542,31 @@ class Article implements Page {
                                $outputPage->setETag( $parserCache->getETag( $this, $parserOptions ) );
                        }
 
+                       # Use the greatest of the page's timestamp or the timestamp of any
+                       # redirect in the chain (bug 67849)
+                       $timestamp = $this->mPage->getTouched();
+                       if ( isset( $this->mRedirectedFrom ) ) {
+                               $timestamp = max( $timestamp, $this->mRedirectedFrom->getTouched() );
+
+                               # If there can be more than one redirect in the chain, we have
+                               # to go through the whole chain too in case an intermediate
+                               # redirect was changed.
+                               if ( $wgMaxRedirects > 1 ) {
+                                       $titles = Revision::newFromTitle( $this->mRedirectedFrom )
+                                               ->getContent( Revision::FOR_THIS_USER, $user )
+                                               ->getRedirectChain();
+                                       $thisTitle = $this->getTitle();
+                                       foreach ( $titles as $title ) {
+                                               if ( Title::compare( $title, $thisTitle ) === 0 ) {
+                                                       break;
+                                               }
+                                               $timestamp = max( $timestamp, $title->getTouched() );
+                                       }
+                               }
+                       }
+
                        # Is it client cached?
-                       if ( $outputPage->checkLastModified( $this->mPage->getTouched() ) ) {
+                       if ( $outputPage->checkLastModified( $timestamp ) ) {
                                wfDebug( __METHOD__ . ": done 304\n" );
                                wfProfileOut( __METHOD__ );
 
index 79c8ade..faff0e7 100644 (file)
@@ -365,9 +365,15 @@ class CoreParserFunctions {
         * @param string $text Desired title text
         * @return string
         */
-       static function displaytitle( $parser, $text = '' ) {
+       static function displaytitle( $parser, $text = '', $uarg = '' ) {
                global $wgRestrictDisplayTitle;
 
+               static $magicWords = null;
+               if ( is_null( $magicWords ) ) {
+                       $magicWords = new MagicWordArray( array( 'displaytitle_noerror', 'displaytitle_noreplace' ) );
+               }
+               $arg = $magicWords->matchStartToEnd( $uarg );
+
                // parse a limited subset of wiki markup (just the single quote items)
                $text = $parser->doQuotes( $text );
 
@@ -413,13 +419,25 @@ class CoreParserFunctions {
                ) );
                $title = Title::newFromText( Sanitizer::stripAllTags( $text ) );
 
-               if ( !$wgRestrictDisplayTitle ) {
-                       $parser->mOutput->setDisplayTitle( $text );
-               } elseif ( $title instanceof Title
+               if ( !$wgRestrictDisplayTitle ||
+                       ( $title instanceof Title
                        && !$title->hasFragment()
-                       && $title->equals( $parser->mTitle )
+                       && $title->equals( $parser->mTitle ) )
                ) {
-                       $parser->mOutput->setDisplayTitle( $text );
+                       $old = $parser->mOutput->getProperty( 'displaytitle' );
+                       if ( $old === false || $arg !== 'displaytitle_noreplace' ) {
+                               $parser->mOutput->setDisplayTitle( $text );
+                       }
+                       if ( $old !== false && $old !== $text && !$arg ) {
+                               $converter = $parser->getConverterLanguage()->getConverter();
+                               return '<span class="error">' .
+                                       wfMessage( 'duplicate-displaytitle',
+                                               // Message should be parsed, but these params should only be escaped.
+                                               $converter->markNoConversion( wfEscapeWikiText( $old ) ),
+                                               $converter->markNoConversion( wfEscapeWikiText( $text ) )
+                                       )->inContentLanguage()->text() .
+                                       '</span>';
+                       }
                }
 
                return '';
index 962f6d4..c06c29e 100644 (file)
        "timezone-utc": "UTC",
        "unknown_extension_tag": "Unknown extension tag \"$1\"",
        "duplicate-defaultsort": "<strong>Warning:</strong> Default sort key \"$2\" overrides earlier default sort key \"$1\".",
+       "duplicate-displaytitle": "<strong>Warning:</strong> Display title \"$2\" overrides earlier display title \"$1\".",
        "version": "Version",
        "version-summary": "",
        "version-extensions": "Installed extensions",
index 7f260be..0b3e7af 100644 (file)
        "timezone-utc": "{{optional}}",
        "unknown_extension_tag": "This is an error shown when you use an unknown extension tag name.\n\nThis feature allows tags like <code><nowiki><pre></nowiki></code> to be called with a parser like <code><nowiki>{{#tag:pre}}</nowiki></code>.\n\nParameters:\n* $1 - the unknown extension tag name",
        "duplicate-defaultsort": "See definition of [[w:Sorting|sort key]] on Wikipedia. Parameters:\n* $1 - old default sort key\n* $2 - new default sort key",
+       "duplicate-displaytitle": "Warning shown when a page has its display title set multiple times. Parameters:\n* $1 - old display title\n* $2 - new display title",
        "version": "{{doc-special|Version}}\n{{Identical|Version}}",
        "version-summary": "{{doc-specialpagesummary|version}}",
        "version-extensions": "Header on [[Special:Version]].",
index 6900aeb..8167b19 100644 (file)
@@ -365,6 +365,8 @@ $magicWords = array(
        'url_query'               => array( 0,    'QUERY' ),
        'defaultsort_noerror'     => array( 0,    'noerror' ),
        'defaultsort_noreplace'   => array( 0,    'noreplace' ),
+       'displaytitle_noerror'    => array( 0,    'noerror' ),
+       'displaytitle_noreplace'  => array( 0,    'noreplace' ),
        'pagesincategory_all'     => array( 0,    'all' ),
        'pagesincategory_pages'   => array( 0,    'pages' ),
        'pagesincategory_subcats' => array( 0,    'subcats' ),
index 12888bd..4d1d563 100644 (file)
                                /**
                                 * Execute a function as soon as one or more required modules are ready.
                                 *
+                                * If the required modules are already loaded, the function will be
+                                * executed immediately and the modules will not be reloaded.
+                                *
                                 * Example of inline dependency on OOjs:
                                 *
                                 *     mw.loader.using( 'oojs', function () {
index 50e89da..f3f884a 100644 (file)
                                        // As a convenience feature, automatically restore warnings if they're
                                        // still suppressed by the end of the test.
                                        restoreWarnings();
+
+                                       // Check for (and clean up, if possible) incomplete animations/requests/etc.
+                                       if ( $.timers && $.timers.length !== 0 ) {
+                                               // Test may need to use fake timers, wait for animations or
+                                               // call $.fx.stop().
+                                               throw new Error( 'Unfinished animations: ' + $.timers.length );
+                                       }
+                                       if ( $.active !== undefined && $.active !== 0 ) {
+                                               // Test may need to use fake XHR, wait for requests or
+                                               // call abort().
+                                               throw new Error( 'Unfinished AJAX requests: ' + $.active );
+                                       }
                                }
                        };
                };