Merge "RCFilters: Live update: disable peek param"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 11 Sep 2017 20:32:28 +0000 (20:32 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 11 Sep 2017 20:32:28 +0000 (20:32 +0000)
includes/api/ApiQuery.php
includes/api/ApiQueryBase.php
includes/api/ApiQueryWatchlist.php
includes/filerepo/file/LocalFile.php
includes/parser/Parser.php
languages/i18n/en.json
languages/i18n/qqq.json
tests/parser/ParserTestRunner.php

index 987bb99..44a46b8 100644 (file)
@@ -169,7 +169,7 @@ class ApiQuery extends ApiBase {
         * as the first, regardless of the values of $db and $groups
         * @param string $name Name to assign to the database connection
         * @param int $db One of the DB_* constants
-        * @param array $groups Query groups
+        * @param string|string[] $groups Query groups
         * @return IDatabase
         */
        public function getNamedDB( $name, $db, $groups ) {
index 051d346..6987dfb 100644 (file)
@@ -119,7 +119,7 @@ abstract class ApiQueryBase extends ApiBase {
         * See ApiQuery::getNamedDB() for more information
         * @param string $name Name to assign to the database connection
         * @param int $db One of the DB_* constants
-        * @param array $groups Query groups
+        * @param string|string[] $groups Query groups
         * @return IDatabase
         */
        public function selectNamedDB( $name, $db, $groups ) {
index 2ab8524..1e3b2c7 100644 (file)
@@ -34,6 +34,7 @@ use MediaWiki\MediaWikiServices;
  */
 class ApiQueryWatchlist extends ApiQueryGeneratorBase {
 
+       /** @var CommentStore */
        private $commentStore;
 
        public function __construct( ApiQuery $query, $moduleName ) {
@@ -260,10 +261,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
 
        private function extractOutputData( WatchedItem $watchedItem, array $recentChangeInfo ) {
                /* Determine the title of the page that has been changed. */
-               $title = Title::makeTitle(
-                       $watchedItem->getLinkTarget()->getNamespace(),
-                       $watchedItem->getLinkTarget()->getDBkey()
-               );
+               $title = Title::newFromLinkTarget( $watchedItem->getLinkTarget() );
                $user = $this->getUser();
 
                /* Our output data. */
index 6d003d6..8aea7ab 100644 (file)
@@ -538,7 +538,8 @@ class LocalFile extends File {
                $this->extraDataLoaded = true;
 
                $this->description = CommentStore::newKey( "{$prefix}description" )
-                       ->getComment( $row )->text;
+                       // $row is probably using getFields() from self::getCacheFields()
+                       ->getCommentLegacy( wfGetDB( DB_REPLICA ), $row )->text;
 
                $array = $this->decodeRow( $row, $prefix );
 
index 988e248..ff4936d 100644 (file)
@@ -3231,6 +3231,8 @@ class Parser {
                                        . wfMessage( 'parser-template-loop-warning', $titleText )->inContentLanguage()->text()
                                        . '</span>';
                                $this->addTrackingCategory( 'template-loop-category' );
+                               $this->mOutput->addWarning( wfMessage( 'template-loop-warning',
+                                       wfEscapeWikiText( $titleText ) )->text() );
                                wfDebug( __METHOD__ . ": template loop broken at '$titleText'\n" );
                        }
                }
index 4b01132..8add481 100644 (file)
        "parser-template-loop-warning": "Template loop detected: [[$1]]",
        "template-loop-category": "Pages with template loops",
        "template-loop-category-desc": "The page contains a template loop, ie. a template which calls itself recursively.",
+       "template-loop-warning": "<strong>Warning:</strong> This page calls [[:$1]] which causes a template loop (an infinite recursive call).",
        "parser-template-recursion-depth-warning": "Template recursion depth limit exceeded ($1)",
        "language-converter-depth-warning": "Language converter depth limit exceeded ($1)",
        "node-count-exceeded-category": "Pages where node count is exceeded",
index a92504a..56cbbbd 100644 (file)
        "parser-template-loop-warning": "Parameters:\n* $1 - page title",
        "template-loop-category": "This message is used as a category name for a [[mw:Special:MyLanguage/Help:Tracking categories|tracking category]] where pages with template loops will be listed.",
        "template-loop-category-desc": "Pages with template loops category description. Shown on [[Special:TrackingCategories]].\n\nSee also:\n* {{msg-mw|Template-loop-category}}",
+       "template-loop-warning": "This message is displayed in edit preview when a template loop is detected on the previewed page.\n\nParameters:\n* $1 - the full title of template which causes the template loop.",
        "parser-template-recursion-depth-warning": "Parameters:\n* $1 - limit value of recursion depth",
        "language-converter-depth-warning": "Error message shown when a page uses too deeply nested language conversion syntax. Parameters:\n* $1 - the value of the depth limit",
        "node-count-exceeded-category": "This message is used as a category name for a [[mw:Help:Tracking categories|tracking category]] where pages are placed automatically if the node-count of the preprocessor exceeds the limit.\n\nSee also:\n* {{msg-mw|Node-count-exceeded-warning}}",
index 298a3c1..5fe2177 100644 (file)
@@ -1604,12 +1604,15 @@ class ParserTestRunner {
                // get a reference to the mock object.
                MessageCache::singleton()->getParser();
                $restore = $this->executeSetupSnippets( [ 'wgParser' => new ParserTestMockParser ] );
-               $status = $page->doEditContent(
-                       ContentHandler::makeContent( $text, $title ),
-                       '',
-                       EDIT_NEW | EDIT_INTERNAL
-               );
-               $restore();
+               try {
+                       $status = $page->doEditContent(
+                               ContentHandler::makeContent( $text, $title ),
+                               '',
+                               EDIT_NEW | EDIT_INTERNAL
+                       );
+               } finally {
+                       $restore();
+               }
 
                if ( !$status->isOK() ) {
                        throw new MWException( $status->getWikiText( false, false, 'en' ) );