Merge "mediawiki.page.patrol.ajax: Use postWithToken"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 24 Jun 2014 18:43:04 +0000 (18:43 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 24 Jun 2014 18:43:04 +0000 (18:43 +0000)
13 files changed:
RELEASE-NOTES-1.24
docs/hooks.txt
includes/EditPage.php
includes/OutputPage.php
includes/api/ApiParse.php
includes/api/ApiQueryRecentChanges.php
includes/context/RequestContext.php
includes/htmlform/HTMLForm.php
includes/parser/Parser.php
includes/search/SearchEngine.php
includes/specials/SpecialWatchlist.php
tests/parser/parserTests.txt
tests/phpunit/includes/LinkerTest.php

index ded4988..8793fc9 100644 (file)
@@ -174,6 +174,8 @@ changes to languages because of Bugzilla reports.
 * Removed WebRequest::escapeAppendQuery(). (deprecated since 1.20)
 * Removed info(), purge(), revert() and rollback() from the Article class; they
   have since become subclasses of the Action class. (deprecated since 1.19)
+* SearchEngineReplacePrefixesComplete hook was removed.
+* Removed HTMLForm::addJS(). (deprecated since 1.18)
 
 ==== Renamed classes ====
 * CLDRPluralRuleConverter_Expression to CLDRPluralRuleConverterExpression
index 7049a43..8d7e654 100644 (file)
@@ -2182,12 +2182,6 @@ searches.
 $term : Search term string
 &$title : Current Title object that is being returned (null if none found).
 
-'SearchEngineReplacePrefixesComplete': Run after SearchEngine::replacePrefixes().
-$searchEngine : The SearchEngine object. Users of this hooks will be interested
-in the $searchEngine->namespaces array.
-$query : Original query.
-&$parsed : Resultant query with the prefixes stripped.
-
 'SearchResultInitFromTitle': Set the revision used when displaying a page in
 search results.
 $title : Current Title object being displayed in search results.
index 98e0ec4..480671a 100644 (file)
@@ -3555,7 +3555,7 @@ HTML
 
                        $previewHTML = $parserOutput->getText();
                        $this->mParserOutput = $parserOutput;
-                       $wgOut->addParserOutputNoText( $parserOutput );
+                       $wgOut->addParserOutputMetadata( $parserOutput );
 
                        if ( count( $parserOutput->getWarnings() ) ) {
                                $note .= "\n\n" . implode( "\n\n", $parserOutput->getWarnings() );
index 612dc32..a2b8920 100644 (file)
@@ -1627,7 +1627,6 @@ class OutputPage extends ContextSource {
         * @param ParserOutput $parserOutput
         */
        public function addParserOutputNoText( &$parserOutput ) {
-               wfDeprecated( __METHOD__, '1.24' );
                $this->addParserOutputMetadata( $parserOutput );
        }
 
index 86ce1f1..9dc4d03 100644 (file)
@@ -325,7 +325,7 @@ class ApiParse extends ApiBase {
                if ( isset( $prop['headitems'] ) || isset( $prop['headhtml'] ) ) {
                        $context = $this->getContext();
                        $context->setTitle( $titleObj );
-                       $context->getOutput()->addParserOutputNoText( $p_result );
+                       $context->getOutput()->addParserOutputMetadata( $p_result );
 
                        if ( isset( $prop['headitems'] ) ) {
                                $headItems = $this->formatHeadItems( $p_result->getHeadItems() );
index 3067006..e4078d5 100644 (file)
@@ -813,7 +813,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                                        ApiBase::PROP_NULLABLE => true
                                ),
                                'logtype' => array(
-                                       ApiBase::PROP_TYPE => $config->get( 'LogTypes' ),
+                                       ApiBase::PROP_TYPE => $this->getConfig()->get( 'LogTypes' ),
                                        ApiBase::PROP_NULLABLE => true
                                ),
                                'logaction' => array(
index cb137fe..93602a0 100644 (file)
@@ -308,22 +308,28 @@ class RequestContext implements IContextSource {
 
                        global $wgLanguageCode, $wgContLang;
 
-                       $request = $this->getRequest();
-                       $user = $this->getUser();
+                       try {
+                               $request = $this->getRequest();
+                               $user = $this->getUser();
 
-                       $code = $request->getVal( 'uselang', $user->getOption( 'language' ) );
-                       $code = self::sanitizeLangCode( $code );
+                               $code = $request->getVal( 'uselang', $user->getOption( 'language' ) );
+                               $code = self::sanitizeLangCode( $code );
 
-                       wfRunHooks( 'UserGetLanguageObject', array( $user, &$code, $this ) );
+                               wfRunHooks( 'UserGetLanguageObject', array( $user, &$code, $this ) );
 
-                       if ( $code === $wgLanguageCode ) {
-                               $this->lang = $wgContLang;
-                       } else {
-                               $obj = Language::factory( $code );
-                               $this->lang = $obj;
-                       }
+                               if ( $code === $wgLanguageCode ) {
+                                       $this->lang = $wgContLang;
+                               } else {
+                                       $obj = Language::factory( $code );
+                                       $this->lang = $obj;
+                               }
 
-                       unset( $this->recursion );
+                               unset( $this->recursion );
+                       }
+                       catch ( Exception $ex ) {
+                               unset( $this->recursion );
+                               throw $ex;
+                       }
                }
 
                return $this->lang;
index 175088d..296de96 100644 (file)
@@ -304,15 +304,6 @@ class HTMLForm extends ContextSource {
                return $this->displayFormat === 'vform';
        }
 
-       /**
-        * Add the HTMLForm-specific JavaScript, if it hasn't been
-        * done already.
-        * @deprecated since 1.18 load modules with ResourceLoader instead
-        */
-       static function addJS() {
-               wfDeprecated( __METHOD__, '1.18' );
-       }
-
        /**
         * Get the HTMLFormField subclass for this descriptor.
         *
index 236b999..61fd9cc 100644 (file)
@@ -5339,7 +5339,7 @@ class Parser {
                                                        } else {
                                                                $localLinkTitle = Title::newFromText( $linkValue );
                                                                if ( $localLinkTitle !== null ) {
-                                                                       $link = $localLinkTitle->getLocalURL();
+                                                                       $link = $localLinkTitle->getLinkURL();
                                                                }
                                                        }
                                                        break;
index d8c6f6d..56bb0ac 100644 (file)
@@ -318,7 +318,6 @@ class SearchEngine {
 
                $parsed = $query;
                if ( strpos( $query, ':' ) === false ) { // nothing to do
-                       wfRunHooks( 'SearchEngineReplacePrefixesComplete', array( $this, $query, &$parsed ) );
                        return $parsed;
                }
 
@@ -338,8 +337,6 @@ class SearchEngine {
                        $parsed = $query; // prefix was the whole query
                }
 
-               wfRunHooks( 'SearchEngineReplacePrefixesComplete', array( $this, $query, &$parsed ) );
-
                return $parsed;
        }
 
index 2aec8df..9c28d06 100644 (file)
@@ -331,6 +331,14 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                        $output->showLagWarning( $lag );
                }
 
+               # If no rows to display, show message before try to render the list
+               if ( $rows->numRows() == 0 ) {
+                       $output->wrapWikiMsg(
+                               "<div class='mw-changeslist-empty'>\n$1\n</div>", 'recentchanges-noresult'
+                       );
+                       return;
+               }
+
                $dbr->dataSeek( $rows, 0 );
 
                $list = ChangesList::newFromContext( $this->getContext() );
@@ -370,13 +378,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                }
                $s .= $list->endRecentChangesList();
 
-               if ( $rows->numRows() == 0 ) {
-                       $output->wrapWikiMsg(
-                               "<div class='mw-changeslist-empty'>\n$1\n</div>", 'recentchanges-noresult'
-                       );
-               } else {
-                       $output->addHTML( $s );
-               }
+               $output->addHTML( $s );
        }
 
        /**
index c447a44..b3e9c51 100644 (file)
@@ -15134,6 +15134,37 @@ image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
 
 !! end
 
+!! test
+Gallery with link that has fragment
+!! wikitext
+<gallery>
+image:foobar.jpg|link=Main_Page
+image:foobar.jpg|link=Main_Page#section
+image:foobar.jpg|link=Main Page#section|caption
+</gallery>
+!! html
+<ul class="gallery mw-gallery-traditional">
+               <li class="gallerybox" style="width: 155px"><div style="width: 155px">
+                       <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
+                       <div class="gallerytext">
+                       </div>
+               </div></li>
+               <li class="gallerybox" style="width: 155px"><div style="width: 155px">
+                       <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
+                       <div class="gallerytext">
+                       </div>
+               </div></li>
+               <li class="gallerybox" style="width: 155px"><div style="width: 155px">
+                       <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
+                       <div class="gallerytext">
+<p>caption
+</p>
+                       </div>
+               </div></li>
+</ul>
+
+!! end
+
 !! test
 Gallery with wikitext inside caption
 !! wikitext
index 9889b08..4d62cc7 100644 (file)
@@ -91,6 +91,7 @@ class LinkerTest extends MediaWikiLangTestCase {
         */
        public function testFormatComment( $expected, $comment, $title = false, $local = false ) {
                $this->setMwGlobals( array(
+                       'wgScript' => '/wiki/index.php',
                        'wgArticlePath' => '/wiki/$1',
                        'wgWellFormedXml' => true,
                ) );