Merge "Fix action=feedcontributions date filtering parameters"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 6 Jun 2017 15:32:55 +0000 (15:32 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 6 Jun 2017 15:32:55 +0000 (15:32 +0000)
66 files changed:
CODE_OF_CONDUCT.md [new file with mode: 0644]
RELEASE-NOTES-1.30
docs/hooks.txt
includes/DefaultSettings.php
includes/EditPage.php
includes/OutputPage.php
includes/api/ApiComparePages.php
includes/api/i18n/en.json
includes/api/i18n/hu.json
includes/api/i18n/pt.json
includes/api/i18n/qqq.json
includes/content/ContentHandler.php
includes/libs/objectcache/WANObjectCache.php
includes/page/WikiPage.php
includes/parser/ParserCache.php
includes/parser/ParserOptions.php
includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderOOUIFileModule.php
languages/i18n/atj.json
languages/i18n/bn.json
languages/i18n/hi.json
languages/i18n/hr.json
languages/i18n/ja.json
languages/i18n/pl.json
languages/i18n/sah.json
languages/i18n/zh-hant.json
phpcs.xml
resources/Resources.php
resources/src/mediawiki.rcfilters/styles/mw.rcfilters.ui.ChangesListWrapperWidget.less
resources/src/mediawiki.rcfilters/styles/mw.rcfilters.ui.HighlightColorPickerWidget.less
resources/src/mediawiki/mediawiki.Upload.Dialog.js
tests/phpunit/data/resourceloader/abc.gif [new file with mode: 0644]
tests/phpunit/data/resourceloader/add.gif [deleted file]
tests/phpunit/data/resourceloader/bold-a.svg [deleted file]
tests/phpunit/data/resourceloader/bold-b.svg [deleted file]
tests/phpunit/data/resourceloader/bold-f.svg [deleted file]
tests/phpunit/data/resourceloader/def.svg [new file with mode: 0644]
tests/phpunit/data/resourceloader/def_variantize.svg [new file with mode: 0644]
tests/phpunit/data/resourceloader/ghi.svg [new file with mode: 0644]
tests/phpunit/data/resourceloader/ghi_massage.svg [new file with mode: 0644]
tests/phpunit/data/resourceloader/help-ltr.svg [deleted file]
tests/phpunit/data/resourceloader/help-rtl.svg [deleted file]
tests/phpunit/data/resourceloader/jkl.svg [new file with mode: 0644]
tests/phpunit/data/resourceloader/mno-ltr.svg [new file with mode: 0644]
tests/phpunit/data/resourceloader/mno-rtl.svg [new file with mode: 0644]
tests/phpunit/data/resourceloader/next.svg [deleted file]
tests/phpunit/data/resourceloader/next_massage.svg [deleted file]
tests/phpunit/data/resourceloader/oouiimagemodule/apex/icons.json
tests/phpunit/data/resourceloader/oouiimagemodule/apex/images/icons/search.svg [deleted file]
tests/phpunit/data/resourceloader/oouiimagemodule/apex/images/icons/stu.svg [new file with mode: 0644]
tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/icons.json
tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/images/icons/search.svg [deleted file]
tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/images/icons/stu.svg [new file with mode: 0644]
tests/phpunit/data/resourceloader/pqr-a.svg [new file with mode: 0644]
tests/phpunit/data/resourceloader/pqr-b.svg [new file with mode: 0644]
tests/phpunit/data/resourceloader/pqr-f.svg [new file with mode: 0644]
tests/phpunit/data/resourceloader/prev.svg [deleted file]
tests/phpunit/data/resourceloader/remove.svg [deleted file]
tests/phpunit/data/resourceloader/remove_variantize.svg [deleted file]
tests/phpunit/includes/api/ApiComparePagesTest.php [new file with mode: 0644]
tests/phpunit/includes/deferred/LinksUpdateTest.php
tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php
tests/phpunit/includes/parser/ParserOptionsTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderImageTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderOOUIImageModuleTest.php

diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644 (file)
index 0000000..d8e5d08
--- /dev/null
@@ -0,0 +1 @@
+The development of this software is covered by a [Code of Conduct](https://www.mediawiki.org/wiki/Code_of_Conduct).
index 22fed0c..fa5c280 100644 (file)
@@ -23,6 +23,10 @@ production.
 * $wgExceptionHooks has been removed.
 * $wgShellLocale is now applied for all requests. wfInitShellLocale() is
   deprecated and a no-op, as it is no longer needed.
+* WikiPage::getParserOutput() will now throw an exception if passed
+  ParserOptions would pollute the parser cache. Callers should use
+  WikiPage::makeParserOptions() to create the ParserOptions object and only
+  change options that affect the parser cache key.
 
 === New features in 1.30 ===
 * (T37247) Output from Parser::parse() will now be wrapped in a div with
@@ -33,6 +37,8 @@ production.
 * File storage backends that supports headers (eg. Swift) now store an
   X-Content-Dimensions header for originals that contain the media's dimensions
   as page ranges keyed by dimensions.
+* Added a 'ParserOptionsRegister' hook to allow extensions to register
+  additional parser options.
 
 === Languages updated in 1.30 ===
 
@@ -60,6 +66,8 @@ production.
   the new 'wrapoutputclass' parameter.
 * When errorformat is not 'bc', abort reasons from action=login will be
   formatted as specified by the error formatter parameters.
+* action=compare can now handle arbitrary text, deleted revisions, and
+  returning users and edit comments.
 
 === Action API internal changes in 1.30 ===
 * …
index 62b22e1..0e8b508 100644 (file)
@@ -2417,7 +2417,8 @@ constructed.
 &$pager: the pager
 &$queryInfo: the query parameters
 
-'PageRenderingHash': Alter the parser cache option hash key. A parser extension
+'PageRenderingHash': NOTE: Consider using ParserOptionsRegister instead.
+Alter the parser cache option hash key. A parser extension
 which depends on user options should install this hook and append its values to
 the key.
 &$confstr: reference to a hash key string which can be modified
@@ -2541,6 +2542,16 @@ $file: file object that will be used to create the image
 &$params: 2-D array of parameters
 $parser: Parser object that called the hook
 
+'ParserOptionsRegister': Register additional parser options. Note that if you
+change the default value for an option, all existing parser cache entries will
+be invalid. To avoid bugs, you'll need to handle that somehow (e.g. with the
+RejectParserCacheValue hook) because MediaWiki won't do it for you.
+&$defaults: Set the default value for your option here.
+&$inCacheKey: To fragment the parser cache on your option, set a truthy value here.
+&$lazyLoad: To lazy-initialize your option, set it null in $defaults and set a
+  callable here. The callable is passed the ParserOptions object and the option
+  name.
+
 'ParserSectionCreate': Called each time the parser creates a document section
 from wikitext. Use this to apply per-section modifications to HTML (like
 wrapping the section in a DIV).  Caveat: DIVs are valid wikitext, and a DIV
index f7f52e5..5b7ca3e 100644 (file)
@@ -6765,7 +6765,7 @@ $wgUseRCPatrol = true;
 /**
  * Whether to allow users to save their RecentChanges filters
  */
-$wgStructuredChangeFiltersEnableSaving = false;
+$wgStructuredChangeFiltersEnableSaving = true;
 
 /**
  * Use new page patrolling to check new pages on Special:Newpages
index 20250d5..f79a286 100644 (file)
@@ -3059,7 +3059,7 @@ class EditPage {
                        'id' => 'wpSummary',
                        'name' => 'wpSummary',
                        'maxlength' => '200',
-                       'tabindex' => '1',
+                       'tabindex' => 1,
                        'size' => 60,
                        'spellcheck' => 'true',
                ] + Linker::tooltipAndAccesskeyAttribs( 'summary' );
index df948f0..24a506c 100644 (file)
@@ -3977,6 +3977,9 @@ class OutputPage extends ContextSource {
                        'oojs-ui.styles.indicators',
                        'oojs-ui.styles.textures',
                        'mediawiki.widgets.styles',
+                       'oojs-ui.styles.icons-content',
+                       'oojs-ui.styles.icons-alerts',
+                       'oojs-ui.styles.icons-interactions',
                ] );
        }
 
index d6867eb..953bc10 100644 (file)
@@ -1,9 +1,5 @@
 <?php
 /**
- *
- * Created on May 1, 2011
- *
- * Copyright © 2011 Sam Reed
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 
 class ApiComparePages extends ApiBase {
 
+       private $guessed = false, $guessedTitle, $guessedModel, $props;
+
        public function execute() {
                $params = $this->extractRequestParams();
 
-               $rev1 = $this->revisionOrTitleOrId( $params['fromrev'], $params['fromtitle'], $params['fromid'] );
-               $rev2 = $this->revisionOrTitleOrId( $params['torev'], $params['totitle'], $params['toid'] );
+               // Parameter validation
+               $this->requireAtLeastOneParameter( $params, 'fromtitle', 'fromid', 'fromrev', 'fromtext' );
+               $this->requireAtLeastOneParameter( $params, 'totitle', 'toid', 'torev', 'totext', 'torelative' );
+
+               $this->props = array_flip( $params['prop'] );
+
+               // Cache responses publicly by default. This may be overridden later.
+               $this->getMain()->setCacheMode( 'public' );
+
+               // Get the 'from' Revision and Content
+               list( $fromRev, $fromContent, $relRev ) = $this->getDiffContent( 'from', $params );
 
-               $revision = Revision::newFromId( $rev1 );
+               // Get the 'to' Revision and Content
+               if ( $params['torelative'] !== null ) {
+                       if ( !$relRev ) {
+                               $this->dieWithError( 'apierror-compare-relative-to-nothing' );
+                       }
+                       switch ( $params['torelative'] ) {
+                               case 'prev':
+                                       // Swap 'from' and 'to'
+                                       $toRev = $fromRev;
+                                       $toContent = $fromContent;
+                                       $fromRev = $relRev->getPrevious();
+                                       $fromContent = $fromRev
+                                               ? $fromRev->getContent( Revision::FOR_THIS_USER, $this->getUser() )
+                                               : $toContent->getContentHandler()->makeEmptyContent();
+                                       if ( !$fromContent ) {
+                                               $this->dieWithError(
+                                                       [ 'apierror-missingcontent-revid', $fromRev->getId() ], 'missingcontent'
+                                               );
+                                       }
+                                       break;
+
+                               case 'next':
+                                       $toRev = $relRev->getNext();
+                                       $toContent = $toRev
+                                               ? $toRev->getContent( Revision::FOR_THIS_USER, $this->getUser() )
+                                               : $fromContent;
+                                       if ( !$toContent ) {
+                                               $this->dieWithError( [ 'apierror-missingcontent-revid', $toRev->getId() ], 'missingcontent' );
+                                       }
+                                       break;
+
+                               case 'cur':
+                                       $title = $relRev->getTitle();
+                                       $id = $title->getLatestRevID();
+                                       $toRev = $id ? Revision::newFromId( $id ) : null;
+                                       if ( !$toRev ) {
+                                               $this->dieWithError(
+                                                       [ 'apierror-missingrev-title', wfEscapeWikiText( $title->getPrefixedText() ) ], 'nosuchrevid'
+                                               );
+                                       }
+                                       $toContent = $toRev->getContent( Revision::FOR_THIS_USER, $this->getUser() );
+                                       if ( !$toContent ) {
+                                               $this->dieWithError( [ 'apierror-missingcontent-revid', $toRev->getId() ], 'missingcontent' );
+                                       }
+                                       break;
+                       }
+                       $relRev2 = null;
+               } else {
+                       list( $toRev, $toContent, $relRev2 ) = $this->getDiffContent( 'to', $params );
+               }
 
-               if ( !$revision ) {
+               // Should never happen, but just in case...
+               if ( !$fromContent || !$toContent ) {
                        $this->dieWithError( 'apierror-baddiff' );
                }
 
-               $contentHandler = $revision->getContentHandler();
-               $de = $contentHandler->createDifferenceEngine( $this->getContext(),
-                       $rev1,
-                       $rev2,
-                       null, // rcid
-                       true,
-                       false );
+               // Get the diff
+               $context = new DerivativeContext( $this->getContext() );
+               if ( $relRev && $relRev->getTitle() ) {
+                       $context->setTitle( $relRev->getTitle() );
+               } elseif ( $relRev2 && $relRev2->getTitle() ) {
+                       $context->setTitle( $relRev2->getTitle() );
+               } else {
+                       $this->guessTitleAndModel();
+                       if ( $this->guessedTitle ) {
+                               $context->setTitle( $this->guessedTitle );
+                       }
+               }
+               $de = $fromContent->getContentHandler()->createDifferenceEngine(
+                       $context,
+                       $fromRev ? $fromRev->getId() : 0,
+                       $toRev ? $toRev->getId() : 0,
+                       /* $rcid = */ null,
+                       /* $refreshCache = */ false,
+                       /* $unhide = */ true
+               );
+               $de->setContent( $fromContent, $toContent );
+               $difftext = $de->getDiffBody();
+               if ( $difftext === false ) {
+                       $this->dieWithError( 'apierror-baddiff' );
+               }
 
+               // Fill in the response
                $vals = [];
-               if ( isset( $params['fromtitle'] ) ) {
-                       $vals['fromtitle'] = $params['fromtitle'];
-               }
-               if ( isset( $params['fromid'] ) ) {
-                       $vals['fromid'] = $params['fromid'];
+               $this->setVals( $vals, 'from', $fromRev );
+               $this->setVals( $vals, 'to', $toRev );
+
+               if ( isset( $this->props['rel'] ) ) {
+                       if ( $fromRev ) {
+                               $rev = $fromRev->getPrevious();
+                               if ( $rev ) {
+                                       $vals['prev'] = $rev->getId();
+                               }
+                       }
+                       if ( $toRev ) {
+                               $rev = $toRev->getNext();
+                               if ( $rev ) {
+                                       $vals['next'] = $rev->getId();
+                               }
+                       }
                }
-               $vals['fromrevid'] = $rev1;
-               if ( isset( $params['totitle'] ) ) {
-                       $vals['totitle'] = $params['totitle'];
+
+               if ( isset( $this->props['diffsize'] ) ) {
+                       $vals['diffsize'] = strlen( $difftext );
                }
-               if ( isset( $params['toid'] ) ) {
-                       $vals['toid'] = $params['toid'];
+               if ( isset( $this->props['diff'] ) ) {
+                       ApiResult::setContentValue( $vals, 'body', $difftext );
                }
-               $vals['torevid'] = $rev2;
 
-               $difftext = $de->getDiffBody();
+               $this->getResult()->addValue( null, $this->getModuleName(), $vals );
+       }
 
-               if ( $difftext === false ) {
-                       $this->dieWithError( 'apierror-baddiff' );
+       /**
+        * Guess an appropriate default Title and content model for this request
+        *
+        * Fills in $this->guessedTitle based on the first of 'fromrev',
+        * 'fromtitle', 'fromid', 'torev', 'totitle', and 'toid' that's present and
+        * valid.
+        *
+        * Fills in $this->guessedModel based on the Revision or Title used to
+        * determine $this->guessedTitle, or the 'fromcontentmodel' or
+        * 'tocontentmodel' parameters if no title was guessed.
+        */
+       private function guessTitleAndModel() {
+               if ( $this->guessed ) {
+                       return;
                }
 
-               ApiResult::setContentValue( $vals, 'body', $difftext );
+               $this->guessed = true;
+               $params = $this->extractRequestParams();
 
-               $this->getResult()->addValue( null, $this->getModuleName(), $vals );
+               foreach ( [ 'from', 'to' ] as $prefix ) {
+                       if ( $params["{$prefix}rev"] !== null ) {
+                               $revId = $params["{$prefix}rev"];
+                               $rev = Revision::newFromId( $revId );
+                               if ( !$rev ) {
+                                       // Titles of deleted revisions aren't secret, per T51088
+                                       $row = $this->getDB()->selectRow(
+                                               'archive',
+                                               array_merge(
+                                                       Revision::selectArchiveFields(),
+                                                       [ 'ar_namespace', 'ar_title' ]
+                                               ),
+                                               [ 'ar_rev_id' => $revId ],
+                                               __METHOD__
+                                       );
+                                       if ( $row ) {
+                                               $rev = Revision::newFromArchiveRow( $row );
+                                       }
+                               }
+                               if ( $rev ) {
+                                       $this->guessedTitle = $rev->getTitle();
+                                       $this->guessedModel = $rev->getContentModel();
+                                       break;
+                               }
+                       }
+
+                       if ( $params["{$prefix}title"] !== null ) {
+                               $title = Title::newFromText( $params["{$prefix}title"] );
+                               if ( $title && !$title->isExternal() ) {
+                                       $this->guessedTitle = $title;
+                                       break;
+                               }
+                       }
+
+                       if ( $params["{$prefix}id"] !== null ) {
+                               $title = Title::newFromID( $params["{$prefix}id"] );
+                               if ( $title ) {
+                                       $this->guessedTitle = $title;
+                                       break;
+                               }
+                       }
+               }
+
+               if ( !$this->guessedModel ) {
+                       if ( $this->guessedTitle ) {
+                               $this->guessedModel = $this->guessedTitle->getContentModel();
+                       } elseif ( $params['fromcontentmodel'] !== null ) {
+                               $this->guessedModel = $params['fromcontentmodel'];
+                       } elseif ( $params['tocontentmodel'] !== null ) {
+                               $this->guessedModel = $params['tocontentmodel'];
+                       }
+               }
        }
 
        /**
-        * @param int $revision
-        * @param string $titleText
-        * @param int $titleId
-        * @return int
+        * Get the Revision and Content for one side of the diff
+        *
+        * This uses the appropriate set of 'rev', 'id', 'title', 'text', 'pst',
+        * 'contentmodel', and 'contentformat' parameters to determine what content
+        * should be diffed.
+        *
+        * Returns three values:
+        * - The revision used to retrieve the content, if any
+        * - The content to be diffed
+        * - The revision specified, if any, even if not used to retrieve the
+        *   Content
+        *
+        * @param string $prefix 'from' or 'to'
+        * @param array $params
+        * @return array [ Revision|null, Content, Revision|null ]
         */
-       private function revisionOrTitleOrId( $revision, $titleText, $titleId ) {
-               if ( $revision ) {
-                       return $revision;
-               } elseif ( $titleText ) {
-                       $title = Title::newFromText( $titleText );
-                       if ( !$title || $title->isExternal() ) {
-                               $this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $titleText ) ] );
-                       }
-
-                       return $title->getLatestRevID();
-               } elseif ( $titleId ) {
-                       $title = Title::newFromID( $titleId );
+       private function getDiffContent( $prefix, array $params ) {
+               $title = null;
+               $rev = null;
+               $suppliedContent = $params["{$prefix}text"] !== null;
+
+               // Get the revision and title, if applicable
+               $revId = null;
+               if ( $params["{$prefix}rev"] !== null ) {
+                       $revId = $params["{$prefix}rev"];
+               } elseif ( $params["{$prefix}title"] !== null || $params["{$prefix}id"] !== null ) {
+                       if ( $params["{$prefix}title"] !== null ) {
+                               $title = Title::newFromText( $params["{$prefix}title"] );
+                               if ( !$title || $title->isExternal() ) {
+                                       $this->dieWithError(
+                                               [ 'apierror-invalidtitle', wfEscapeWikiText( $params["{$prefix}title"] ) ]
+                                       );
+                               }
+                       } else {
+                               $title = Title::newFromID( $params["{$prefix}id"] );
+                               if ( !$title ) {
+                                       $this->dieWithError( [ 'apierror-nosuchpageid', $params["{$prefix}id"] ] );
+                               }
+                       }
+                       $revId = $title->getLatestRevID();
+                       if ( !$revId ) {
+                               $revId = null;
+                               // Only die here if we're not using supplied text
+                               if ( !$suppliedContent ) {
+                                       if ( $title->exists() ) {
+                                               $this->dieWithError(
+                                                       [ 'apierror-missingrev-title', wfEscapeWikiText( $title->getPrefixedText() ) ], 'nosuchrevid'
+                                               );
+                                       } else {
+                                               $this->dieWithError(
+                                                       [ 'apierror-missingtitle-byname', wfEscapeWikiText( $title->getPrefixedText() ) ],
+                                                       'missingtitle'
+                                               );
+                                       }
+                               }
+                       }
+               }
+               if ( $revId !== null ) {
+                       $rev = Revision::newFromId( $revId );
+                       if ( !$rev && $this->getUser()->isAllowedAny( 'deletedtext', 'undelete' ) ) {
+                               // Try the 'archive' table
+                               $row = $this->getDB()->selectRow(
+                                       'archive',
+                                       array_merge(
+                                               Revision::selectArchiveFields(),
+                                               [ 'ar_namespace', 'ar_title' ]
+                                       ),
+                                       [ 'ar_rev_id' => $revId ],
+                                       __METHOD__
+                               );
+                               if ( $row ) {
+                                       $rev = Revision::newFromArchiveRow( $row );
+                                       $rev->isArchive = true;
+                               }
+                       }
+                       if ( !$rev ) {
+                               $this->dieWithError( [ 'apierror-nosuchrevid', $revId ] );
+                       }
+                       $title = $rev->getTitle();
+
+                       // If we don't have supplied content, return here. Otherwise,
+                       // continue on below with the supplied content.
+                       if ( !$suppliedContent ) {
+                               $content = $rev->getContent( Revision::FOR_THIS_USER, $this->getUser() );
+                               if ( !$content ) {
+                                       $this->dieWithError( [ 'apierror-missingcontent-revid', $revId ], 'missingcontent' );
+                               }
+                               return [ $rev, $content, $rev ];
+                       }
+               }
+
+               // Override $content based on supplied text
+               $model = $params["{$prefix}contentmodel"];
+               $format = $params["{$prefix}contentformat"];
+
+               if ( !$model && $rev ) {
+                       $model = $rev->getContentModel();
+               }
+               if ( !$model && $title ) {
+                       $model = $title->getContentModel();
+               }
+               if ( !$model ) {
+                       $this->guessTitleAndModel();
+                       $model = $this->guessedModel;
+               }
+               if ( !$model ) {
+                       $model = CONTENT_MODEL_WIKITEXT;
+                       $this->addWarning( [ 'apiwarn-compare-nocontentmodel', $model ] );
+               }
+
+               if ( !$title ) {
+                       $this->guessTitleAndModel();
+                       $title = $this->guessedTitle;
+               }
+
+               try {
+                       $content = ContentHandler::makeContent( $params["{$prefix}text"], $title, $model, $format );
+               } catch ( MWContentSerializationException $ex ) {
+                       $this->dieWithException( $ex, [
+                               'wrap' => ApiMessage::create( 'apierror-contentserializationexception', 'parseerror' )
+                       ] );
+               }
+
+               if ( $params["{$prefix}pst"] ) {
                        if ( !$title ) {
-                               $this->dieWithError( [ 'apierror-nosuchpageid', $titleId ] );
+                               $this->dieWithError( 'apierror-compare-no-title' );
+                       }
+                       $popts = ParserOptions::newFromContext( $this->getContext() );
+                       $content = $content->preSaveTransform( $title, $this->getUser(), $popts );
+               }
+
+               return [ null, $content, $rev ];
+       }
+
+       /**
+        * Set value fields from a Revision object
+        * @param array &$vals Result array to set data into
+        * @param string $prefix 'from' or 'to'
+        * @param Revision|null $rev
+        */
+       private function setVals( &$vals, $prefix, $rev ) {
+               if ( $rev ) {
+                       $title = $rev->getTitle();
+                       if ( isset( $this->props['ids'] ) ) {
+                               $vals["{$prefix}id"] = $title->getArticleId();
+                               $vals["{$prefix}revid"] = $rev->getId();
+                       }
+                       if ( isset( $this->props['title'] ) ) {
+                               ApiQueryBase::addTitleInfo( $vals, $title, $prefix );
+                       }
+                       if ( isset( $this->props['size'] ) ) {
+                               $vals["{$prefix}size"] = $rev->getSize();
                        }
 
-                       return $title->getLatestRevID();
+                       $anyHidden = false;
+                       if ( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
+                               $vals["{$prefix}texthidden"] = true;
+                               $anyHidden = true;
+                       }
+
+                       if ( $rev->isDeleted( Revision::DELETED_USER ) ) {
+                               $vals["{$prefix}userhidden"] = true;
+                               $anyHidden = true;
+                       }
+                       if ( isset( $this->props['user'] ) &&
+                               $rev->userCan( Revision::DELETED_USER, $this->getUser() )
+                       ) {
+                               $vals["{$prefix}user"] = $rev->getUserText( Revision::RAW );
+                               $vals["{$prefix}userid"] = $rev->getUser( Revision::RAW );
+                       }
+
+                       if ( $rev->isDeleted( Revision::DELETED_COMMENT ) ) {
+                               $vals["{$prefix}commenthidden"] = true;
+                               $anyHidden = true;
+                       }
+                       if ( $rev->userCan( Revision::DELETED_COMMENT, $this->getUser() ) ) {
+                               if ( isset( $this->props['comment'] ) ) {
+                                       $vals["{$prefix}comment"] = $rev->getComment( Revision::RAW );
+                               }
+                               if ( isset( $this->props['parsedcomment'] ) ) {
+                                       $vals["{$prefix}parsedcomment"] = Linker::formatComment(
+                                               $rev->getComment( Revision::RAW ),
+                                               $rev->getTitle()
+                                       );
+                               }
+                       }
+
+                       if ( $anyHidden ) {
+                               $this->getMain()->setCacheMode( 'private' );
+                               if ( $rev->isDeleted( Revision::DELETED_RESTRICTED ) ) {
+                                       $vals["{$prefix}suppressed"] = true;
+                               }
+                       }
+
+                       if ( !empty( $rev->isArchive ) ) {
+                               $this->getMain()->setCacheMode( 'private' );
+                               $vals["{$prefix}archive"] = true;
+                       }
                }
-               $this->dieWithError( 'apierror-compare-inputneeded', 'inputneeded' );
        }
 
        public function getAllowedParams() {
-               return [
-                       'fromtitle' => null,
-                       'fromid' => [
+               // Parameters for the 'from' and 'to' content
+               $fromToParams = [
+                       'title' => null,
+                       'id' => [
                                ApiBase::PARAM_TYPE => 'integer'
                        ],
-                       'fromrev' => [
+                       'rev' => [
                                ApiBase::PARAM_TYPE => 'integer'
                        ],
-                       'totitle' => null,
-                       'toid' => [
-                               ApiBase::PARAM_TYPE => 'integer'
+                       'text' => [
+                               ApiBase::PARAM_TYPE => 'text'
                        ],
-                       'torev' => [
-                               ApiBase::PARAM_TYPE => 'integer'
+                       'pst' => false,
+                       'contentformat' => [
+                               ApiBase::PARAM_TYPE => ContentHandler::getAllContentFormats(),
                        ],
+                       'contentmodel' => [
+                               ApiBase::PARAM_TYPE => ContentHandler::getContentModels(),
+                       ]
                ];
+
+               $ret = [];
+               foreach ( $fromToParams as $k => $v ) {
+                       $ret["from$k"] = $v;
+               }
+               foreach ( $fromToParams as $k => $v ) {
+                       $ret["to$k"] = $v;
+               }
+
+               $ret = wfArrayInsertAfter(
+                       $ret,
+                       [ 'torelative' => [ ApiBase::PARAM_TYPE => [ 'prev', 'next', 'cur' ], ] ],
+                       'torev'
+               );
+
+               $ret['prop'] = [
+                       ApiBase::PARAM_DFLT => 'diff|ids|title',
+                       ApiBase::PARAM_TYPE => [
+                               'diff',
+                               'diffsize',
+                               'rel',
+                               'ids',
+                               'title',
+                               'user',
+                               'comment',
+                               'parsedcomment',
+                               'size',
+                       ],
+                       ApiBase::PARAM_ISMULTI => true,
+                       ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
+               ];
+
+               return $ret;
        }
 
        protected function getExamplesMessages() {
index 9670260..ed3f25f 100644 (file)
        "apihelp-clientlogin-example-login": "Start the process of logging in to the wiki as user <kbd>Example</kbd> with password <kbd>ExamplePassword</kbd>.",
        "apihelp-clientlogin-example-login2": "Continue logging in after a <samp>UI</samp> response for two-factor auth, supplying an <var>OATHToken</var> of <kbd>987654</kbd>.",
 
-       "apihelp-compare-description": "Get the difference between 2 pages.\n\nA revision number, a page title, or a page ID for both \"from\" and \"to\" must be passed.",
+       "apihelp-compare-description": "Get the difference between two pages.\n\nA revision number, a page title, a page ID, text, or a relative reference for both \"from\" and \"to\" must be passed.",
        "apihelp-compare-param-fromtitle": "First title to compare.",
        "apihelp-compare-param-fromid": "First page ID to compare.",
        "apihelp-compare-param-fromrev": "First revision to compare.",
+       "apihelp-compare-param-fromtext": "Use this text instead of the content of the revision specified by <var>fromtitle</var>, <var>fromid</var> or <var>fromrev</var>.",
+       "apihelp-compare-param-frompst": "Do a pre-save transform on <var>fromtext</var>.",
+       "apihelp-compare-param-fromcontentmodel": "Content model of <var>fromtext</var>. If not supplied, it will be guessed based on the other parameters.",
+       "apihelp-compare-param-fromcontentformat": "Content serialization format of <var>fromtext</var>.",
        "apihelp-compare-param-totitle": "Second title to compare.",
        "apihelp-compare-param-toid": "Second page ID to compare.",
        "apihelp-compare-param-torev": "Second revision to compare.",
+       "apihelp-compare-param-torelative": "Use a revision relative to the revision determined from <var>fromtitle</var>, <var>fromid</var> or <var>fromrev</var>. All of the other 'to' options will be ignored.",
+       "apihelp-compare-param-totext": "Use this text instead of the content of the revision specified by <var>totitle</var>, <var>toid</var> or <var>torev</var>.",
+       "apihelp-compare-param-topst": "Do a pre-save transform on <var>totext</var>.",
+       "apihelp-compare-param-tocontentmodel": "Content model of <var>totext</var>. If not supplied, it will be guessed based on the other parameters.",
+       "apihelp-compare-param-tocontentformat": "Content serialization format of <var>totext</var>.",
+       "apihelp-compare-param-prop": "Which pieces of information to get.",
+       "apihelp-compare-paramvalue-prop-diff": "The diff HTML.",
+       "apihelp-compare-paramvalue-prop-diffsize": "The size of the diff HTML, in bytes.",
+       "apihelp-compare-paramvalue-prop-rel": "The revision IDs of the revision previous to 'from' and after 'to', if any.",
+       "apihelp-compare-paramvalue-prop-ids": "The page and revision IDs of the 'from' and 'to' revisions.",
+       "apihelp-compare-paramvalue-prop-title": "The page titles of the 'from' and 'to' revisions.",
+       "apihelp-compare-paramvalue-prop-user": "The user name and ID of the 'from' and 'to' revisions.",
+       "apihelp-compare-paramvalue-prop-comment": "The comment on the 'from' and 'to' revisions.",
+       "apihelp-compare-paramvalue-prop-parsedcomment": "The parsed comment on the 'from' and 'to' revisions.",
+       "apihelp-compare-paramvalue-prop-size": "The size of the 'from' and 'to' revisions.",
        "apihelp-compare-example-1": "Create a diff between revision 1 and 2.",
 
        "apihelp-createaccount-description": "Create a new user account.",
        "apierror-changeauth-norequest": "Failed to create change request.",
        "apierror-chunk-too-small": "Minimum chunk size is $1 {{PLURAL:$1|byte|bytes}} for non-final chunks.",
        "apierror-cidrtoobroad": "$1 CIDR ranges broader than /$2 are not accepted.",
-       "apierror-compare-inputneeded": "A title, a page ID, or a revision number is needed for both the <var>from</var> and the <var>to</var> parameters.",
+       "apierror-compare-no-title": "Cannot pre-save transform without a title. Try specifying <var>fromtitle</var> or <var>totitle</var>.",
+       "apierror-compare-relative-to-nothing": "No 'from' revision for <var>torelative</var> to be relative to.",
        "apierror-contentserializationexception": "Content serialization failed: $1",
        "apierror-contenttoobig": "The content you supplied exceeds the article size limit of $1 {{PLURAL:$1|kilobyte|kilobytes}}.",
        "apierror-copyuploadbaddomain": "Uploads by URL are not allowed from this domain.",
        "apierror-maxlag": "Waiting for $2: $1 {{PLURAL:$1|second|seconds}} lagged.",
        "apierror-mimesearchdisabled": "MIME search is disabled in Miser Mode.",
        "apierror-missingcontent-pageid": "Missing content for page ID $1.",
+       "apierror-missingcontent-revid": "Missing content for revision ID $1.",
        "apierror-missingparam-at-least-one-of": "{{PLURAL:$2|The parameter|At least one of the parameters}} $1 is required.",
        "apierror-missingparam-one-of": "{{PLURAL:$2|The parameter|One of the parameters}} $1 is required.",
        "apierror-missingparam": "The <var>$1</var> parameter must be set.",
        "apierror-missingrev-pageid": "No current revision of page ID $1.",
+       "apierror-missingrev-title": "No current revision of title $1.",
        "apierror-missingtitle-createonly": "Missing titles can only be protected with <kbd>create</kbd>.",
        "apierror-missingtitle": "The page you specified doesn't exist.",
        "apierror-missingtitle-byname": "The page $1 doesn't exist.",
        "apiwarn-badurlparam": "Could not parse <var>$1urlparam</var> for $2. Using only width and height.",
        "apiwarn-badutf8": "The value passed for <var>$1</var> contains invalid or non-normalized data. Textual data should be valid, NFC-normalized Unicode without C0 control characters other than HT (\\t), LF (\\n), and CR (\\r).",
        "apiwarn-checktoken-percentencoding": "Check that symbols such as \"+\" in the token are properly percent-encoded in the URL.",
+       "apiwarn-compare-nocontentmodel": "No content model could be determined, assuming $1.",
        "apiwarn-deprecation-deletedrevs": "<kbd>list=deletedrevs</kbd> has been deprecated. Please use <kbd>prop=deletedrevisions</kbd> or <kbd>list=alldeletedrevisions</kbd> instead.",
        "apiwarn-deprecation-expandtemplates-prop": "Because no values have been specified for the <var>prop</var> parameter, a legacy format has been used for the output. This format is deprecated, and in the future, a default value will be set for the <var>prop</var> parameter, causing the new format to always be used.",
        "apiwarn-deprecation-httpsexpected": "HTTP used when HTTPS was expected.",
index d7ebc70..cd6dd32 100644 (file)
        "apihelp-query+usercontribs-param-toponly": "Csak a legfrissebbnek számító szerkesztések visszaadása.",
        "apihelp-query+usercontribs-example-user": "<kbd>Example</kbd> szerkesztéseinek megjelenítése.",
        "apihelp-query+usercontribs-example-ipprefix": "<kbd>192.0.2.</kbd> kezdetű IP-címek szerkesztéseinek megjelenítése.",
+       "apihelp-query+userinfo-description": "Információk lekérése az aktuális felhasználóról.",
+       "apihelp-query+userinfo-param-prop": "Visszaadandó információk:",
+       "apihelp-query+userinfo-paramvalue-prop-blockinfo": "Blokkolva van-e az aktuális felhasználó, és ha igen, akkor ki és miért blokkolta.",
+       "apihelp-query+userinfo-paramvalue-prop-groups": "A jelenlegi felhasználó összes csoportjának listája.",
+       "apihelp-query+userinfo-paramvalue-prop-groupmemberships": "A jelenlegi felhasználó explicit csoportjainak listája, az egyes csoporttagságok lejárati idejével.",
+       "apihelp-query+userinfo-paramvalue-prop-implicitgroups": "Azoknak a csoportoknak a listája, amiknek a jelenlegi felhasználó automatikusan tagja.",
+       "apihelp-query+userinfo-paramvalue-prop-rights": "A jelenlegi felhasználó jogosultságainak listája.",
+       "apihelp-query+userinfo-paramvalue-prop-changeablegroups": "A jelenlegi felhasználó által hozzáadható és eltávolítható csoportok listája.",
+       "apihelp-query+userinfo-paramvalue-prop-options": "A jelenlegi felhasználó beállításai.",
+       "apihelp-query+userinfo-paramvalue-prop-preferencestoken": "<span class=\"apihelp-deprecated\">Elavult.</span> A jelenlegi felhasználó beállításainak megváltoztatásához szükséges token lekérése.",
+       "apihelp-query+userinfo-paramvalue-prop-editcount": "A jelenlegi felhasználó szerkesztésszáma.",
+       "apihelp-query+userinfo-paramvalue-prop-ratelimits": "A jelenlegi felhasználóra érvényes sebességkorlátozások.",
+       "apihelp-query+userinfo-paramvalue-prop-realname": "A felhasználó valódi neve.",
+       "apihelp-query+userinfo-paramvalue-prop-email": "A felhasználó e-mail-címe és megerősítésének dátuma.",
+       "apihelp-query+userinfo-paramvalue-prop-registrationdate": "A felhasználó regisztrációjának dátuma.",
+       "apihelp-query+userinfo-paramvalue-prop-unreadcount": "A felhasználó figyelőlistáján levő olvasatlan lapok száma (legfeljebb $1; <samp>$2</samp> értéket ad vissza, ha több).",
+       "apihelp-query+userinfo-paramvalue-prop-centralids": "A felhasználó központi azonosítói és az összekapcsolási státusza.",
+       "apihelp-query+userinfo-param-attachedwiki": "A felhasználó össze van-e kapcsolva az ezen azonosítójú wikivel, az <kbd>$1prop=centralids</kbd> paraméterrel együtt használandó.",
+       "apihelp-query+userinfo-example-simple": "Információk lekérése az aktuális felhasználóról.",
+       "apihelp-query+userinfo-example-data": "További információk lekérése az aktuális felhasználóról.",
+       "apihelp-query+users-description": "Információk lekérése felhasználók listájáról.",
+       "apihelp-query+users-param-prop": "Visszaadandó információk:",
+       "apihelp-query+users-paramvalue-prop-blockinfo": "Blokkolva van-e a felhasználó, és ha igen, akkor ki és miért blokkolta.",
+       "apihelp-query+users-paramvalue-prop-groups": "A felhasználó összes csoportjának listája.",
+       "apihelp-query+users-paramvalue-prop-groupmemberships": "A felhasználó explicit csoportjainak listája, az egyes csoporttagságok lejárati idejével.",
+       "apihelp-query+users-paramvalue-prop-implicitgroups": "Azoknak a csoportoknak a listája, amiknek a felhasználó automatikusan tagja.",
+       "apihelp-query+users-paramvalue-prop-rights": "A felhasználó jogosultságainak listája.",
+       "apihelp-query+users-paramvalue-prop-editcount": "A felhasználó szerkesztésszáma.",
+       "apihelp-query+users-paramvalue-prop-registration": "A felhasználó regisztrációjának időbélyege.",
+       "apihelp-query+users-paramvalue-prop-emailable": "A felhasználó szeretne-e e-mailt fogadni a [[Special:Emailuser]] lapon keresztül.",
+       "apihelp-query+users-paramvalue-prop-gender": "A felhasználó neme („male”, „female” vagy „unknown”).",
+       "apihelp-query+users-paramvalue-prop-centralids": "A felhasználó központi azonosítói és az összekapcsolási státusza.",
+       "apihelp-query+users-paramvalue-prop-cancreate": "Létrehozható-e fiók az érvényes, de nem regisztrált felhasználóneveken.",
+       "apihelp-query+users-param-attachedwiki": "A felhasználó össze van-e kapcsolva az ezen azonosítójú wikivel, az <kbd>$1prop=centralids</kbd> paraméterrel együtt használandó.",
+       "apihelp-query+users-param-users": "A lekérendő felhasználók listája.",
+       "apihelp-query+users-param-userids": "A lekérendő felhasználók azonosítóinak listája.",
+       "apihelp-query+users-param-token": "Használd a <kbd>[[Special:ApiHelp/query+tokens|action=query&meta=tokens]]</kbd> lekérdezést helyette.",
+       "apihelp-query+users-example-simple": "Információk lekérése <kbd>Example</kbd> felhasználóról.",
+       "apihelp-query+watchlist-description": "A felhasználó figyelőlistáján szereplő lapok friss változtatásainak lekérése.",
+       "apihelp-query+watchlist-param-allrev": "Egy lap összes változtatásának lekérése a megadott időszakból.",
+       "apihelp-query+watchlist-param-start": "Listázás ettől az időbélyegtől.",
+       "apihelp-query+watchlist-param-end": "Listázás eddig az időbélyegig.",
+       "apihelp-query+watchlist-param-namespace": "A változtatások szűrése ezekre a névterekre.",
+       "apihelp-query+watchlist-param-user": "Csak ezen felhasználó szerkesztéseinek listázása.",
+       "apihelp-query+watchlist-param-excludeuser": "Ezen felhasználó szerkesztéseinek kihagyása.",
+       "apihelp-query+watchlist-param-limit": "A kérésenként visszaadandó eredmények száma.",
+       "apihelp-query+watchlist-param-prop": "További lekérendő tulajdonságok:",
+       "apihelp-query+watchlist-paramvalue-prop-ids": "Lapváltozat- és lapazonosítók.",
+       "apihelp-query+watchlist-paramvalue-prop-title": "A lap címe.",
+       "apihelp-query+watchlist-paramvalue-prop-user": "A szerkesztést végrehajtó felhasználó.",
+       "apihelp-query+watchlist-paramvalue-prop-userid": "A szerkesztést végrehajtó felhasználó azonosítója.",
+       "apihelp-query+watchlist-paramvalue-prop-comment": "A szerkesztési összefoglaló.",
+       "apihelp-query+watchlist-paramvalue-prop-timestamp": "A szerkesztés időbélyege.",
+       "apihelp-query+watchlist-paramvalue-prop-patrol": "Az ellenőrzött szerkesztések megjelölése (patrol).",
+       "apihelp-query+watchlist-paramvalue-prop-sizes": "A lap régi és új hossza.",
+       "apihelp-query+watchlist-paramvalue-prop-notificationtimestamp": "Annak időbélyege, amikor a felhasználó utoljára értesítést kapott a szerkesztésről.",
+       "apihelp-query+watchlist-param-show": "Csak a kritériumoknak megfelelő elemek visszaadása. Például csak bejelentkezett felhasználók apró változtatásainak megtekintéséhez használd az <kbd>$1show=minor|!anon</kbd> értéket.",
+       "apihelp-query+watchlist-param-type": "A megjelenítendő változtatások típusai:",
+       "apihelp-query+watchlist-paramvalue-type-edit": "Normál lapszerkesztések.",
+       "apihelp-query+watchlist-paramvalue-type-external": "Külső változtatások.",
+       "apihelp-query+watchlist-paramvalue-type-new": "Laplétrehozások.",
+       "apihelp-query+watchlist-paramvalue-type-log": "Naplóbejegyzések.",
+       "apihelp-query+watchlist-paramvalue-type-categorize": "Kategóriaváltoztatások.",
+       "apihelp-query+watchlist-param-owner": "A <var>$1token</var> paraméterrel együtt használandó egy másik felhasználó figyelőlistájának elérésére.",
+       "apihelp-query+watchlist-param-token": "Egy biztonsági token (elérhető a felhasználó [[Special:Preferences#mw-prefsection-watchlist|beállításaiban]]) egy másik felhasználó figyelőlistájának eléréséhez.",
+       "apihelp-query+watchlist-example-simple": "A jelenlegi felhasználó figyelőlistáján szereplő nemrég módosított lapok legfrissebb változatának listázása.",
+       "apihelp-query+watchlist-example-props": "További információk lekérése a jelenlegi felhasználó figyelőlistáján szereplő nemrég módosított lapok legfrissebb változatáról.",
+       "apihelp-query+watchlist-example-allrev": "További információk lekérése a jelenlegi felhasználó figyelőlistáján szereplő összes friss változtatásról.",
+       "apihelp-query+watchlist-example-generator": "Lapinformációk lekérése a jelenlegi felhasználó figyelőlistáján szereplő nemrég módosított lapokról.",
+       "apihelp-query+watchlist-example-generator-rev": "Lapváltozat-információk lekérése a jelenlegi felhasználó figyelőlistáján szereplő friss változtatásokról.",
+       "apihelp-query+watchlist-example-wlowner": "<kbd>Exapmle</kbd> felhasználó figyelőlistáján szereplő nemrég módosított lapok legfrissebb változatának listázása.",
+       "apihelp-query+watchlistraw-description": "A jelenlegi felhasználó figyelőlistáján szereplő összes lap lekérése.",
+       "apihelp-query+watchlistraw-param-namespace": "Lapok listázása csak ezekben a névterekben.",
+       "apihelp-query+watchlistraw-param-limit": "A kérésenként visszaadandó eredmények száma.",
+       "apihelp-query+watchlistraw-param-prop": "További lekérendő tulajdonságok:",
+       "apihelp-query+watchlistraw-paramvalue-prop-changed": "Annak időbélyege, amikor a felhasználó utoljára értesítést kapott a szerkesztésről.",
+       "apihelp-query+watchlistraw-param-show": "Csak a kritériumoknak megfelelő elemek listázása.",
+       "apihelp-query+watchlistraw-param-owner": "A <var>$1token</var> paraméterrel együtt használandó egy másik felhasználó figyelőlistájának elérésére.",
+       "apihelp-query+watchlistraw-param-token": "Egy biztonsági token (elérhető a felhasználó [[Special:Preferences#mw-prefsection-watchlist|beállításaiban]]) egy másik felhasználó figyelőlistájának eléréséhez.",
+       "apihelp-query+watchlistraw-param-dir": "A listázás iránya.",
+       "apihelp-query+watchlistraw-param-fromtitle": "Listázás ettől a címtől (névtérelőtaggal).",
+       "apihelp-query+watchlistraw-param-totitle": "Listázás eddig a címig (névtérelőtaggal).",
+       "apihelp-query+watchlistraw-example-simple": "A jelenlegi felhasználó figyelőlistáján szereplő lapok lekérése.",
+       "apihelp-query+watchlistraw-example-generator": "Lapinformációk lekérése a jelenlegi felhasználó figyelőlistáján szereplő lapokról.",
+       "apihelp-removeauthenticationdata-description": "A jelenlegi felhasználó hitelesítési adatainak eltávolítása.",
+       "apihelp-removeauthenticationdata-example-simple": "Kísérlet a jelenlegi felhasználó <kbd>FooAuthenticationRequest</kbd> kéréshez kapcsolódó adatainak eltávolítására.",
        "apihelp-userrights-param-userid": "Felhasználói azonosító.",
        "api-help-title": "MediaWiki API súgó",
        "api-help-lead": "Ez egy automatikusan generált MediaWiki API-dokumentációs lap.\n\nDokumentáció és példák: https://www.mediawiki.org/wiki/API",
index ee4f833..f938cea 100644 (file)
        "apierror-changeauth-norequest": "A criação do pedido de modificação falhou.",
        "apierror-chunk-too-small": "O tamanho de segmento mínimo é $1 {{PLURAL:$1|byte|bytes}} para segmentos que não sejam segmentos finais.",
        "apierror-cidrtoobroad": "Não são aceites intervalos CIDR $1 maiores do que /$2.",
+       "apierror-compare-inputneeded": "É necessário um título, um identificador de página, ou um número de revisão, tanto para o parâmetro <var>from</var> como para o parâmetro <var>to</var>.",
        "apierror-contentserializationexception": "A seriação do conteúdo falhou: $1",
        "apierror-contenttoobig": "O conteúdo que forneceu excede o tamanho máximo dos artigos que é $1 {{PLURAL:$1|kilobyte|kilobytes}}.",
        "apierror-copyuploadbaddomain": "Não são permitidos carregamentos por URL a partir deste domínio.",
        "apierror-integeroutofrange-abovemax": "<var>$1</var> não pode ultrapassar $2 (definido como $3) para utilizadores.",
        "apierror-integeroutofrange-belowminimum": "<var>$1</var> não pode ser inferior a $2 (definido como $3).",
        "apierror-invalidcategory": "O nome de categoria que introduziu não é válido.",
+       "apierror-invalid-chunk": "A posição mais o segmento atual ultrapassam o tamanho do ficheiro.",
        "apierror-invalidexpiry": "A hora de expiração \"$1\" é inválida.",
        "apierror-invalid-file-key": "Não é uma chave de ficheiro válida.",
        "apierror-invalidlang": "Código de língua inválido para o parâmetro <var>$1</var>.",
        "apierror-mustbeposted": "O módulo <kbd>$1</kbd> requer um pedido POST.",
        "apierror-mustpostparams": "{{PLURAL:$2|O seguinte parâmetro foi encontrado|Os seguintes parâmetros foram encontrados}} no texto da pesquisa, mas têm de estar no corpo do POST: $1.",
        "apierror-noapiwrite": "A edição desta wiki através da API foi impossibilitada. Certifique-se de que a declaração <code>$wgEnableWriteAPI=true;</code> está incluída no ficheiro <code>LocalSettings.php</code> da wiki.",
+       "apierror-nochanges": "Não foi pedida nenhuma mudança.",
+       "apierror-nodeleteablefile": "Essa versão antiga do ficheiro não existe.",
+       "apierror-no-direct-editing": "A edição direta através da API não é suportada para o modelo de conteúdo $1 usado por $2.",
+       "apierror-noedit-anon": "Os utilizadores anónimos não podem editar páginas.",
+       "apierror-noedit": "Não tem permissão para editar páginas.",
+       "apierror-noimageredirect-anon": "Os utilizadores anónimos não podem criar redirecionamentos de imagens.",
+       "apierror-noimageredirect": "Não tem permissão para criar redirecionamentos de imagens.",
+       "apierror-nosuchlogid": "Não existe nenhuma entrada de registo com o identificador $1.",
+       "apierror-nosuchpageid": "Não existe nenhuma página com o identificador $1.",
+       "apierror-nosuchrcid": "Não existe nenhuma mudança recente com o identificador $1.",
+       "apierror-nosuchrevid": "Não existe nenhuma revisão com o identificador $1.",
+       "apierror-nosuchsection": "Não existe nenhuma secção $1.",
+       "apierror-nosuchsection-what": "Não existe nenhuma secção $1 em $2.",
+       "apierror-nosuchuserid": "Não existe nenhum utilizador com o identificador $1.",
+       "apierror-notarget": "Não especificou um destino válido para esta operação.",
+       "apierror-notpatrollable": "A revisão r$1 não pode ser patrulhada porque é demasiado antiga.",
+       "apierror-nouploadmodule": "Não foi definido nenhum módulo de carregamento.",
+       "apierror-opensearch-json-warnings": "Os avisos não podem ser representados no formato OpenSearch JSON.",
+       "apierror-pagecannotexist": "O espaço nominal não permite páginas reais.",
+       "apierror-pagedeleted": "A página foi eliminada depois de obter a data e hora da mesma.",
+       "apierror-pagelang-disabled": "Nesta wiki não é permitido alterar a língua de uma página.",
+       "apierror-paramempty": "O parâmetro <var>$1</var> não pode estar vazio.",
+       "apierror-parsetree-notwikitext": "<kbd>prop=parsetree</kbd> só é suportado para conteúdo em texto wiki.",
+       "apierror-parsetree-notwikitext-title": "<kbd>prop=parsetree</kbd> só é suportado para conteúdo em texto wiki. A página $1 usa o modelo de conteúdo $2.",
+       "apierror-pastexpiry": "A data de expiração \"$1\" é uma data passada.",
+       "apierror-permissiondenied": "Não tem permissão para $1.",
+       "apierror-permissiondenied-generic": "Permissão negada.",
+       "apierror-permissiondenied-patrolflag": "Necessita ter a permissão <code>patrol</code> ou <code>patrolmarks</code> para solicitar a marca de patrulhado.",
+       "apierror-permissiondenied-unblock": "Não tem permissão para desbloquear utilizadores.",
+       "apierror-prefixsearchdisabled": "A pesquisa por prefixo está desativada no modo avarento.",
+       "apierror-promised-nonwrite-api": "O cabeçalho HTTP <code>Promise-Non-Write-API-Action</code> não pode ser enviado a módulos da API em modo de escrita.",
+       "apierror-protect-invalidaction": "O tipo de proteção \"$1\" é inválido.",
+       "apierror-protect-invalidlevel": "O nível de proteção \"$1\" é inválido.",
+       "apierror-ratelimited": "Excedeu a sua frequência limite de edições. Aguarde um pouco e tente novamente, por favor.",
+       "apierror-readapidenied": "Precisa de ter permissão de leitura para usar este módulo.",
+       "apierror-readonly": "A wiki está em modo exclusivo de leitura.",
+       "apierror-reauthenticate": "Não se autenticou recentemente nesta sessão. Volte a autenticar-se, por favor.",
+       "apierror-redirect-appendonly": "Tentou editar usando o modo de seguimento de redirecionamentos, que só pode ser usado em conjunto com <kbd>section=new</kbd>, <var>prependtext</var>, ou <var>appendtext</var>.",
+       "apierror-revdel-mutuallyexclusive": "Não pode usar o mesmo campo em <var>hide</var> e em <var>show</var>.",
+       "apierror-revdel-needtarget": "É necessário um título de destino para este tipo RevDel.",
+       "apierror-revdel-paramneeded": "É necessário pelo menos um valor para <var>hide</var> ou <var>show</var>.",
+       "apierror-revisions-badid": "Não foi encontrada nenhuma revisão para o parâmetro <var>$1</var>.",
+       "apierror-revisions-norevids": "O parâmetro <var>revids</var> não pode ser usado com as opções de listagem (<var>$1limit</var>, <var>$1startid</var>, <var>$1endid</var>, <kbd>$1dir=newer</kbd>, <var>$1user</var>, <var>$1excludeuser</var>, <var>$1start</var> e <var>$1end</var>).",
+       "apierror-revisions-singlepage": "Foi usado <var>titles</var>, <var>pageids</var> ou um gerador para fornecer diversas páginas, mas os parâmetros <var>$1limit</var>, <var>$1startid</var>, <var>$1endid</var>, <kbd>$1dir=newer</kbd>, <var>$1user</var>, <var>$1excludeuser</var>, <var>$1start</var> e <var>$1end</var> só podem ser usados sobre uma única página.",
+       "apierror-revwrongpage": "r$1 não é uma revisão de $2.",
+       "apierror-searchdisabled": "A pesquisa <var>$1</var> está desativada.",
+       "apierror-sectionreplacefailed": "Não foi possível combinar a secção atualizada.",
+       "apierror-sectionsnotsupported": "Secções não são suportadas pelo modelo de conteúdo $1.",
+       "apierror-sectionsnotsupported-what": "Secções não são suportadas por $1.",
+       "apierror-show": "Parâmetro incorreto - não podem ser fornecidos valores mutuamente exclusivos.",
+       "apierror-siteinfo-includealldenied": "Não é possível ver a informação de todos os servidores, a menos que <var>$wgShowHostNames</var> tenha o valor \"true\".",
+       "apierror-sizediffdisabled": "A diferença de tamanho está desativada no modo avarento.",
+       "apierror-spamdetected": "A sua edição foi recusada porque continha um fragmento de spam: <code>$1</code>.",
+       "apierror-specialpage-cantexecute": "Não tem permissão para ver os resultados desta página especial.",
+       "apierror-stashedfilenotfound": "O ficheiro não foi encontrado na área de ficheiros escondidos: $1.",
+       "apierror-stashedit-missingtext": "Não foi encontrado nenhum texto na área de ficheiros escondidos com a chave criptográfica fornecida.",
+       "apierror-stashfailed-complete": "O carregamento por segmentos já terminou. Para mais detalhes, verifique o estado.",
+       "apierror-stashfailed-nosession": "Não há nenhuma sessão de carregamento por segmentos com esta chave.",
+       "apierror-stashfilestorage": "Não foi possível armazenar na área de ficheiros escondidos o ficheiro enviado: $1.",
+       "apierror-stashinvalidfile": "Ficheiro escondido inválido.",
+       "apierror-stashnosuchfilekey": "A chave de ficheiro não existe: $1.",
+       "apierror-stashpathinvalid": "A chave de ficheiro tem um formato incorreto ou é inválida: $1.",
+       "apierror-stashwrongowner": "Proprietário incorreto: $1",
+       "apierror-stashzerolength": "O ficheiro tem comprimento zero e não foi possível armazená-lo na área de ficheiros escondidos: $1.",
        "apierror-systemblocked": "Foi automaticamente bloqueado pelo MediaWiki.",
+       "apierror-templateexpansion-notwikitext": "A expansão de predefinições só é suportada para conteúdo em texto wiki. A página $1 usa o modelo de conteúdo $2.",
+       "apierror-toofewexpiries": "{{PLURAL:$1|Foi fornecida $1 data e hora|Foram fornecidas $1 datas e horas}} de expiração quando {{PLURAL:$2|era necessária|eram necessárias}} $2.",
+       "apierror-unknownaction": "A operação especificada, <kbd>$1</kbd>, não é reconhecida.",
+       "apierror-unknownerror-editpage": "Erro EditPage desconhecido: $1.",
+       "apierror-unknownerror-nocode": "Erro desconhecido.",
+       "apierror-unknownerror": "Erro desconhecido: \"$1\".",
+       "apierror-unknownformat": "Formato não reconhecido \"$1\".",
+       "apierror-unrecognizedparams": "{{PLURAL:$2|Parâmetro não reconhecido|Parâmetros não reconhecidos}}: $1.",
+       "apierror-unrecognizedvalue": "Valor não reconhecido para o parâmetro <var>$1</var>: $2.",
+       "apierror-unsupportedrepo": "O repositório de ficheiros local não suporta consultas sobre todas as imagens.",
+       "apierror-upload-filekeyneeded": "Tem de ser fornecida uma <var>filekey</var> quando o <var>offset</var> é diferente de zero.",
+       "apierror-upload-filekeynotallowed": "Não pode ser fornecida uma <var>filekey</var> quando o <var>offset</var> é 0.",
+       "apierror-upload-inprogress": "O carregamento a partir da área de ficheiros escondidos já está em progresso.",
+       "apierror-upload-missingresult": "Não há nenhum resultado nos dados de estado.",
+       "apierror-urlparamnormal": "Não foi possível normalizar os parâmetros de imagem para $1.",
+       "apierror-writeapidenied": "Não lhe é permitido editar esta wiki através da API.",
+       "apiwarn-alldeletedrevisions-performance": "Para obter um desempenho melhor ao gerar títulos, defina <kbd>$1dir=newer</kbd>.",
+       "apiwarn-badurlparam": "Não foi possível analisar <var>$1urlparam</var> para $2. Serão utilizadas somente a largura e a altura.",
+       "apiwarn-badutf8": "O valor passado para <var>$1</var> contém dados inválidos ou não normalizados. Os dados textuais devem estar em formato Unicode válido, normalizado em NFC, sem caracteres de controlo C0 exceto HT (\\t), LF (\\n) e CR (\\r).",
+       "apiwarn-checktoken-percentencoding": "Verifique que símbolos como \"+\" na chave estão devidamente codificados com percentagem no URL.",
+       "apiwarn-deprecation-deletedrevs": "<kbd>list=deletedrevs</kbd> foi descontinuado. Em substituição, use <kbd>prop=deletedrevisions</kbd> ou <kbd>list=alldeletedrevisions</kbd>, por favor.",
+       "apiwarn-deprecation-expandtemplates-prop": "Dado que não foi especificado nenhum valor para o parâmetro <var>prop</var> foi usado um formato antigo para o resultado. Esse formato está descontinuado e, de futuro, será definido um valor por omissão para o parâmetro <var>prop</var>, de forma que seja sempre usado um formato novo.",
+       "apiwarn-deprecation-httpsexpected": "Foi usado HTTP quando era esperado HTTPS.",
+       "apiwarn-deprecation-login-botpw": "O início de sessões com uma conta principal através de <kbd>action=login</kbd> foi descontinuado e poderá deixar de funcionar sem aviso prévio. Para continuar a iniciar sessões com <kbd>action=login</kbd>, consulte [[Special:BotPasswords]]. Para continuar a iniciar sessões com a conta principal de forma segura, consulte <kbd>action=clientlogin</kbd>.",
+       "apiwarn-deprecation-login-nobotpw": "O início de sessões com uma conta principal através de <kbd>action=login</kbd> foi descontinuado e poderá deixar de funcionar sem aviso prévio. Para iniciar uma sessão de forma segura, consulte <kbd>action=clientlogin</kbd>.",
+       "apiwarn-deprecation-login-token": "A obtenção de uma chave através de <kbd>action=login</kbd> foi descontinuada. Em substituição, use <kbd>action=query&meta=tokens&type=login</kbd>.",
+       "apiwarn-deprecation-parameter": "O parâmetro <var>$1</var> foi descontinuado.",
+       "apiwarn-deprecation-parse-headitems": "<kbd>prop=headitems</kbd> é obsoleto desde o MediaWiki 1.28. Use <kbd>prop=headhtml</kbd> ao criar novos documentos de HTML, ou <kbd>prop=modules|jsconfigvars</kbd> ao atualizar um documento no lado do cliente.",
+       "apiwarn-deprecation-purge-get": "O uso de <kbd>action=purge</kbd> através de um GET foi descontinuado. Em substituição, use um POST.",
+       "apiwarn-deprecation-withreplacement": "<kbd>$1</kbd> foi descontinuado. Em substituição, use <kbd>$2</kbd>, por favor.",
+       "apiwarn-difftohidden": "Não foi possível criar uma lista das diferenças em relação à r$1: o conteúdo está ocultado.",
+       "apiwarn-errorprinterfailed": "A impressora de erros falhou. Será feita nova tentativa sem parâmetros.",
+       "apiwarn-errorprinterfailed-ex": "A impressora de erros falhou (será feita nova tentativa sem parâmetros): $1",
+       "apiwarn-invalidcategory": "\"$1\" não é uma categoria.",
+       "apiwarn-invalidtitle": "\"$1\" não é um título válido.",
+       "apiwarn-invalidxmlstylesheetext": "Uma folha de estilos deve ter a extensão <code>.xsl</code>.",
+       "apiwarn-invalidxmlstylesheet": "Foi especificada uma folha de estilos inválida ou inexistente.",
+       "apiwarn-invalidxmlstylesheetns": "A folha de estilos deveria estar no espaço nominal {{ns:MediaWiki}}.",
+       "apiwarn-moduleswithoutvars": "A propriedade <kbd>modules</kbd> foi definida mas <kbd>jsconfigvars</kbd> ou <kbd>encodedjsconfigvars</kbd> não o foram. Variáveis de configuração são necessárias para utilização correta de módulos.",
+       "apiwarn-notfile": "\"$1\" não é um ficheiro.",
+       "apiwarn-nothumb-noimagehandler": "Não foi possível criar a miniatura porque $1 não tem uma rotina associada de tratamento de imagens.",
+       "apiwarn-parse-nocontentmodel": "Não foi fornecido um <var>title</var> ou <var>contentmodel</var>, será assumido $1.",
+       "apiwarn-parse-titlewithouttext": "<var>title</var> foi usado sem <var>text</var>, e foram pedidas as propriedades da página analisada. Pretendia usar <var>page</var> em vez de <var>title</var>?",
+       "apiwarn-redirectsandrevids": "Resolução de redirecionamentos não pode ser usada em conjunto com o parâmetro <var>revids</var>. Quaisquer redirecionamentos para os quais <var>revids</var> aponta não foram resolvidos.",
+       "apiwarn-tokennotallowed": "A operação \"$1\" não é permitida para o utilizador atual.",
+       "apiwarn-tokens-origin": "Não é possível obter chaves quando a norma da mesma origem não é aplicada.",
+       "apiwarn-toomanyvalues": "Foram fornecidos demasiados valores para o parâmetro <var>$1</var>. O limite é $2.",
+       "apiwarn-truncatedresult": "Este resultado foi truncado porque ultrapassaria o limite de $1 bytes.",
+       "apiwarn-unclearnowtimestamp": "A passagem de \"$2\" no parâmetro de data e hora <var>$1</var> foi tornada obsoleta. Se, por qualquer razão, precisa de especificar de forma explícita a hora atual sem a calcular no lado do cliente, use <kbd>now</kbd>.",
+       "apiwarn-unrecognizedvalues": "{{PLURAL:$3|Valor não reconhecido|Valores não reconhecidos}} para o parâmetro <var>$1</var>: $2.",
+       "apiwarn-unsupportedarray": "O parâmetro <var>$1</var> usa sintaxe PHP de matrizes não suportada.",
+       "apiwarn-urlparamwidth": "O valor da largura definido em <var>$1urlparam</var> ($2) foi ignorado em favor da largura obtida a partir de <var>$1urlwidth</var>/<var>$1urlheight</var> ($3).",
+       "apiwarn-validationfailed-badchars": "caracteres inválidos na chave (só são permitidos <code>a-z</code>, <code>A-Z</code>, <code>0-9</code>, <code>_</code>, e <code>-</code>).",
+       "apiwarn-validationfailed-badpref": "não é uma preferência válida.",
+       "apiwarn-validationfailed-cannotset": "não pode ser definido por este módulo.",
+       "apiwarn-validationfailed-keytoolong": "chave demasiado longa (não pode ter mais de $1 bytes).",
+       "apiwarn-validationfailed": "Erro de validação de <kbd>$1</kbd>: $2",
+       "apiwarn-wgDebugAPI": "<strong>Aviso de segurança</strong>: <var>$wgDebugAPI</var> está ativado.",
+       "api-feed-error-title": "Erro ($1)",
+       "api-usage-docref": "Consulte $1 para a utilização da API.",
+       "api-usage-mailinglist-ref": "Subscreva a lista de distribuição mediawiki-api-announce em &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; para receber anúncios de descontinuação e de alterações disruptivas da API.",
+       "api-exception-trace": "$1 em $2($3)\n$4",
        "api-credits-header": "Créditos",
        "api-credits": "Programadores da API:\n* Yuri Astrakhan (criador, programador principal, set 2006–set 2007)\n* Roan Kattouw (programador principal, set 2007–2009)\n* Victor Vasiliev\n* Bryan Tong Minh\n* Sam Reed\n* Brad Jorsch (programador principal, 2013–presente)\n\nPode enviar os seus comentários, sugestões e perguntas para o endereço mediawiki-api@lists.wikimedia.org, ou reportar quaisquer defeitos que encontre em https://phabricator.wikimedia.org/."
 }
index adea9ab..83246fb 100644 (file)
        "apihelp-clientlogin-example-login": "{{doc-apihelp-example|clientlogin}}",
        "apihelp-clientlogin-example-login2": "{{doc-apihelp-example|clientlogin}}",
        "apihelp-compare-description": "{{doc-apihelp-description|compare}}",
-       "apihelp-compare-param-fromtitle": "{{doc-apihelp-param|compare|fromtitle}}",
+       "apihelp-compare-param-fromcontentformat": "{{doc-apihelp-param|compare|fromcontentformat}}",
+       "apihelp-compare-param-fromcontentmodel": "{{doc-apihelp-param|compare|fromcontentmodel}}",
        "apihelp-compare-param-fromid": "{{doc-apihelp-param|compare|fromid}}",
+       "apihelp-compare-param-frompst": "{{doc-apihelp-param|compare|frompst}}",
        "apihelp-compare-param-fromrev": "{{doc-apihelp-param|compare|fromrev}}",
-       "apihelp-compare-param-totitle": "{{doc-apihelp-param|compare|totitle}}",
+       "apihelp-compare-param-fromtext": "{{doc-apihelp-param|compare|fromtext}}",
+       "apihelp-compare-param-fromtitle": "{{doc-apihelp-param|compare|fromtitle}}",
+       "apihelp-compare-param-prop": "{{doc-apihelp-param|compare|prop}}",
+       "apihelp-compare-param-tocontentformat": "{{doc-apihelp-param|compare|tocontentformat}}",
+       "apihelp-compare-param-tocontentmodel": "{{doc-apihelp-param|compare|tocontentmodel}}",
        "apihelp-compare-param-toid": "{{doc-apihelp-param|compare|toid}}",
+       "apihelp-compare-param-topst": "{{doc-apihelp-param|compare|topst}}",
+       "apihelp-compare-param-torelative": "{{doc-apihelp-param|compare|torelative}}",
        "apihelp-compare-param-torev": "{{doc-apihelp-param|compare|torev}}",
+       "apihelp-compare-param-totext": "{{doc-apihelp-param|compare|totext}}",
+       "apihelp-compare-param-totitle": "{{doc-apihelp-param|compare|totitle}}",
+       "apihelp-compare-paramvalue-prop-comment": "{{doc-apihelp-paramvalue|compare|prop|comment}}",
+       "apihelp-compare-paramvalue-prop-diff": "{{doc-apihelp-paramvalue|compare|prop|diff}}",
+       "apihelp-compare-paramvalue-prop-diffsize": "{{doc-apihelp-paramvalue|compare|prop|diffsize}}",
+       "apihelp-compare-paramvalue-prop-ids": "{{doc-apihelp-paramvalue|compare|prop|ids}}",
+       "apihelp-compare-paramvalue-prop-parsedcomment": "{{doc-apihelp-paramvalue|compare|prop|parsedcomment}}",
+       "apihelp-compare-paramvalue-prop-rel": "{{doc-apihelp-paramvalue|compare|prop|rel}}",
+       "apihelp-compare-paramvalue-prop-size": "{{doc-apihelp-paramvalue|compare|prop|size}}",
+       "apihelp-compare-paramvalue-prop-title": "{{doc-apihelp-paramvalue|compare|prop|title}}",
+       "apihelp-compare-paramvalue-prop-user": "{{doc-apihelp-paramvalue|compare|prop|user}}",
        "apihelp-compare-example-1": "{{doc-apihelp-example|compare}}",
        "apihelp-createaccount-description": "{{doc-apihelp-description|createaccount}}",
        "apihelp-createaccount-param-preservestate": "{{doc-apihelp-param|createaccount|preservestate|info=This message is displayed in addition to {{msg-mw|api-help-authmanagerhelper-preservestate}}.}}",
        "apierror-changeauth-norequest": "{{doc-apierror}}",
        "apierror-chunk-too-small": "{{doc-apierror}}\n\nParameters:\n* $1 - Minimum size in bytes.",
        "apierror-cidrtoobroad": "{{doc-apierror}}\n\nParameters:\n* $1 - \"IPv4\" or \"IPv6\"\n* $2 - Minimum CIDR mask length.",
-       "apierror-compare-inputneeded": "{{doc-apierror}}",
+       "apierror-compare-no-title": "{{doc-apierror}}",
+       "apierror-compare-relative-to-nothing": "{{doc-apierror}}",
        "apierror-contentserializationexception": "{{doc-apierror}}\n\nParameters:\n* $1 - Exception text, may end with punctuation. Currently this is probably English, hopefully we'll fix that in the future.",
        "apierror-contenttoobig": "{{doc-apierror}}\n\nParameters:\n* $1 - Maximum article size in kilobytes.",
        "apierror-copyuploadbaddomain": "{{doc-apierror}}",
        "apierror-maxlag": "{{doc-apierror}}\n\nParameters:\n* $1 - Database lag in seconds.\n* $2 - Database server that is lagged.",
        "apierror-mimesearchdisabled": "{{doc-apierror}}",
        "apierror-missingcontent-pageid": "{{doc-apierror}}\n\nParameters:\n* $1 - Page ID number.",
+       "apierror-missingcontent-revid": "{{doc-apierror}}\n\nParameters:\n* $1 - Revision ID number",
        "apierror-missingparam-at-least-one-of": "{{doc-apierror}}\n\nParameters:\n* $1 - List of parameter names.\n* $2 - Number of parameters.",
        "apierror-missingparam-one-of": "{{doc-apierror}}\n\nParameters:\n* $1 - List of parameter names.\n* $2 - Number of parameters.",
        "apierror-missingparam": "{{doc-apierror}}\n\nParameters:\n* $1 - Parameter name.",
        "apierror-missingrev-pageid": "{{doc-apierror}}\n\nParameters:\n* $1 - Page ID number.",
+       "apierror-missingrev-title": "{{doc-apierror}}\n\nParameters:\n* $1 - Page title.",
        "apierror-missingtitle-createonly": "{{doc-apierror}}",
        "apierror-missingtitle": "{{doc-apierror}}",
        "apierror-missingtitle-byname": "{{doc-apierror}}",
        "apiwarn-badurlparam": "{{doc-apierror}}\n\nParameters:\n* $1 - Module parameter prefix, e.g. \"bl\".\n* $2 - Image title.",
        "apiwarn-badutf8": "{{doc-apierror}}\n\nParameters:\n* $1 - Parameter name.\n{{doc-important|Do not translate \"\\t\", \"\\n\", and \"\\r\"}}",
        "apiwarn-checktoken-percentencoding": "{{doc-apierror}}",
+       "apiwarn-compare-nocontentmodel": "{{doc-apierror}}\n\nParameters:\n* $1 - Content model being assumed.",
        "apiwarn-deprecation-deletedrevs": "{{doc-apierror}}",
        "apiwarn-deprecation-expandtemplates-prop": "{{doc-apierror}}",
        "apiwarn-deprecation-httpsexpected": "{{doc-apierror}}",
index bccb147..85894ed 100644 (file)
@@ -1007,22 +1007,22 @@ abstract class ContentHandler {
         * @return ParserOptions
         */
        public function makeParserOptions( $context ) {
-               global $wgContLang, $wgEnableParserLimitReporting;
+               global $wgContLang;
 
                if ( $context instanceof IContextSource ) {
-                       $options = ParserOptions::newFromContext( $context );
+                       $user = $context->getUser();
+                       $lang = $context->getLanguage();
                } elseif ( $context instanceof User ) { // settings per user (even anons)
-                       $options = ParserOptions::newFromUser( $context );
+                       $user = $context;
+                       $lang = null;
                } elseif ( $context === 'canonical' ) { // canonical settings
-                       $options = ParserOptions::newFromUserAndLang( new User, $wgContLang );
+                       $user = new User;
+                       $lang = $wgContLang;
                } else {
                        throw new MWException( "Bad context for parser options: $context" );
                }
 
-               $options->enableLimitReport( $wgEnableParserLimitReporting ); // show inclusion/loop reports
-               $options->setTidy( true ); // fix bad HTML
-
-               return $options;
+               return ParserOptions::newCanonical( $user, $lang );
        }
 
        /**
index ff59854..423d43e 100644 (file)
@@ -1064,6 +1064,7 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
         *   - c) The return value is a map of (cache key => value) in the order of $keyedIds
         *
         * @see WANObjectCache::getWithSetCallback()
+        * @see WANObjectCache::getMultiWithUnionSetCallback()
         *
         * Example usage:
         * @code
@@ -1134,6 +1135,127 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
                return $values;
        }
 
+       /**
+        * Method to fetch/regenerate multiple cache keys at once
+        *
+        * This works the same as getWithSetCallback() except:
+        *   - a) The $keys argument expects the result of WANObjectCache::makeMultiKeys()
+        *   - b) The $callback argument expects a callback returning a map of (ID => new value)
+        *        for all entity IDs in $regenById and it takes the following arguments:
+        *          - $ids: a list of entity IDs to regenerate
+        *          - &$ttls: a reference to the (entity ID => new TTL) map
+        *          - &$setOpts: a reference to options for set() which can be altered
+        *   - c) The return value is a map of (cache key => value) in the order of $keyedIds
+        *   - d) The "lockTSE" and "busyValue" options are ignored
+        *
+        * @see WANObjectCache::getWithSetCallback()
+        * @see WANObjectCache::getMultiWithSetCallback()
+        *
+        * Example usage:
+        * @code
+        *     $rows = $cache->getMultiWithUnionSetCallback(
+        *         // Map of cache keys to entity IDs
+        *         $cache->makeMultiKeys(
+        *             $this->fileVersionIds(),
+        *             function ( $id, WANObjectCache $cache ) {
+        *                 return $cache->makeKey( 'file-version', $id );
+        *             }
+        *         ),
+        *         // Time-to-live (in seconds)
+        *         $cache::TTL_DAY,
+        *         // Function that derives the new key value
+        *         function ( array $ids, array &$ttls, array &$setOpts ) {
+        *             $dbr = wfGetDB( DB_REPLICA );
+        *             // Account for any snapshot/replica DB lag
+        *             $setOpts += Database::getCacheSetOptions( $dbr );
+        *
+        *             // Load the rows for these files
+        *             $rows = [];
+        *             $res = $dbr->select( 'file', '*', [ 'id' => $ids ], __METHOD__ );
+        *             foreach ( $res as $row ) {
+        *                 $rows[$row->id] = $row;
+        *                 $mtime = wfTimestamp( TS_UNIX, $row->timestamp );
+        *                 $ttls[$row->id] = $this->adaptiveTTL( $mtime, $ttls[$row->id] );
+        *             }
+        *
+        *             return $rows;
+        *         },
+        *         ]
+        *     );
+        *     $files = array_map( [ __CLASS__, 'newFromRow' ], $rows );
+        * @endcode
+        *
+        * @param ArrayIterator $keyedIds Result of WANObjectCache::makeMultiKeys()
+        * @param integer $ttl Seconds to live for key updates
+        * @param callable $callback Callback the yields entity regeneration callbacks
+        * @param array $opts Options map
+        * @return array Map of (cache key => value) in the same order as $keyedIds
+        * @since 1.30
+        */
+       final public function getMultiWithUnionSetCallback(
+               ArrayIterator $keyedIds, $ttl, callable $callback, array $opts = []
+       ) {
+               $idsByValueKey = iterator_to_array( $keyedIds, true );
+               $valueKeys = array_keys( $idsByValueKey );
+               $checkKeys = isset( $opts['checkKeys'] ) ? $opts['checkKeys'] : [];
+               unset( $opts['lockTSE'] ); // incompatible
+               unset( $opts['busyValue'] ); // incompatible
+
+               // Load required keys into process cache in one go
+               $keysGet = $this->getNonProcessCachedKeys( $valueKeys, $opts );
+               $this->warmupCache = $this->getRawKeysForWarmup( $keysGet, $checkKeys );
+               $this->warmupKeyMisses = 0;
+
+               // IDs of entities known to be in need of regeneration
+               $idsRegen = [];
+
+               // Find out which keys are missing/deleted/stale
+               $curTTLs = [];
+               $asOfs = [];
+               $curByKey = $this->getMulti( $keysGet, $curTTLs, $checkKeys, $asOfs );
+               foreach ( $keysGet as $key ) {
+                       if ( !array_key_exists( $key, $curByKey ) || $curTTLs[$key] < 0 ) {
+                               $idsRegen[] = $idsByValueKey[$key];
+                       }
+               }
+
+               // Run the callback to populate the regeneration value map for all required IDs
+               $newSetOpts = [];
+               $newTTLsById = array_fill_keys( $idsRegen, $ttl );
+               $newValsById = $idsRegen ? $callback( $idsRegen, $newTTLsById, $newSetOpts ) : [];
+
+               // Wrap $callback to match the getWithSetCallback() format while passing $id to $callback
+               $id = null; // current entity ID
+               $func = function ( $oldValue, &$ttl, &$setOpts, $oldAsOf )
+                       use ( $callback, &$id, $newValsById, $newTTLsById, $newSetOpts )
+               {
+                       if ( array_key_exists( $id, $newValsById ) ) {
+                               // Value was already regerated as expected, so use the value in $newValsById
+                               $newValue = $newValsById[$id];
+                               $ttl = $newTTLsById[$id];
+                               $setOpts = $newSetOpts;
+                       } else {
+                               // Pre-emptive/popularity refresh and version mismatch cases are not detected
+                               // above and thus $newValsById has no entry. Run $callback on this single entity.
+                               $ttls = [ $id => $ttl ];
+                               $newValue = $callback( [ $id ], $ttls, $setOpts )[$id];
+                               $ttl = $ttls[$id];
+                       }
+
+                       return $newValue;
+               };
+
+               // Run the cache-aside logic using warmupCache instead of persistent cache queries
+               $values = [];
+               foreach ( $idsByValueKey as $key => $id ) { // preserve order
+                       $values[$key] = $this->getWithSetCallback( $key, $ttl, $func, $opts );
+               }
+
+               $this->warmupCache = [];
+
+               return $values;
+       }
+
        /**
         * Locally set a key to expire soon if it is stale based on $purgeTimestamp
         *
index 2adc5fb..0e23a88 100644 (file)
@@ -1055,6 +1055,13 @@ class WikiPage implements Page, IDBAccessObject {
        ) {
                $useParserCache =
                        ( !$forceParse ) && $this->shouldCheckParserCache( $parserOptions, $oldid );
+
+               if ( $useParserCache && !$parserOptions->isSafeToCache() ) {
+                       throw new InvalidArgumentException(
+                               'The supplied ParserOptions are not safe to cache. Fix the options or set $forceParse = true.'
+                       );
+               }
+
                wfDebug( __METHOD__ .
                        ': using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" );
                if ( $parserOptions->getStubThreshold() ) {
index 76a7e1e..9c6cf93 100644 (file)
@@ -138,6 +138,20 @@ class ParserCache {
         * @return bool|mixed|string
         */
        public function getKey( $article, $popts, $useOutdated = true ) {
+               $dummy = null;
+               return $this->getKeyReal( $article, $popts, $useOutdated, $dummy );
+       }
+
+       /**
+        * Temporary internal function to allow accessing $usedOptions
+        * @todo Merge this back to self::getKey() when ParserOptions::optionsHashPre30() is removed
+        * @param WikiPage $article
+        * @param ParserOptions $popts
+        * @param bool $useOutdated (default true)
+        * @param array &$usedOptions Don't use this, it will go away soon
+        * @return bool|mixed|string
+        */
+       private function getKeyReal( $article, $popts, $useOutdated, &$usedOptions ) {
                global $wgCacheEpoch;
 
                if ( $popts instanceof User ) {
@@ -204,7 +218,8 @@ class ParserCache {
 
                $touched = $article->getTouched();
 
-               $parserOutputKey = $this->getKey( $article, $popts, $useOutdated );
+               $usedOptions = null;
+               $parserOutputKey = $this->getKeyReal( $article, $popts, $useOutdated, $usedOptions );
                if ( $parserOutputKey === false ) {
                        wfIncrStats( 'pcache.miss.absent' );
                        return false;
@@ -213,6 +228,13 @@ class ParserCache {
                $casToken = null;
                /** @var ParserOutput $value */
                $value = $this->mMemc->get( $parserOutputKey, $casToken, BagOStuff::READ_VERIFIED );
+               if ( !$value ) {
+                       $parserOutputKey = $this->getParserOutputKey(
+                               $article,
+                               $popts->optionsHashPre30( $usedOptions, $article->getTitle() )
+                       );
+                       $value = $this->mMemc->get( $parserOutputKey, $casToken, BagOStuff::READ_VERIFIED );
+               }
                if ( !$value ) {
                        wfDebug( "ParserOutput cache miss.\n" );
                        wfIncrStats( "pcache.miss.absent" );
index d097414..f8ed63f 100644 (file)
@@ -25,397 +25,652 @@ use Wikimedia\ScopedCallback;
 /**
  * @brief Set options of the Parser
  *
- * All member variables are supposed to be private in theory, although in
- * practice this is not the case.
+ * How to add an option in core:
+ *  1. Add it to one of the arrays in ParserOptions::setDefaults()
+ *  2. If necessary, add an entry to ParserOptions::$inCacheKey
+ *  3. Add a getter and setter in the section for that.
+ *
+ * How to add an option in an extension:
+ *  1. Use the 'ParserOptionsRegister' hook to register it.
+ *  2. Where necessary, use $popt->getOption() and $popt->setOption()
+ *     to access it.
  *
  * @ingroup Parser
  */
 class ParserOptions {
 
        /**
-        * Interlanguage links are removed and returned in an array
+        * Default values for all options that are relevant for caching.
+        * @see self::getDefaults()
+        * @var array|null
         */
-       private $mInterwikiMagic;
+       private static $defaults = null;
 
        /**
-        * Allow external images inline?
+        * Lazy-loaded options
+        * @var callback[]
         */
-       private $mAllowExternalImages;
+       private static $lazyOptions = [
+               'dateformat' => [ __CLASS__, 'initDateFormat' ],
+       ];
 
        /**
-        * If not, any exception?
+        * Specify options that are included in the cache key
+        * @var array
         */
-       private $mAllowExternalImagesFrom;
+       private static $inCacheKey = [
+               'dateformat' => true,
+               'editsection' => true,
+               'numberheadings' => true,
+               'thumbsize' => true,
+               'stubthreshold' => true,
+               'printable' => true,
+               'userlang' => true,
+               'wrapclass' => true,
+       ];
 
        /**
-        * If not or it doesn't match, should we check an on-wiki whitelist?
+        * Current values for all options that are relevant for caching.
+        * @var array
         */
-       private $mEnableImageWhitelist;
+       private $options;
 
        /**
-        * Date format index
+        * Timestamp used for {{CURRENTDAY}} etc.
+        * @var string|null
+        * @note Caching based on parse time is handled externally
         */
-       private $mDateFormat = null;
+       private $mTimestamp;
 
        /**
-        * Create "edit section" links?
+        * Stored user object
+        * @var User
+        * @todo Track this for caching somehow without fragmenting the cache insanely
         */
-       private $mEditSection = true;
+       private $mUser;
 
        /**
-        * Allow inclusion of special pages?
+        * Function to be called when an option is accessed.
+        * @var callable|null
+        * @note Used for collecting used options, does not affect caching
         */
-       private $mAllowSpecialInclusion;
+       private $onAccessCallback = null;
 
        /**
-        * Use tidy to cleanup output HTML?
+        * If the page being parsed is a redirect, this should hold the redirect
+        * target.
+        * @var Title|null
+        * @todo Track this for caching somehow
         */
-       private $mTidy = false;
+       private $redirectTarget = null;
 
        /**
-        * Which lang to call for PLURAL and GRAMMAR
+        * Appended to the options hash
         */
-       private $mInterfaceMessage = false;
+       private $mExtraKey = '';
 
        /**
-        * Overrides $mInterfaceMessage with arbitrary language
+        * @name Option accessors
+        * @{
         */
-       private $mTargetLanguage = null;
 
        /**
-        * Maximum size of template expansions, in bytes
+        * Fetch an option, generically
+        * @since 1.30
+        * @param string $name Option name
+        * @return mixed
         */
-       private $mMaxIncludeSize;
+       public function getOption( $name ) {
+               if ( !array_key_exists( $name, $this->options ) ) {
+                       throw new InvalidArgumentException( "Unknown parser option $name" );
+               }
 
-       /**
-        * Maximum number of nodes touched by PPFrame::expand()
-        */
-       private $mMaxPPNodeCount;
+               if ( isset( self::$lazyOptions[$name] ) && $this->options[$name] === null ) {
+                       $this->options[$name] = call_user_func( self::$lazyOptions[$name], $this, $name );
+               }
+               if ( !empty( self::$inCacheKey[$name] ) ) {
+                       $this->optionUsed( $name );
+               }
+               return $this->options[$name];
+       }
 
        /**
-        * Maximum number of nodes generated by Preprocessor::preprocessToObj()
-        */
-       private $mMaxGeneratedPPNodeCount;
+        * Set an option, generically
+        * @since 1.30
+        * @param string $name Option name
+        * @param mixed $value New value. Passing null will set null, unlike many
+        *  of the existing accessors which ignore null for historical reasons.
+        * @return mixed Old value
+        */
+       public function setOption( $name, $value ) {
+               if ( !array_key_exists( $name, $this->options ) ) {
+                       throw new InvalidArgumentException( "Unknown parser option $name" );
+               }
+               $old = $this->options[$name];
+               $this->options[$name] = $value;
+               return $old;
+       }
 
        /**
-        * Maximum recursion depth in PPFrame::expand()
+        * Legacy implementation
+        * @since 1.30 For implementing legacy setters only. Don't use this in new code.
+        * @deprecated since 1.30
+        * @param string $name Option name
+        * @param mixed $value New value. Passing null does not set the value.
+        * @return mixed Old value
         */
-       private $mMaxPPExpandDepth;
+       protected function setOptionLegacy( $name, $value ) {
+               if ( !array_key_exists( $name, $this->options ) ) {
+                       throw new InvalidArgumentException( "Unknown parser option $name" );
+               }
+               return wfSetVar( $this->options[$name], $value );
+       }
 
        /**
-        * Maximum recursion depth for templates within templates
+        * Whether to extract interlanguage links
+        *
+        * When true, interlanguage links will be returned by
+        * ParserOutput::getLanguageLinks() instead of generating link HTML.
+        *
+        * @return bool
         */
-       private $mMaxTemplateDepth;
+       public function getInterwikiMagic() {
+               return $this->getOption( 'interwikiMagic' );
+       }
 
        /**
-        * Maximum number of calls per parse to expensive parser functions
+        * Specify whether to extract interlanguage links
+        * @param bool|null $x New value (null is no change)
+        * @return bool Old value
         */
-       private $mExpensiveParserFunctionLimit;
+       public function setInterwikiMagic( $x ) {
+               return $this->setOptionLegacy( 'interwikiMagic', $x );
+       }
 
        /**
-        * Remove HTML comments. ONLY APPLIES TO PREPROCESS OPERATIONS
+        * Allow all external images inline?
+        * @return bool
         */
-       private $mRemoveComments = true;
+       public function getAllowExternalImages() {
+               return $this->getOption( 'allowExternalImages' );
+       }
 
        /**
-        * @var callable Callback for current revision fetching; first argument to call_user_func().
+        * Allow all external images inline?
+        * @param bool|null $x New value (null is no change)
+        * @return bool Old value
         */
-       private $mCurrentRevisionCallback =
-               [ 'Parser', 'statelessFetchRevision' ];
+       public function setAllowExternalImages( $x ) {
+               return $this->setOptionLegacy( 'allowExternalImages', $x );
+       }
 
        /**
-        * @var callable Callback for template fetching; first argument to call_user_func().
+        * External images to allow
+        *
+        * When self::getAllowExternalImages() is false
+        *
+        * @return string|string[] URLs to allow
         */
-       private $mTemplateCallback =
-               [ 'Parser', 'statelessFetchTemplate' ];
+       public function getAllowExternalImagesFrom() {
+               return $this->getOption( 'allowExternalImagesFrom' );
+       }
 
        /**
-        * @var callable|null Callback to generate a guess for {{REVISIONID}}
+        * External images to allow
+        *
+        * When self::getAllowExternalImages() is false
+        *
+        * @param string|string[]|null $x New value (null is no change)
+        * @return string|string[] Old value
         */
-       private $mSpeculativeRevIdCallback;
+       public function setAllowExternalImagesFrom( $x ) {
+               return $this->setOptionLegacy( 'allowExternalImagesFrom', $x );
+       }
 
        /**
-        * Enable limit report in an HTML comment on output
+        * Use the on-wiki external image whitelist?
+        * @return bool
         */
-       private $mEnableLimitReport = false;
+       public function getEnableImageWhitelist() {
+               return $this->getOption( 'enableImageWhitelist' );
+       }
 
        /**
-        * Timestamp used for {{CURRENTDAY}} etc.
+        * Use the on-wiki external image whitelist?
+        * @param bool|null $x New value (null is no change)
+        * @return bool Old value
         */
-       private $mTimestamp;
+       public function setEnableImageWhitelist( $x ) {
+               return $this->setOptionLegacy( 'enableImageWhitelist', $x );
+       }
 
        /**
-        * Target attribute for external links
+        * Create "edit section" links?
+        * @return bool
         */
-       private $mExternalLinkTarget;
+       public function getEditSection() {
+               return $this->getOption( 'editsection' );
+       }
 
        /**
-        * Clean up signature texts?
-        * @see Parser::cleanSig
+        * Create "edit section" links?
+        * @param bool|null $x New value (null is no change)
+        * @return bool Old value
         */
-       private $mCleanSignatures;
+       public function setEditSection( $x ) {
+               return $this->setOptionLegacy( 'editsection', $x );
+       }
 
        /**
-        * Transform wiki markup when saving the page?
+        * Automatically number headings?
+        * @return bool
         */
-       private $mPreSaveTransform = true;
+       public function getNumberHeadings() {
+               return $this->getOption( 'numberheadings' );
+       }
 
        /**
-        * Whether content conversion should be disabled
+        * Automatically number headings?
+        * @param bool|null $x New value (null is no change)
+        * @return bool Old value
         */
-       private $mDisableContentConversion;
+       public function setNumberHeadings( $x ) {
+               return $this->setOptionLegacy( 'numberheadings', $x );
+       }
 
        /**
-        * Whether title conversion should be disabled
+        * Allow inclusion of special pages?
+        * @return bool
         */
-       private $mDisableTitleConversion;
+       public function getAllowSpecialInclusion() {
+               return $this->getOption( 'allowSpecialInclusion' );
+       }
 
        /**
-        * Automatically number headings?
+        * Allow inclusion of special pages?
+        * @param bool|null $x New value (null is no change)
+        * @return bool Old value
         */
-       private $mNumberHeadings;
+       public function setAllowSpecialInclusion( $x ) {
+               return $this->setOptionLegacy( 'allowSpecialInclusion', $x );
+       }
 
        /**
-        * Thumb size preferred by the user.
+        * Use tidy to cleanup output HTML?
+        * @return bool
         */
-       private $mThumbSize;
+       public function getTidy() {
+               return $this->getOption( 'tidy' );
+       }
 
        /**
-        * Maximum article size of an article to be marked as "stub"
+        * Use tidy to cleanup output HTML?
+        * @param bool|null $x New value (null is no change)
+        * @return bool Old value
         */
-       private $mStubThreshold;
+       public function setTidy( $x ) {
+               return $this->setOptionLegacy( 'tidy', $x );
+       }
 
        /**
-        * Language object of the User language.
+        * Parsing an interface message?
+        * @return bool
         */
-       private $mUserLang;
+       public function getInterfaceMessage() {
+               return $this->getOption( 'interfaceMessage' );
+       }
 
        /**
-        * @var User
-        * Stored user object
+        * Parsing an interface message?
+        * @param bool|null $x New value (null is no change)
+        * @return bool Old value
         */
-       private $mUser;
+       public function setInterfaceMessage( $x ) {
+               return $this->setOptionLegacy( 'interfaceMessage', $x );
+       }
 
        /**
-        * Parsing the page for a "preview" operation?
+        * Target language for the parse
+        * @return Language|null
         */
-       private $mIsPreview = false;
+       public function getTargetLanguage() {
+               return $this->getOption( 'targetLanguage' );
+       }
 
        /**
-        * Parsing the page for a "preview" operation on a single section?
+        * Target language for the parse
+        * @param Language|null $x New value
+        * @return Language|null Old value
         */
-       private $mIsSectionPreview = false;
+       public function setTargetLanguage( $x ) {
+               return $this->setOption( 'targetLanguage', $x );
+       }
 
        /**
-        * Parsing the printable version of the page?
+        * Maximum size of template expansions, in bytes
+        * @return int
         */
-       private $mIsPrintable = false;
+       public function getMaxIncludeSize() {
+               return $this->getOption( 'maxIncludeSize' );
+       }
 
        /**
-        * Extra key that should be present in the caching key.
+        * Maximum size of template expansions, in bytes
+        * @param int|null $x New value (null is no change)
+        * @return int Old value
         */
-       private $mExtraKey = '';
+       public function setMaxIncludeSize( $x ) {
+               return $this->setOptionLegacy( 'maxIncludeSize', $x );
+       }
 
        /**
-        * Are magic ISBN links enabled?
+        * Maximum number of nodes touched by PPFrame::expand()
+        * @return int
         */
-       private $mMagicISBNLinks = true;
+       public function getMaxPPNodeCount() {
+               return $this->getOption( 'maxPPNodeCount' );
+       }
 
        /**
-        * Are magic PMID links enabled?
+        * Maximum number of nodes touched by PPFrame::expand()
+        * @param int|null $x New value (null is no change)
+        * @return int Old value
         */
-       private $mMagicPMIDLinks = true;
+       public function setMaxPPNodeCount( $x ) {
+               return $this->setOptionLegacy( 'maxPPNodeCount', $x );
+       }
 
        /**
-        * Are magic RFC links enabled?
+        * Maximum number of nodes generated by Preprocessor::preprocessToObj()
+        * @return int
         */
-       private $mMagicRFCLinks = true;
+       public function getMaxGeneratedPPNodeCount() {
+               return $this->getOption( 'maxGeneratedPPNodeCount' );
+       }
 
        /**
-        * Function to be called when an option is accessed.
+        * Maximum number of nodes generated by Preprocessor::preprocessToObj()
+        * @param int|null $x New value (null is no change)
+        * @return int
         */
-       private $onAccessCallback = null;
+       public function setMaxGeneratedPPNodeCount( $x ) {
+               return $this->setOptionLegacy( 'maxGeneratedPPNodeCount', $x );
+       }
 
        /**
-        * If the page being parsed is a redirect, this should hold the redirect
-        * target.
-        * @var Title|null
+        * Maximum recursion depth in PPFrame::expand()
+        * @return int
         */
-       private $redirectTarget = null;
+       public function getMaxPPExpandDepth() {
+               return $this->getOption( 'maxPPExpandDepth' );
+       }
 
        /**
-        * If the wiki is configured to allow raw html ($wgRawHtml = true)
-        * is it allowed in the specific case of parsing this page.
-        *
-        * This is meant to disable unsafe parser tags in cases where
-        * a malicious user may control the input to the parser.
-        *
-        * @note This is expected to be true for normal pages even if the
-        *  wiki has $wgRawHtml disabled in general. The setting only
-        *  signifies that raw html would be unsafe in the current context
-        *  provided that raw html is allowed at all.
-        * @var boolean
+        * Maximum recursion depth for templates within templates
+        * @return int
         */
-       private $allowUnsafeRawHtml = true;
+       public function getMaxTemplateDepth() {
+               return $this->getOption( 'maxTemplateDepth' );
+       }
 
        /**
-        * CSS class to use to wrap output from Parser::parse().
-        * @var string|false
+        * Maximum recursion depth for templates within templates
+        * @param int|null $x New value (null is no change)
+        * @return int Old value
         */
-       private $wrapOutputClass = 'mw-parser-output';
-
-       public function getInterwikiMagic() {
-               return $this->mInterwikiMagic;
-       }
-
-       public function getAllowExternalImages() {
-               return $this->mAllowExternalImages;
-       }
-
-       public function getAllowExternalImagesFrom() {
-               return $this->mAllowExternalImagesFrom;
-       }
-
-       public function getEnableImageWhitelist() {
-               return $this->mEnableImageWhitelist;
-       }
-
-       public function getEditSection() {
-               return $this->mEditSection;
+       public function setMaxTemplateDepth( $x ) {
+               return $this->setOptionLegacy( 'maxTemplateDepth', $x );
        }
 
-       public function getNumberHeadings() {
-               $this->optionUsed( 'numberheadings' );
-
-               return $this->mNumberHeadings;
+       /**
+        * Maximum number of calls per parse to expensive parser functions
+        * @since 1.20
+        * @return int
+        */
+       public function getExpensiveParserFunctionLimit() {
+               return $this->getOption( 'expensiveParserFunctionLimit' );
        }
 
-       public function getAllowSpecialInclusion() {
-               return $this->mAllowSpecialInclusion;
+       /**
+        * Maximum number of calls per parse to expensive parser functions
+        * @since 1.20
+        * @param int|null $x New value (null is no change)
+        * @return int Old value
+        */
+       public function setExpensiveParserFunctionLimit( $x ) {
+               return $this->setOptionLegacy( 'expensiveParserFunctionLimit', $x );
        }
 
-       public function getTidy() {
-               return $this->mTidy;
+       /**
+        * Remove HTML comments
+        * @warning Only applies to preprocess operations
+        * @return bool
+        */
+       public function getRemoveComments() {
+               return $this->getOption( 'removeComments' );
        }
 
-       public function getInterfaceMessage() {
-               return $this->mInterfaceMessage;
+       /**
+        * Remove HTML comments
+        * @warning Only applies to preprocess operations
+        * @param bool|null $x New value (null is no change)
+        * @return bool Old value
+        */
+       public function setRemoveComments( $x ) {
+               return $this->setOptionLegacy( 'removeComments', $x );
        }
 
-       public function getTargetLanguage() {
-               return $this->mTargetLanguage;
+       /**
+        * Enable limit report in an HTML comment on output
+        * @return bool
+        */
+       public function getEnableLimitReport() {
+               return $this->getOption( 'enableLimitReport' );
        }
 
-       public function getMaxIncludeSize() {
-               return $this->mMaxIncludeSize;
+       /**
+        * Enable limit report in an HTML comment on output
+        * @param bool|null $x New value (null is no change)
+        * @return bool Old value
+        */
+       public function enableLimitReport( $x = true ) {
+               return $this->setOptionLegacy( 'enableLimitReport', $x );
        }
 
-       public function getMaxPPNodeCount() {
-               return $this->mMaxPPNodeCount;
+       /**
+        * Clean up signature texts?
+        * @see Parser::cleanSig
+        * @return bool
+        */
+       public function getCleanSignatures() {
+               return $this->getOption( 'cleanSignatures' );
        }
 
-       public function getMaxGeneratedPPNodeCount() {
-               return $this->mMaxGeneratedPPNodeCount;
+       /**
+        * Clean up signature texts?
+        * @see Parser::cleanSig
+        * @param bool|null $x New value (null is no change)
+        * @return bool Old value
+        */
+       public function setCleanSignatures( $x ) {
+               return $this->setOptionLegacy( 'cleanSignatures', $x );
        }
 
-       public function getMaxPPExpandDepth() {
-               return $this->mMaxPPExpandDepth;
+       /**
+        * Target attribute for external links
+        * @return string
+        */
+       public function getExternalLinkTarget() {
+               return $this->getOption( 'externalLinkTarget' );
        }
 
-       public function getMaxTemplateDepth() {
-               return $this->mMaxTemplateDepth;
+       /**
+        * Target attribute for external links
+        * @param string|null $x New value (null is no change)
+        * @return string Old value
+        */
+       public function setExternalLinkTarget( $x ) {
+               return $this->setOptionLegacy( 'externalLinkTarget', $x );
        }
 
-       /* @since 1.20 */
-       public function getExpensiveParserFunctionLimit() {
-               return $this->mExpensiveParserFunctionLimit;
+       /**
+        * Whether content conversion should be disabled
+        * @return bool
+        */
+       public function getDisableContentConversion() {
+               return $this->getOption( 'disableContentConversion' );
        }
 
-       public function getRemoveComments() {
-               return $this->mRemoveComments;
+       /**
+        * Whether content conversion should be disabled
+        * @param bool|null $x New value (null is no change)
+        * @return bool Old value
+        */
+       public function disableContentConversion( $x = true ) {
+               return $this->setOptionLegacy( 'disableContentConversion', $x );
        }
 
-       /* @since 1.24 */
-       public function getCurrentRevisionCallback() {
-               return $this->mCurrentRevisionCallback;
+       /**
+        * Whether title conversion should be disabled
+        * @return bool
+        */
+       public function getDisableTitleConversion() {
+               return $this->getOption( 'disableTitleConversion' );
        }
 
-       public function getTemplateCallback() {
-               return $this->mTemplateCallback;
+       /**
+        * Whether title conversion should be disabled
+        * @param bool|null $x New value (null is no change)
+        * @return bool Old value
+        */
+       public function disableTitleConversion( $x = true ) {
+               return $this->setOptionLegacy( 'disableTitleConversion', $x );
        }
 
-       /** @since 1.28 */
-       public function getSpeculativeRevIdCallback() {
-               return $this->mSpeculativeRevIdCallback;
+       /**
+        * Thumb size preferred by the user.
+        * @return int
+        */
+       public function getThumbSize() {
+               return $this->getOption( 'thumbsize' );
        }
 
-       public function getEnableLimitReport() {
-               return $this->mEnableLimitReport;
+       /**
+        * Thumb size preferred by the user.
+        * @param int|null $x New value (null is no change)
+        * @return int Old value
+        */
+       public function setThumbSize( $x ) {
+               return $this->setOptionLegacy( 'thumbsize', $x );
        }
 
-       public function getCleanSignatures() {
-               return $this->mCleanSignatures;
+       /**
+        * Thumb size preferred by the user.
+        * @return int
+        */
+       public function getStubThreshold() {
+               return $this->getOption( 'stubthreshold' );
        }
 
-       public function getExternalLinkTarget() {
-               return $this->mExternalLinkTarget;
+       /**
+        * Thumb size preferred by the user.
+        * @param int|null $x New value (null is no change)
+        * @return int Old value
+        */
+       public function setStubThreshold( $x ) {
+               return $this->setOptionLegacy( 'stubthreshold', $x );
        }
 
-       public function getDisableContentConversion() {
-               return $this->mDisableContentConversion;
+       /**
+        * Parsing the page for a "preview" operation?
+        * @return bool
+        */
+       public function getIsPreview() {
+               return $this->getOption( 'isPreview' );
        }
 
-       public function getDisableTitleConversion() {
-               return $this->mDisableTitleConversion;
+       /**
+        * Parsing the page for a "preview" operation?
+        * @param bool|null $x New value (null is no change)
+        * @return bool Old value
+        */
+       public function setIsPreview( $x ) {
+               return $this->setOptionLegacy( 'isPreview', $x );
        }
 
-       public function getThumbSize() {
-               $this->optionUsed( 'thumbsize' );
-
-               return $this->mThumbSize;
+       /**
+        * Parsing the page for a "preview" operation on a single section?
+        * @return bool
+        */
+       public function getIsSectionPreview() {
+               return $this->getOption( 'isSectionPreview' );
        }
 
-       public function getStubThreshold() {
-               $this->optionUsed( 'stubthreshold' );
-
-               return $this->mStubThreshold;
+       /**
+        * Parsing the page for a "preview" operation on a single section?
+        * @param bool|null $x New value (null is no change)
+        * @return bool Old value
+        */
+       public function setIsSectionPreview( $x ) {
+               return $this->setOptionLegacy( 'isSectionPreview', $x );
        }
 
-       public function getIsPreview() {
-               return $this->mIsPreview;
+       /**
+        * Parsing the printable version of the page?
+        * @return bool
+        */
+       public function getIsPrintable() {
+               return $this->getOption( 'printable' );
        }
 
-       public function getIsSectionPreview() {
-               return $this->mIsSectionPreview;
+       /**
+        * Parsing the printable version of the page?
+        * @param bool|null $x New value (null is no change)
+        * @return bool Old value
+        */
+       public function setIsPrintable( $x ) {
+               return $this->setOptionLegacy( 'printable', $x );
        }
 
-       public function getIsPrintable() {
-               $this->optionUsed( 'printable' );
-
-               return $this->mIsPrintable;
+       /**
+        * Transform wiki markup when saving the page?
+        * @return bool
+        */
+       public function getPreSaveTransform() {
+               return $this->getOption( 'preSaveTransform' );
        }
 
-       public function getUser() {
-               return $this->mUser;
+       /**
+        * Transform wiki markup when saving the page?
+        * @param bool|null $x New value (null is no change)
+        * @return bool Old value
+        */
+       public function setPreSaveTransform( $x ) {
+               return $this->setOptionLegacy( 'preSaveTransform', $x );
        }
 
-       public function getPreSaveTransform() {
-               return $this->mPreSaveTransform;
+       /**
+        * Date format index
+        * @return string
+        */
+       public function getDateFormat() {
+               return $this->getOption( 'dateformat' );
        }
 
-       public function getDateFormat() {
-               $this->optionUsed( 'dateformat' );
-               if ( !isset( $this->mDateFormat ) ) {
-                       $this->mDateFormat = $this->mUser->getDatePreference();
-               }
-               return $this->mDateFormat;
+       /**
+        * Lazy initializer for dateFormat
+        */
+       private static function initDateFormat( $popt ) {
+               return $popt->mUser->getDatePreference();
        }
 
-       public function getTimestamp() {
-               if ( !isset( $this->mTimestamp ) ) {
-                       $this->mTimestamp = wfTimestampNow();
-               }
-               return $this->mTimestamp;
+       /**
+        * Date format index
+        * @param string|null $x New value (null is no change)
+        * @return string Old value
+        */
+       public function setDateFormat( $x ) {
+               return $this->setOptionLegacy( 'dateformat', $x );
        }
 
        /**
@@ -436,8 +691,7 @@ class ParserOptions {
         * @since 1.19
         */
        public function getUserLangObj() {
-               $this->optionUsed( 'userlang' );
-               return $this->mUserLang;
+               return $this->getOption( 'userlang' );
        }
 
        /**
@@ -457,34 +711,72 @@ class ParserOptions {
        }
 
        /**
+        * Set the user language used by the parser for this page and split the parser cache.
+        * @param string|Language $x New value
+        * @return Language Old value
+        */
+       public function setUserLang( $x ) {
+               if ( is_string( $x ) ) {
+                       $x = Language::factory( $x );
+               }
+
+               return $this->setOptionLegacy( 'userlang', $x );
+       }
+
+       /**
+        * Are magic ISBN links enabled?
         * @since 1.28
         * @return bool
         */
        public function getMagicISBNLinks() {
-               return $this->mMagicISBNLinks;
+               return $this->getOption( 'magicISBNLinks' );
        }
 
        /**
+        * Are magic PMID links enabled?
         * @since 1.28
         * @return bool
         */
        public function getMagicPMIDLinks() {
-               return $this->mMagicPMIDLinks;
+               return $this->getOption( 'magicPMIDLinks' );
        }
        /**
+        * Are magic RFC links enabled?
         * @since 1.28
         * @return bool
         */
-       public function getMagicRFCLinks() {
-               return $this->mMagicRFCLinks;
+       public function getMagicRFCLinks() {
+               return $this->getOption( 'magicRFCLinks' );
+       }
+
+       /**
+        * If the wiki is configured to allow raw html ($wgRawHtml = true)
+        * is it allowed in the specific case of parsing this page.
+        *
+        * This is meant to disable unsafe parser tags in cases where
+        * a malicious user may control the input to the parser.
+        *
+        * @note This is expected to be true for normal pages even if the
+        *  wiki has $wgRawHtml disabled in general. The setting only
+        *  signifies that raw html would be unsafe in the current context
+        *  provided that raw html is allowed at all.
+        * @since 1.29
+        * @return bool
+        */
+       public function getAllowUnsafeRawHtml() {
+               return $this->getOption( 'allowUnsafeRawHtml' );
        }
 
        /**
+        * If the wiki is configured to allow raw html ($wgRawHtml = true)
+        * is it allowed in the specific case of parsing this page.
+        * @see self::getAllowUnsafeRawHtml()
         * @since 1.29
-        * @return bool
+        * @param bool|null Value to set or null to get current value
+        * @return bool Current value for allowUnsafeRawHtml
         */
-       public function getAllowUnsafeRawHtml() {
-               return $this->allowUnsafeRawHtml;
+       public function setAllowUnsafeRawHtml( $x ) {
+               return $this->setOptionLegacy( 'allowUnsafeRawHtml', $x );
        }
 
        /**
@@ -493,169 +785,97 @@ class ParserOptions {
         * @return string|bool
         */
        public function getWrapOutputClass() {
-               $this->optionUsed( 'wrapclass' );
-               return $this->wrapOutputClass;
-       }
-
-       public function setInterwikiMagic( $x ) {
-               return wfSetVar( $this->mInterwikiMagic, $x );
-       }
-
-       public function setAllowExternalImages( $x ) {
-               return wfSetVar( $this->mAllowExternalImages, $x );
-       }
-
-       public function setAllowExternalImagesFrom( $x ) {
-               return wfSetVar( $this->mAllowExternalImagesFrom, $x );
-       }
-
-       public function setEnableImageWhitelist( $x ) {
-               return wfSetVar( $this->mEnableImageWhitelist, $x );
-       }
-
-       public function setDateFormat( $x ) {
-               return wfSetVar( $this->mDateFormat, $x );
-       }
-
-       public function setEditSection( $x ) {
-               return wfSetVar( $this->mEditSection, $x );
-       }
-
-       public function setNumberHeadings( $x ) {
-               return wfSetVar( $this->mNumberHeadings, $x );
+               return $this->getOption( 'wrapclass' );
        }
 
-       public function setAllowSpecialInclusion( $x ) {
-               return wfSetVar( $this->mAllowSpecialInclusion, $x );
-       }
-
-       public function setTidy( $x ) {
-               return wfSetVar( $this->mTidy, $x );
-       }
-
-       public function setInterfaceMessage( $x ) {
-               return wfSetVar( $this->mInterfaceMessage, $x );
-       }
-
-       public function setTargetLanguage( $x ) {
-               return wfSetVar( $this->mTargetLanguage, $x, true );
-       }
-
-       public function setMaxIncludeSize( $x ) {
-               return wfSetVar( $this->mMaxIncludeSize, $x );
-       }
-
-       public function setMaxPPNodeCount( $x ) {
-               return wfSetVar( $this->mMaxPPNodeCount, $x );
-       }
-
-       public function setMaxGeneratedPPNodeCount( $x ) {
-               return wfSetVar( $this->mMaxGeneratedPPNodeCount, $x );
-       }
-
-       public function setMaxTemplateDepth( $x ) {
-               return wfSetVar( $this->mMaxTemplateDepth, $x );
-       }
-
-       /* @since 1.20 */
-       public function setExpensiveParserFunctionLimit( $x ) {
-               return wfSetVar( $this->mExpensiveParserFunctionLimit, $x );
+       /**
+        * CSS class to use to wrap output from Parser::parse()
+        * @since 1.30
+        * @param string|bool $className Set false to disable wrapping.
+        * @return string|bool Current value
+        */
+       public function setWrapOutputClass( $className ) {
+               if ( $className === true ) { // DWIM, they probably want the default class name
+                       $className = 'mw-parser-output';
+               }
+               return $this->setOption( 'wrapclass', $className );
        }
 
-       public function setRemoveComments( $x ) {
-               return wfSetVar( $this->mRemoveComments, $x );
+       /**
+        * Callback for current revision fetching; first argument to call_user_func().
+        * @since 1.24
+        * @return callable
+        */
+       public function getCurrentRevisionCallback() {
+               return $this->getOption( 'currentRevisionCallback' );
        }
 
-       /* @since 1.24 */
+       /**
+        * Callback for current revision fetching; first argument to call_user_func().
+        * @since 1.24
+        * @param callable|null $x New value (null is no change)
+        * @return callable Old value
+        */
        public function setCurrentRevisionCallback( $x ) {
-               return wfSetVar( $this->mCurrentRevisionCallback, $x );
+               return $this->setOptionLegacy( 'currentRevisionCallback', $x );
        }
 
-       /** @since 1.28 */
-       public function setSpeculativeRevIdCallback( $x ) {
-               return wfSetVar( $this->mSpeculativeRevIdCallback, $x );
+       /**
+        * Callback for template fetching; first argument to call_user_func().
+        * @return callable
+        */
+       public function getTemplateCallback() {
+               return $this->getOption( 'templateCallback' );
        }
 
+       /**
+        * Callback for template fetching; first argument to call_user_func().
+        * @param callable|null $x New value (null is no change)
+        * @return callable Old value
+        */
        public function setTemplateCallback( $x ) {
-               return wfSetVar( $this->mTemplateCallback, $x );
-       }
-
-       public function enableLimitReport( $x = true ) {
-               return wfSetVar( $this->mEnableLimitReport, $x );
-       }
-
-       public function setTimestamp( $x ) {
-               return wfSetVar( $this->mTimestamp, $x );
-       }
-
-       public function setCleanSignatures( $x ) {
-               return wfSetVar( $this->mCleanSignatures, $x );
-       }
-
-       public function setExternalLinkTarget( $x ) {
-               return wfSetVar( $this->mExternalLinkTarget, $x );
-       }
-
-       public function disableContentConversion( $x = true ) {
-               return wfSetVar( $this->mDisableContentConversion, $x );
-       }
-
-       public function disableTitleConversion( $x = true ) {
-               return wfSetVar( $this->mDisableTitleConversion, $x );
-       }
-
-       public function setUserLang( $x ) {
-               if ( is_string( $x ) ) {
-                       $x = Language::factory( $x );
-               }
-
-               return wfSetVar( $this->mUserLang, $x );
-       }
-
-       public function setThumbSize( $x ) {
-               return wfSetVar( $this->mThumbSize, $x );
-       }
-
-       public function setStubThreshold( $x ) {
-               return wfSetVar( $this->mStubThreshold, $x );
-       }
-
-       public function setPreSaveTransform( $x ) {
-               return wfSetVar( $this->mPreSaveTransform, $x );
+               return $this->setOptionLegacy( 'templateCallback', $x );
        }
 
-       public function setIsPreview( $x ) {
-               return wfSetVar( $this->mIsPreview, $x );
+       /**
+        * Callback to generate a guess for {{REVISIONID}}
+        * @since 1.28
+        * @return callable|null
+        */
+       public function getSpeculativeRevIdCallback() {
+               return $this->getOption( 'speculativeRevIdCallback' );
        }
 
-       public function setIsSectionPreview( $x ) {
-               return wfSetVar( $this->mIsSectionPreview, $x );
+       /**
+        * Callback to generate a guess for {{REVISIONID}}
+        * @since 1.28
+        * @param callable|null $x New value (null is no change)
+        * @return callable|null Old value
+        */
+       public function setSpeculativeRevIdCallback( $x ) {
+               return $this->setOptionLegacy( 'speculativeRevIdCallback', $x );
        }
 
-       public function setIsPrintable( $x ) {
-               return wfSetVar( $this->mIsPrintable, $x );
-       }
+       /**@}*/
 
        /**
-        * @param bool|null Value to set or null to get current value
-        * @return bool Current value for allowUnsafeRawHtml
-        * @since 1.29
+        * Timestamp used for {{CURRENTDAY}} etc.
+        * @return string
         */
-       public function setAllowUnsafeRawHtml( $x ) {
-               return wfSetVar( $this->allowUnsafeRawHtml, $x );
+       public function getTimestamp() {
+               if ( !isset( $this->mTimestamp ) ) {
+                       $this->mTimestamp = wfTimestampNow();
+               }
+               return $this->mTimestamp;
        }
 
        /**
-        * CSS class to use to wrap output from Parser::parse()
-        * @since 1.30
-        * @param string|bool $className Set false to disable wrapping.
-        * @return string|bool Current value
+        * Timestamp used for {{CURRENTDAY}} etc.
+        * @param string|null $x New value (null is no change)
+        * @return string Old value
         */
-       public function setWrapOutputClass( $className ) {
-               if ( $className === true ) { // DWIM, they probably want the default class name
-                       $className = 'mw-parser-output';
-               }
-               return wfSetVar( $this->wrapOutputClass, $className );
+       public function setTimestamp( $x ) {
+               return wfSetVar( $this->mTimestamp, $x );
        }
 
        /**
@@ -684,14 +904,27 @@ class ParserOptions {
 
        /**
         * Extra key that should be present in the parser cache key.
+        * @warning Consider registering your additional options with the
+        *  ParserOptionsRegister hook instead of using this method.
         * @param string $key
         */
        public function addExtraKey( $key ) {
                $this->mExtraKey .= '!' . $key;
        }
 
+       /**
+        * Current user
+        * @return User
+        */
+       public function getUser() {
+               return $this->mUser;
+       }
+
        /**
         * Constructor
+        * @warning For interaction with the parser cache, use
+        *  WikiPage::makeParserOptions(), ContentHandler::makeParserOptions(), or
+        *  ParserOptions::newCanonical() instead.
         * @param User $user
         * @param Language $lang
         */
@@ -716,6 +949,9 @@ class ParserOptions {
 
        /**
         * Get a ParserOptions object for an anonymous user
+        * @warning For interaction with the parser cache, use
+        *  WikiPage::makeParserOptions(), ContentHandler::makeParserOptions(), or
+        *  ParserOptions::newCanonical() instead.
         * @since 1.27
         * @return ParserOptions
         */
@@ -728,6 +964,9 @@ class ParserOptions {
         * Get a ParserOptions object from a given user.
         * Language will be taken from $wgLang.
         *
+        * @warning For interaction with the parser cache, use
+        *  WikiPage::makeParserOptions(), ContentHandler::makeParserOptions(), or
+        *  ParserOptions::newCanonical() instead.
         * @param User $user
         * @return ParserOptions
         */
@@ -738,6 +977,9 @@ class ParserOptions {
        /**
         * Get a ParserOptions object from a given user and language
         *
+        * @warning For interaction with the parser cache, use
+        *  WikiPage::makeParserOptions(), ContentHandler::makeParserOptions(), or
+        *  ParserOptions::newCanonical() instead.
         * @param User $user
         * @param Language $lang
         * @return ParserOptions
@@ -749,6 +991,9 @@ class ParserOptions {
        /**
         * Get a ParserOptions object from a IContextSource object
         *
+        * @warning For interaction with the parser cache, use
+        *  WikiPage::makeParserOptions(), ContentHandler::makeParserOptions(), or
+        *  ParserOptions::newCanonical() instead.
         * @param IContextSource $context
         * @return ParserOptions
         */
@@ -757,44 +1002,130 @@ class ParserOptions {
        }
 
        /**
-        * Get user options
+        * Creates a "canonical" ParserOptions object
         *
-        * @param User $user
-        * @param Language $lang
+        * For historical reasons, certain options have default values that are
+        * different from the canonical values used for caching.
+        *
+        * @since 1.30
+        * @param User|null $user
+        * @param Language|StubObject|null $lang
+        * @return ParserOptions
         */
-       private function initialiseFromUser( $user, $lang ) {
+       public static function newCanonical( User $user = null, $lang = null ) {
+               $ret = new ParserOptions( $user, $lang );
+               foreach ( self::getCanonicalOverrides() as $k => $v ) {
+                       $ret->setOption( $k, $v );
+               }
+               return $ret;
+       }
+
+       /**
+        * Get default option values
+        * @warning If you change the default for an existing option (unless it's
+        *  being overridden by self::getCanonicalOverrides()), all existing parser
+        *  cache entries will be invalid. To avoid bugs, you'll need to handle
+        *  that somehow (e.g. with the RejectParserCacheValue hook) because
+        *  MediaWiki won't do it for you.
+        * @return array
+        */
+       private static function getDefaults() {
                global $wgInterwikiMagic, $wgAllowExternalImages,
                        $wgAllowExternalImagesFrom, $wgEnableImageWhitelist, $wgAllowSpecialInclusion,
                        $wgMaxArticleSize, $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth,
                        $wgCleanSignatures, $wgExternalLinkTarget, $wgExpensiveParserFunctionLimit,
                        $wgMaxGeneratedPPNodeCount, $wgDisableLangConversion, $wgDisableTitleConversion,
-                       $wgEnableMagicLinks;
-
-               // *UPDATE* ParserOptions::matches() if any of this changes as needed
-               $this->mInterwikiMagic = $wgInterwikiMagic;
-               $this->mAllowExternalImages = $wgAllowExternalImages;
-               $this->mAllowExternalImagesFrom = $wgAllowExternalImagesFrom;
-               $this->mEnableImageWhitelist = $wgEnableImageWhitelist;
-               $this->mAllowSpecialInclusion = $wgAllowSpecialInclusion;
-               $this->mMaxIncludeSize = $wgMaxArticleSize * 1024;
-               $this->mMaxPPNodeCount = $wgMaxPPNodeCount;
-               $this->mMaxGeneratedPPNodeCount = $wgMaxGeneratedPPNodeCount;
-               $this->mMaxPPExpandDepth = $wgMaxPPExpandDepth;
-               $this->mMaxTemplateDepth = $wgMaxTemplateDepth;
-               $this->mExpensiveParserFunctionLimit = $wgExpensiveParserFunctionLimit;
-               $this->mCleanSignatures = $wgCleanSignatures;
-               $this->mExternalLinkTarget = $wgExternalLinkTarget;
-               $this->mDisableContentConversion = $wgDisableLangConversion;
-               $this->mDisableTitleConversion = $wgDisableLangConversion || $wgDisableTitleConversion;
-               $this->mMagicISBNLinks = $wgEnableMagicLinks['ISBN'];
-               $this->mMagicPMIDLinks = $wgEnableMagicLinks['PMID'];
-               $this->mMagicRFCLinks = $wgEnableMagicLinks['RFC'];
+                       $wgEnableMagicLinks, $wgContLang;
+
+               if ( self::$defaults === null ) {
+                       // *UPDATE* ParserOptions::matches() if any of this changes as needed
+                       self::$defaults = [
+                               'dateformat' => null,
+                               'editsection' => true,
+                               'tidy' => false,
+                               'interfaceMessage' => false,
+                               'targetLanguage' => null,
+                               'removeComments' => true,
+                               'enableLimitReport' => false,
+                               'preSaveTransform' => true,
+                               'isPreview' => false,
+                               'isSectionPreview' => false,
+                               'printable' => false,
+                               'allowUnsafeRawHtml' => true,
+                               'wrapclass' => 'mw-parser-output',
+                               'currentRevisionCallback' => [ 'Parser', 'statelessFetchRevision' ],
+                               'templateCallback' => [ 'Parser', 'statelessFetchTemplate' ],
+                               'speculativeRevIdCallback' => null,
+                       ];
+
+                       Hooks::run( 'ParserOptionsRegister', [
+                               &self::$defaults,
+                               &self::$inCacheKey,
+                               &self::$lazyOptions,
+                       ] );
+
+                       ksort( self::$inCacheKey );
+               }
+
+               // Unit tests depend on being able to modify the globals at will
+               return self::$defaults + [
+                       'interwikiMagic' => $wgInterwikiMagic,
+                       'allowExternalImages' => $wgAllowExternalImages,
+                       'allowExternalImagesFrom' => $wgAllowExternalImagesFrom,
+                       'enableImageWhitelist' => $wgEnableImageWhitelist,
+                       'allowSpecialInclusion' => $wgAllowSpecialInclusion,
+                       'maxIncludeSize' => $wgMaxArticleSize * 1024,
+                       'maxPPNodeCount' => $wgMaxPPNodeCount,
+                       'maxGeneratedPPNodeCount' => $wgMaxGeneratedPPNodeCount,
+                       'maxPPExpandDepth' => $wgMaxPPExpandDepth,
+                       'maxTemplateDepth' => $wgMaxTemplateDepth,
+                       'expensiveParserFunctionLimit' => $wgExpensiveParserFunctionLimit,
+                       'externalLinkTarget' => $wgExternalLinkTarget,
+                       'cleanSignatures' => $wgCleanSignatures,
+                       'disableContentConversion' => $wgDisableLangConversion,
+                       'disableTitleConversion' => $wgDisableLangConversion || $wgDisableTitleConversion,
+                       'magicISBNLinks' => $wgEnableMagicLinks['ISBN'],
+                       'magicPMIDLinks' => $wgEnableMagicLinks['PMID'],
+                       'magicRFCLinks' => $wgEnableMagicLinks['RFC'],
+                       'numberheadings' => User::getDefaultOption( 'numberheadings' ),
+                       'thumbsize' => User::getDefaultOption( 'thumbsize' ),
+                       'stubthreshold' => 0,
+                       'userlang' => $wgContLang,
+               ];
+       }
+
+       /**
+        * Get "canonical" non-default option values
+        * @see self::newCanonical
+        * @warning If you change the override for an existing option, all existing
+        *  parser cache entries will be invalid. To avoid bugs, you'll need to
+        *  handle that somehow (e.g. with the RejectParserCacheValue hook) because
+        *  MediaWiki won't do it for you.
+        * @return array
+        */
+       private static function getCanonicalOverrides() {
+               global $wgEnableParserLimitReporting;
+
+               return [
+                       'tidy' => true,
+                       'enableLimitReport' => $wgEnableParserLimitReporting,
+               ];
+       }
+
+       /**
+        * Get user options
+        *
+        * @param User $user
+        * @param Language $lang
+        */
+       private function initialiseFromUser( $user, $lang ) {
+               $this->options = self::getDefaults();
 
                $this->mUser = $user;
-               $this->mNumberHeadings = $user->getOption( 'numberheadings' );
-               $this->mThumbSize = $user->getOption( 'thumbsize' );
-               $this->mStubThreshold = $user->getStubThreshold();
-               $this->mUserLang = $lang;
+               $this->options['numberheadings'] = $user->getOption( 'numberheadings' );
+               $this->options['thumbsize'] = $user->getOption( 'thumbsize' );
+               $this->options['stubthreshold'] = $user->getStubThreshold();
+               $this->options['userlang'] = $lang;
        }
 
        /**
@@ -807,9 +1138,36 @@ class ParserOptions {
         * @since 1.25
         */
        public function matches( ParserOptions $other ) {
+               // Populate lazy options
+               foreach ( self::$lazyOptions as $name => $callback ) {
+                       if ( $this->options[$name] === null ) {
+                               $this->options[$name] = call_user_func( $callback, $this, $name );
+                       }
+                       if ( $other->options[$name] === null ) {
+                               $other->options[$name] = call_user_func( $callback, $other, $name );
+                       }
+               }
+
+               // Compare most options
+               $options = array_keys( $this->options );
+               $options = array_diff( $options, [
+                       'enableLimitReport', // only affects HTML comments
+               ] );
+               foreach ( $options as $option ) {
+                       $o1 = $this->optionToString( $this->options[$option] );
+                       $o2 = $this->optionToString( $other->options[$option] );
+                       if ( $o1 !== $o2 ) {
+                               return false;
+                       }
+               }
+
+               // Compare most other fields
                $fields = array_keys( get_class_vars( __CLASS__ ) );
                $fields = array_diff( $fields, [
-                       'mEnableLimitReport', // only effects HTML comments
+                       'defaults', // static
+                       'lazyOptions', // static
+                       'inCacheKey', // static
+                       'options', // Already checked above
                        'onAccessCallback', // only used for ParserOutput option tracking
                ] );
                foreach ( $fields as $field ) {
@@ -817,11 +1175,8 @@ class ParserOptions {
                                return false;
                        }
                }
-               // Check the object and lazy-loaded options
-               return (
-                       $this->mUserLang->equals( $other->mUserLang ) &&
-                       $this->getDateFormat() === $other->getDateFormat()
-               );
+
+               return true;
        }
 
        /**
@@ -851,6 +1206,7 @@ class ParserOptions {
         * Returns the full array of options that would have been used by
         * in 1.16.
         * Used to get the old parser cache entries when available.
+        * @todo 1.16 was years ago, can we remove this?
         * @return array
         */
        public static function legacyOptions() {
@@ -864,6 +1220,27 @@ class ParserOptions {
                ];
        }
 
+       /**
+        * Convert an option to a string value
+        * @param mixed $value
+        * @return string
+        */
+       private function optionToString( $value ) {
+               if ( $value === true ) {
+                       return '1';
+               } elseif ( $value === false ) {
+                       return '0';
+               } elseif ( $value === null ) {
+                       return '';
+               } elseif ( $value instanceof Language ) {
+                       return $value->getCode();
+               } elseif ( is_array( $value ) ) {
+                       return '[' . join( ',', array_map( [ $this, 'optionToString' ], $value ) ) . ']';
+               } else {
+                       return (string)$value;
+               }
+       }
+
        /**
         * Generate a hash string with the values set on these ParserOptions
         * for the keys given in the array.
@@ -871,10 +1248,6 @@ class ParserOptions {
         * so users sharing the options with vary for the same page share
         * the same cached data safely.
         *
-        * Extensions which require it should install 'PageRenderingHash' hook,
-        * which will give them a chance to modify this key based on their own
-        * settings.
-        *
         * @since 1.17
         * @param array $forOptions
         * @param Title $title Used to get the content language of the page (since r97636)
@@ -883,6 +1256,61 @@ class ParserOptions {
        public function optionsHash( $forOptions, $title = null ) {
                global $wgRenderHashAppend;
 
+               // We only include used options with non-canonical values in the key
+               // so adding a new option doesn't invalidate the entire parser cache.
+               // The drawback to this is that changing the default value of an option
+               // requires manual invalidation of existing cache entries, as mentioned
+               // in the docs on the relevant methods and hooks.
+               $defaults = self::getCanonicalOverrides() + self::getDefaults();
+               $values = [];
+               foreach ( self::$inCacheKey as $option => $include ) {
+                       if ( $include && in_array( $option, $forOptions, true ) ) {
+                               $v = $this->optionToString( $this->options[$option] );
+                               $d = $this->optionToString( $defaults[$option] );
+                               if ( $v !== $d ) {
+                                       $values[] = "$option=$v";
+                               }
+                       }
+               }
+
+               $confstr = $values ? join( '!', $values ) : 'canonical';
+
+               // add in language specific options, if any
+               // @todo FIXME: This is just a way of retrieving the url/user preferred variant
+               if ( !is_null( $title ) ) {
+                       $confstr .= $title->getPageLanguage()->getExtraHashOptions();
+               } else {
+                       global $wgContLang;
+                       $confstr .= $wgContLang->getExtraHashOptions();
+               }
+
+               $confstr .= $wgRenderHashAppend;
+
+               if ( $this->mExtraKey != '' ) {
+                       $confstr .= $this->mExtraKey;
+               }
+
+               // Give a chance for extensions to modify the hash, if they have
+               // extra options or other effects on the parser cache.
+               Hooks::run( 'PageRenderingHash', [ &$confstr, $this->getUser(), &$forOptions ] );
+
+               // Make it a valid memcached key fragment
+               $confstr = str_replace( ' ', '_', $confstr );
+
+               return $confstr;
+       }
+
+       /**
+        * Generate the hash used before MediaWiki 1.30
+        * @since 1.30
+        * @deprecated since 1.30. Do not use this unless you're ParserCache.
+        * @param array $forOptions
+        * @param Title $title Used to get the content language of the page (since r97636)
+        * @return string Page rendering hash
+        */
+       public function optionsHashPre30( $forOptions, $title = null ) {
+               global $wgRenderHashAppend;
+
                // FIXME: Once the cache key is reorganized this argument
                // can be dropped. It was used when the math extension was
                // part of core.
@@ -892,7 +1320,7 @@ class ParserOptions {
                // since it disables the parser cache, its value will always
                // be 0 when this function is called by parsercache.
                if ( in_array( 'stubthreshold', $forOptions ) ) {
-                       $confstr .= '!' . $this->mStubThreshold;
+                       $confstr .= '!' . $this->options['stubthreshold'];
                } else {
                        $confstr .= '!*';
                }
@@ -902,19 +1330,19 @@ class ParserOptions {
                }
 
                if ( in_array( 'numberheadings', $forOptions ) ) {
-                       $confstr .= '!' . ( $this->mNumberHeadings ? '1' : '' );
+                       $confstr .= '!' . ( $this->options['numberheadings'] ? '1' : '' );
                } else {
                        $confstr .= '!*';
                }
 
                if ( in_array( 'userlang', $forOptions ) ) {
-                       $confstr .= '!' . $this->mUserLang->getCode();
+                       $confstr .= '!' . $this->options['userlang']->getCode();
                } else {
                        $confstr .= '!*';
                }
 
                if ( in_array( 'thumbsize', $forOptions ) ) {
-                       $confstr .= '!' . $this->mThumbSize;
+                       $confstr .= '!' . $this->options['thumbsize'];
                } else {
                        $confstr .= '!*';
                }
@@ -936,16 +1364,18 @@ class ParserOptions {
                // directly. At least Wikibase does at this point in time.
                if ( !in_array( 'editsection', $forOptions ) ) {
                        $confstr .= '!*';
-               } elseif ( !$this->mEditSection ) {
+               } elseif ( !$this->options['editsection'] ) {
                        $confstr .= '!edit=0';
                }
 
-               if ( $this->mIsPrintable && in_array( 'printable', $forOptions ) ) {
+               if ( $this->options['printable'] && in_array( 'printable', $forOptions ) ) {
                        $confstr .= '!printable=1';
                }
 
-               if ( $this->wrapOutputClass !== 'mw-parser-output' && in_array( 'wrapclass', $forOptions ) ) {
-                       $confstr .= '!wrapclass=' . $this->wrapOutputClass;
+               if ( $this->options['wrapclass'] !== 'mw-parser-output' &&
+                       in_array( 'wrapclass', $forOptions )
+               ) {
+                       $confstr .= '!wrapclass=' . $this->options['wrapclass'];
                }
 
                if ( $this->mExtraKey != '' ) {
@@ -962,6 +1392,25 @@ class ParserOptions {
                return $confstr;
        }
 
+       /**
+        * Test whether these options are safe to cache
+        * @since 1.30
+        * @return bool
+        */
+       public function isSafeToCache() {
+               $defaults = self::getCanonicalOverrides() + self::getDefaults();
+               foreach ( $this->options as $option => $value ) {
+                       if ( empty( self::$inCacheKey[$option] ) ) {
+                               $v = $this->optionToString( $value );
+                               $d = $this->optionToString( $defaults[$option] );
+                               if ( $v !== $d ) {
+                                       return false;
+                               }
+                       }
+               }
+               return true;
+       }
+
        /**
         * Sets a hook to force that a page exists, and sets a current revision callback to return
         * a revision with custom content when the current revision of the page is requested.
@@ -1009,3 +1458,8 @@ class ParserOptions {
                } );
        }
 }
+
+/**
+ * For really cool vim folding this needs to be at the end:
+ * vim: foldmarker=@{,@} foldmethod=marker
+ */
index d144987..767046b 100644 (file)
@@ -573,7 +573,12 @@ class ResourceLoader implements LoggerAwareInterface {
                        return false;
                }
                $info = $this->moduleInfos[$name];
-               if ( isset( $info['object'] ) || isset( $info['class'] ) ) {
+               if (
+                       isset( $info['object'] ) ||
+                       // This special case is dumb, but we need $wgResourceModuleSkinStyles
+                       // to work for 'oojs-ui-core.styles'. See T167042.
+                       ( isset( $info['class'] ) && $info['class'] !== 'ResourceLoaderOOUIFileModule' )
+               ) {
                        return false;
                }
                return true;
index 135efa7..e97e074 100644 (file)
@@ -29,10 +29,18 @@ class ResourceLoaderOOUIFileModule extends ResourceLoaderFileModule {
 
        public function __construct( $options = [] ) {
                if ( isset( $options[ 'themeScripts' ] ) ) {
-                       $options['skinScripts'] = $this->getSkinSpecific( $options[ 'themeScripts' ], 'scripts' );
+                       $skinScripts = $this->getSkinSpecific( $options[ 'themeScripts' ], 'scripts' );
+                       if ( !isset( $options['skinScripts'] ) ) {
+                               $options['skinScripts'] = [];
+                       }
+                       $this->extendSkinSpecific( $options['skinScripts'], $skinScripts );
                }
                if ( isset( $options[ 'themeStyles' ] ) ) {
-                       $options['skinStyles'] = $this->getSkinSpecific( $options[ 'themeStyles' ], 'styles' );
+                       $skinStyles = $this->getSkinSpecific( $options[ 'themeStyles' ], 'styles' );
+                       if ( !isset( $options['skinStyles'] ) ) {
+                               $options['skinStyles'] = [];
+                       }
+                       $this->extendSkinSpecific( $options['skinStyles'], $skinStyles );
                }
 
                parent::__construct( $options );
@@ -60,4 +68,31 @@ class ResourceLoaderOOUIFileModule extends ResourceLoaderFileModule {
                        }, array_values( $themes ) )
                );
        }
+
+       /**
+        * Prepend the $extraSkinSpecific assoc. array to the $skinSpecific assoc. array.
+        * Both of them represent a 'skinScripts' or 'skinStyles' definition.
+        *
+        * @param array &$skinSpecific
+        * @param array $extraSkinSpecific
+        */
+       private function extendSkinSpecific( &$skinSpecific, $extraSkinSpecific ) {
+               // For each skin where skinStyles/skinScripts are defined, add our ones at the beginning
+               foreach ( $skinSpecific as $skin => $files ) {
+                       if ( !is_array( $files ) ) {
+                               $files = [ $files ];
+                       }
+                       if ( isset( $extraSkinSpecific[$skin] ) ) {
+                               $skinSpecific[$skin] = array_merge( [ $extraSkinSpecific[$skin] ], $files );
+                       } elseif ( isset( $extraSkinSpecific['default'] ) ) {
+                               $skinSpecific[$skin] = array_merge( [ $extraSkinSpecific['default'] ], $files );
+                       }
+               }
+               // Add our remaining skinStyles/skinScripts for skins that did not have them defined
+               foreach ( $extraSkinSpecific as $skin => $file ) {
+                       if ( !isset( $skinSpecific[$skin] ) ) {
+                               $skinSpecific[$skin] = $file;
+                       }
+               }
+       }
 }
index 0b20213..21a1fb5 100644 (file)
@@ -94,6 +94,7 @@
        "about": "Taci we otciparik",
        "newwindow": "(cepita kotak ocki osapwakan)",
        "cancel": "Ponipata",
+       "moredotdotdot": "Erikam...",
        "mypage": "Masinhikan",
        "mytalk": "Ka ici arimowaniwok",
        "anontalk": "Ka ici arimowaniok",
        "create": "Ocita",
        "create-local": "Arimota ke acotcictek",
        "editthispage": "Mecikotona owe",
+       "create-this-page": "Wita ohwe ka masinatek",
        "delete": "Wepina",
+       "protect": "Tacikatek",
        "newpage": "Ocki matcecikinakanik",
        "talkpagelinktext": "ka ici arimowaniwok",
+       "specialpage": "Ka ici wectakaniwok",
        "personaltools": "Kit irapatcitcikan",
        "talk": "Ka ici arimowaniwok",
        "views": "Ke icinakok",
        "toolbox": "Irapitcitcikan",
+       "userpage": "Kitci wapataman nihe masinahikan ka apatak",
        "projectpage": "Kitci wapataman nehe masinihikan ocki otamirowinik otci",
+       "imagepage": "Kitci wapataman nihe masinahikan",
        "otherlanguages": "Kotakahi aiarimowewina",
        "redirectedfrom": "(Taci e kiweckwemakak $1)",
+       "redirectpagesub": "Masinhikan ke kweskiticohemikok",
        "redirectto": "Nte ica:",
        "lastmodifiedat": "Pamitcitc ka meckotcitakiniwok ni apitc $1, ka tato tipahikaneak $2.",
        "jumpto": "Ica:",
        "toc": "Tekaci e icinakok",
        "showtoc": "Wapata",
        "hidetoc": "Kata",
+       "collapsible-expand": "Otamirota",
        "confirmable-yes": "Ehe",
        "confirmable-no": "Nama",
        "site-atom-feed": "Flux Atom $1",
        "page-atom-feed": "\"$1\" Atom feed",
        "red-link-title": "$1 (nama takon kekwcic)",
        "nstab-main": "Masinahikan",
-       "nstab-user": "{{GENDER:{{ROOTPAGENAME}}|Ka masinahiketc|Ka masinahiketc}}",
+       "nstab-user": "Ka masinahiketc",
        "nstab-special": "Ka ici wectakaniwok",
        "nstab-project": "Nohwe ma",
        "nstab-image": "Masinahikan",
        "userlogin-yourpassword": "Pitakesinahotiso",
        "userlogin-yourpassword-ph": "Pitakesinihikan",
        "createacct-yourpassword-ph": "Acta pitakesinihikan",
+       "yourpasswordagain": "Minawatc acta pitakesinihikan:",
        "createacct-yourpasswordagain": "Naskamowicta pitakesinihikan",
        "createacct-yourpasswordagain-ph": "Minawatc acta pitakesinihikan",
        "userlogin-remembermypassword": "Kitci cetik mekwact ka ici otamirohian",
        "login": "Posi",
+       "nav-login-createaccount": "Posi / masinahotiso",
        "logout": "Piskeapikenakan",
        "userlogout": "Piskeapikenakan",
        "userlogin-noaccount": " Nama takon ki mockinesinihikan?",
        "createacct-emailoptional": "Pamikicikwepitcikan matcetcicihikan (kir kotc)",
        "createacct-email-ph": "Pitakesinaha ki pamikicikwepitcikan matcetcicihikan",
        "createacct-submit": "Masinahotiso",
+       "createacct-another-submit": "Masinahotiso",
        "createacct-benefit-heading": "{{SITENAME}} iskwewok, iriniwok ka orisinihiketcik mitowi kir.",
        "createacct-benefit-body1": "{{PLURAL:$1|ki meckotcitakiniwok|ki meckotcitakiniwoki}}",
        "createacct-benefit-body2": "{{PLURAL:$1|masinhikan|masinahikana}}",
        "moveddeleted-notice": "Paskickwemakan ka ki wepinikatek.\nOhwe wapatcikan nitc ici nokon paskickwemakanik ka ki wepinikateki acit ka ki atcipitcikateki.",
        "content-model-javascript": "JavaScript",
        "viewpagelogs": "Kinawapta kekwan kaki isparik ota masinhikanik",
+       "currentrev": "Mekwatc ka otamirowitcikatek",
        "currentrev-asof": "Owe mekwatc ka icinakok ni apitc ka ocitakiniwokipan $1",
        "revisionasof": "Kiwe kanawapata $1",
        "revision-info": "E tato konekisitc ka koski kanawapatcikatek $1 nohwe {{GENDER:$6|$2}}$7",
        "cur": "e otapekitikw",
        "next": "minawa",
        "last": "pitoc",
+       "historysize": "{{PLURAL:$1|1 irik|$1 irik}}",
        "history-feed-title": "Kotakihi e itatcitcikatekai",
        "rev-delundel": "Nokota/katcicta",
        "rev-showdeleted": "wapata",
        "search-result-size": "$1 ({{PLURAL:$2|1 itewin e masinatek|$2 itewina e masinateki}})",
        "search-redirect": "(taci e kiweckwemakak $1)",
        "search-section": "(ke arimotcikatek $1)",
+       "search-category": "(ka ici arimotcikatek $1)",
        "search-suggest": "Ohwe kotcita e itasinatek: $1",
+       "search-interwiki-more": "(erikam)",
        "searchall": "kaskina",
        "search-showingresults": "{{PLURAL:$4|E ici miskatek <strong>$1</strong> nta neki<strong>$3</strong>|E ici miskatek <strong>$1 à $2</strong>nta neki<strong>$3</strong>}}",
        "search-nonefound": "Nama miskwapahikatew ka nantowapahikatek.",
        "powersearch-toggleall": "Kaskina",
        "preferences": "Kirowe",
        "mypreferences": "Mocak ka kinawapataman",
+       "prefs-rc": "Ka ki meckotcitakaniwoki",
+       "prefs-watchlist": "Ka masinateki",
        "saveprefs": "Kinokepitcikanik",
        "searchresultshead": "Nantokaskeritcikatek",
        "stub-threshold-disabled": "Manisinaha",
        "prefs-searchoptions": "Nantokaskeritcikatek",
+       "prefs-namespaces": "Ka ici masinasotcik",
        "prefs-files": "Masinahikan",
        "youremail": "Matcetcicihikan:",
        "email": "Matcetcicihikan",
        "group-user": "Ka mitatc",
        "group-bot": "Meckotciparin",
+       "group-all": "(kaskina)",
        "grouppage-bot": "{{ns:project}}:Meckotciparin",
+       "right-upload": "Natcipata masinahikan",
        "right-writeapi": "Ohwe apitcita A.P.I meckotci aitotaman wikik",
        "grant-createaccount": "Masinahotiso",
        "newuserlogpage": "E ici masinasotcik ka pitakesinahotisotcik",
        "action-edit": "mecikotona owe",
+       "action-move": "orinkata owe masinhikan",
        "enhancedrc-history": "isparik",
        "recentchanges": "Ka ki meckotcitakaniwoki",
        "recentchanges-legend": " Ka meckotcitain matcenikana",
        "boteditletter": "p",
        "rc-change-size-new": "$1 {{PLURAL:$1|irik|irikw}} ke askowak",
        "recentchangeslinked": "Nosineta masinahikana e mamowapiketik",
+       "recentchangeslinked-feed": "Nosineta masinahikana e mamowapiketik",
        "recentchangeslinked-toolbox": "Nosineta masinahikana e mamowapiketik",
        "recentchangeslinked-title": "E nosinehikatek paskickwemikana ka acotcictek\"$1\"",
        "recentchangeslinked-summary": " Enkon ohwe ka ki meckotcisinihikateki paskickwemikana  e ici natcipitcikatek nta paskickemakanik kekwan ka arimotcikatek mia kekotc ma neki ka mamowisinasotcik taci ka ki ici aritisotcik mia.\nPaskickwemikina [[Special:Watchlist|masinihikan ka nakatcitain]] nehi<strong>makatewasinikan</strong>",
        "recentchangeslinked-page": "Icinikatamowin Ickwemakinikan:",
        "recentchangeslinked-to": "Kata nokok kaki kweskisinihikateki paskickwemikina ka acotcisinihikateki taci e ici ntowapekihikatek nohwe paskickwemakan patoc kweski e icinakok.",
        "upload": "Natcipata masinahikan",
+       "uploadbtn": "Natcipata masinahikan",
        "filedesc": "Nosem",
        "fileuploadsummary": "Nosem:",
        "filesource": "Ite wetciparik:",
+       "upload-dialog-title": "Natcipata masinahikan",
        "upload-dialog-button-cancel": "Ponipita",
        "upload-dialog-button-save": "Kinokepitcikanik",
        "upload-form-label-infoform-description": "E witcikemakak",
        "upload-form-label-infoform-categories": "Nakwe tipanictasinihikan",
        "upload-form-label-infoform-date": "Tatokonakisitc",
-       "license-header": "orocowatcikan",
+       "license": "Orocowatcikan:",
+       "license-header": "Orocowatcikan",
        "listfiles-delete": "wepina",
        "imgfile": "masinhikan",
        "listfiles": "Ka ici tapitik onimiskimasinhikan",
        "newpages": "Ocki matcecikinakanik",
        "newpages-submit": "Wapata",
        "newpages-username": "Icinikasowin:",
+       "movethispage": "Orinkata owe masinhikan",
        "pager-older-n": "{{PLURAL:$1|1 mawtci weckat|$1 mawtci weckat}}",
        "booksources": "E otciparik",
        "booksources-search-legend": "Nantowapata nta kotakahi wapatcikana",
        "watchlist": "Ka masinateki",
        "mywatchlist": "Ka masinateki",
        "watch": "Nanakatcita",
+       "watchthispage": "Wi nosinetaine ohwe masinahikan",
        "watchlist-hide": "Kata",
        "watchlist-submit": "Wapata",
        "wlshowhidebots": "meckotciparin",
        "delete-legend": "Wepina",
        "historyaction-submit": "Wapata",
        "dellogpage": " Nesitc ka wepinikatek kanaweritcikan",
+       "deletionlog": "nesitc ka wepinikatek kanaweritcikan",
        "rollbacklink": "e maninakatek",
        "rollbacklinkcount": " nesitc wepina $1 {{PLURAL:$1|kweskisinikan|kweskisinihikana}}",
        "protectlogpage": "Nanakatisiwina wapatcikan",
+       "restriction-type": "Niheritam:",
+       "pagesize": "(irik)",
        "restriction-edit": "Meckotcita",
+       "restriction-move": "Erikam",
        "restriction-create": "Ocita",
        "undeleteviewlink": "tapwatcike",
        "undelete-search-submit": "Nantokaskeritcikatek",
        "uctop": "(mekwatc)",
        "month": "Anotc pisimw ka akotcinitc (nac nte nictam):",
        "year": "Taci e ici matce tato piponikak(acit nictam):",
+       "sp-contributions-blocklog": "wapatcikan taci e nanikactek",
+       "sp-contributions-logs": "pamikickwepitcikana masinihikana",
        "sp-contributions-talk": "ka ici arimowaniok",
        "sp-contributions-submit": "Nantokaskeritcikatek",
        "whatlinkshere": "Kaskina ickwemakina ka witci acteki",
        "whatlinkshere-hideredirs": "$1 itapahikana",
        "whatlinkshere-hidetrans": "$1 pitcititawina",
        "whatlinkshere-hidelinks": "$1 ka patiki",
+       "whatlinkshere-hideimages": "$1 ka ici tapitik onimiskimasinahikan",
        "whatlinkshere-filters": "cikopesinikan",
        "whatlinkshere-submit": "Tapowata",
+       "autoblocklist-submit": "Nantokaskeritcikatek",
        "ipblocklist-submit": "Nantokaskeritcikatek",
        "blocklink": "nokipita",
        "contribslink": "Kaki witcihehin",
+       "blocklogpage": "Wapatcikan taci e nanikactek",
+       "move-page": "Erikam $1",
        "movelogpage": "Tipatcimosanihikan ka ki meckotcicinikatcikateki",
        "movesubpagetalktext": "Neta ka arimotcikatek tipatcimosanikanik $1 {{PLURAL:$1|Nota paskickwemakan|Nota paskickwemakana}} kita masinatewa ota.",
        "export": "Matcetciciha masinahikana",
+       "export-submit": "Matcetciciha",
        "allmessages-filter-all": "Kaskina",
        "allmessages-filter-submit": "Tapowata",
        "thumbnail-more": "Micata",
        "exif-saturation-0": "Ekote mia",
        "exif-sharpness-0": "Ekote mia",
        "exif-dc-date": "Tatokonakisitc",
+       "exif-urgency-normal": "Ekote mia ($1)",
        "namespacesall": "kaskina",
        "monthsall": "kaskina",
        "confirm_purge_button": "OK",
        "table_pager_next": "Minawa masinahikan",
        "table_pager_limit_submit": "Tapowata",
        "signature": "[[{{ns:user}}:$1|$2]] ([[{{ns:user_talk}}:$1|ka ici arimowaniwok]])",
+       "version-specialpages": "Ka ici wectakaniwok",
        "version-ext-colheader-description": "E witcikemakak",
        "version-ext-colheader-credits": "Kaki masihiketc",
        "version-libraries-description": "E witcikemakak",
        "redirect-submit": "Tapowata",
        "fileduplicatesearch-submit": "Nantokaskeritcikatek",
        "specialpages": "Ka ici wectakaniwok",
+       "specialpages-group-login": "Posi / masinahotiso",
        "tag-filter": "Nihipita nehi[[Special:Tags|balises]] :",
        "tag-list-wrapper": "([[Special:Tags|{{PLURAL:$1|Kicawatcikanicic|Kicawatcikanica}}]] : $2)",
        "tags-source-header": "Ite wetciparik",
index 0185117..13d893f 100644 (file)
        "rcfilters-savedqueries-new-name-label": "নাম",
        "rcfilters-savedqueries-apply-label": "সেটিংস সংরক্ষণ",
        "rcfilters-savedqueries-cancel-label": "বাতিল",
+       "rcfilters-savedqueries-add-new-title": "বর্তমান ছাঁকনির সেটিং সংরক্ষণ করুন",
        "rcfilters-restore-default-filters": "পূর্বনির্ধারিত ছাঁকনি পুনরুদ্ধার করুন",
        "rcfilters-clear-all-filters": "সব ছাঁকনি পরিষ্কার করুন",
        "rcfilters-search-placeholder": "সাম্প্রতিক পরিবর্তনসমূহ ছাঁকুন (ব্রাউজ বা টাইপ করা শুরু করুন)",
        "autoblocklist-submit": "অনুসন্ধান",
        "autoblocklist-legend": "স্বয়ংক্রিয়বাধার তালিকা",
        "autoblocklist-localblocks": "স্থানীয় {{PLURAL:$1|স্বয়ংবাধা|স্বয়ংবাধাসমূহ}}",
+       "autoblocklist-total-autoblocks": "মোট স্বয়ংক্রিয় বাধার সংখ্যা: $1",
        "autoblocklist-empty": "স্বয়ংক্রিয়বাধার তালিকাটি খালি।",
        "autoblocklist-otherblocks": "অন্য {{PLURAL:$1|স্বয়ংবাধা|স্বয়ংবাধাসমূহ}}",
        "ipblocklist": "বাধাপ্রাপ্ত ব্যবহারকারী",
index c261b10..2f2d7fd 100644 (file)
        "recentchanges-legend-newpage": "{{int:recentchanges-label-newpage}} ([[Special:NewPages|नए पन्नों की सूची]] को भी देखें)",
        "recentchanges-submit": "दिखाएँ",
        "rcfilters-activefilters": "सक्रिय फिल्टर",
-       "rcfilters-quickfilters": "शीघ्र कड़ी",
-       "rcfilters-quickfilters-placeholder": "अपने पसंदीदा औजार की वरीयता सहेजें, ताकि बाद में फिर उपयोग कर सकें।",
+       "rcfilters-quickfilters": "सहेजा फ़िल्टर सेटिंग",
+       "rcfilters-quickfilters-placeholder-title": "कोई कड़ी अभी तक सहेजा नहीं गया",
+       "rcfilters-quickfilters-placeholder-description": "अपने फ़िल्टर सेटिंग को सहेजने और बाद में उपयोग करने के लिए नीचे दिये बूकमार्क छवि पर क्लिक करें।",
        "rcfilters-savedqueries-defaultlabel": "सहेजे फ़िल्टर",
        "rcfilters-savedqueries-rename": "नाम बदलें",
        "rcfilters-savedqueries-setdefault": "मूल के रूप में रखें",
        "rcfilters-savedqueries-unsetdefault": "मूल के रूप से हटाएँ",
        "rcfilters-savedqueries-remove": "निकालें",
        "rcfilters-savedqueries-new-name-label": "नाम",
-       "rcfilters-savedqueries-apply-label": "शà¥\80à¤\98à¥\8dर à¤\95ड़à¥\80 à¤¬à¤¨à¤¾à¤\8fà¤\81",
+       "rcfilters-savedqueries-apply-label": "सà¥\87à¤\9fिà¤\82à¤\97 à¤¸à¤\82à¤\9cà¥\8bयà¥\87à¤\82",
        "rcfilters-savedqueries-cancel-label": "रद्द करें",
-       "rcfilters-savedqueries-add-new-title": "फ़िलà¥\8dà¤\9fर à¤\95à¥\8b à¤¶à¥\80à¤\98à¥\8dर à¤\95ड़à¥\80 à¤\95à¥\87 à¤°à¥\82प à¤®à¥\87à¤\82 सहेजें",
+       "rcfilters-savedqueries-add-new-title": "वरà¥\8dतमान à¤«à¤¼à¤¿à¤²à¥\8dà¤\9fर à¤¸à¥\87à¤\9fिà¤\82à¤\97 à¤\95à¥\8b सहेजें",
        "rcfilters-restore-default-filters": "मूलभूत फिल्टर पुनर्स्थापित करे",
        "rcfilters-clear-all-filters": "सभी फिल्टर हटाएँ",
        "rcfilters-search-placeholder": "हाल में हुए बदलाव फ़िल्टर (ब्राउज़ या टाइप करना आरंभ करें)",
        "rcfilters-filter-categorization-label": "श्रेणी परिवर्तन",
        "rcfilters-filter-categorization-description": "श्रेणियों से पृष्ठों के रिकॉर्ड्स को जोड़ा या निकाला जा सकता है",
        "rcfilters-filter-logactions-label": "लॉग की गई कार्रवाई",
-       "rcfilters-filter-logactions-description": "पà¥\8dरशासनिà¤\95 कार्रवाई, खाता निर्माण, पृष्ठ विलोपन, अपलोड ....",
+       "rcfilters-filter-logactions-description": "पà¥\8dरबà¤\82धà¤\95à¥\80य कार्रवाई, खाता निर्माण, पृष्ठ विलोपन, अपलोड ....",
        "rcfilters-hideminor-conflicts-typeofchange-global": "\"लघु संपादन\" फ़िल्टर एक या एक से अधिक प्रकार के परिवर्तन फ़िल्टर के साथ संघर्ष करता है, क्योंकि कुछ प्रकार के परिवर्तन को \"लघु\" के रूप में निर्दिष्ट नहीं किया जा सकता है। परस्पर विरोधी फिल्टर ऊपर सक्रिय फिल्टर क्षेत्र में चिह्नित हैं।",
        "rcfilters-hideminor-conflicts-typeofchange": "कुछ प्रकार के परिवर्तन को \"लघु\" के रूप में निर्दिष्ट नहीं किया जा सकता है\", इसलिए यह फ़िल्टर निम्न प्रकार के परिवर्तन फिल्टर के साथ संघर्ष करता है: $1",
        "rcfilters-typeofchange-conflicts-hideminor": "इस प्रकार का परिवर्तन फ़िल्टर \"लघु संपादन\" फ़िल्टर के साथ संघर्ष करता है। कुछ प्रकार के परिवर्तन को \"लघु\" के रूप में निर्दिष्ट नहीं किया जा सकता है।",
        "autoblocklist-submit": "खोजें",
        "autoblocklist-legend": "स्वतः अवरोध सूची",
        "autoblocklist-localblocks": "स्थानीय {{PLURAL:$1|स्वतः अवरोध}}",
+       "autoblocklist-total-autoblocks": "स्वतःअवरोध की कुल संख्या: $1",
        "autoblocklist-empty": "स्वतः अवरोध सूची खाली है।",
        "autoblocklist-otherblocks": "अन्य {{PLURAL:$1|स्वतःअवरोध}}",
        "ipblocklist": "अवरोधित आईपी पते व सदस्यनाम",
index 9c91b1b..7a3cb9b 100644 (file)
        "resetpass-expired": "Istekla Vam je valjanost zaporke. Molimo Vas, potvrdite novu zaporku za prijavu.",
        "resetpass-expired-soft": "Istekla vam je valjanost zaporke i trebate ju promijeniti. Molimo odaberite novu zaporku ili pritisnite na \"{{int:authprovider-resetpass-skip-label}}\", za kasniju promjenu.",
        "resetpass-validity-soft": "Zaporka Vam ne vrijedi: $1\n\nMolimo odaberite novu zaporku ili pritisnite na \"{{int:authprovider-resetpass-skip-label}}\", za kasniju promjenu.",
-       "passwordreset": "Ponovno postavi zaporku",
+       "passwordreset": "Ponovo postavi zaporku",
        "passwordreset-text-one": "Ispunite ovaj obrazac ako želite ponovno postaviti Vašu zaporku.",
        "passwordreset-text-many": "{{PLURAL:$1|Ispunite jedno od polja da biste dobili privremenu zaporku e-poštom.}}",
        "passwordreset-disabled": "Poništavanje lozinke je onemogućeno na ovom wikiju.",
        "upload-permitted": "Dopušteni {{PLURAL:$2|tip|tipovi}} datoteka: $1.",
        "upload-preferred": "Poželjni {{PLURAL:$2|tip|tipovi}} datoteka: $1.",
        "upload-prohibited": "Zabranjeni {{PLURAL:$2|tip|tipovi}} datoteka: $1.",
-       "uploadlogpage": "Evidencija postavljanja",
+       "uploadlogpage": "Evidencija postavljanja datoteka",
        "uploadlogpagetext": "Dolje je popis nedavno postavljenih slika.",
        "filename": "Ime datoteke",
        "filedesc": "Sažetak",
        "log": "Evidencije",
        "logeventslist-submit": "Prikaži",
        "all-logs-page": "Sve javne evidencije",
-       "alllogstext": "Skupni prikaz svih dostupnih evidencija za {{SITENAME}}.\nMožete suziti prikaz odabirući tip evidencije, suradničko ime ili stranicu u upitu.",
+       "alllogstext": "Skupni prikaz svih dostupnih evidencija projekta {{SITENAME}}.\nMožete suziti prikaz odabirući tip evidencije, suradničko ime ili stranicu u upitu.",
        "logempty": "Nema pronađenih stavki.",
        "log-title-wildcard": "Traži stranice koje počinju s navedenim izrazom",
        "showhideselectedlogentries": "Otkrij/sakrij odabrane evidencije",
        "specialpages": "Posebne stranice",
        "specialpages-note-top": "Legenda",
        "specialpages-note": "* Normalne posebne stranice\n* <span class=\"mw-specialpagerestricted\">Posebne stranice s ograničenim pristupom.</span>",
-       "specialpages-group-maintenance": "Izvještaji za održavanje",
+       "specialpages-group-maintenance": "Izvješća održavanja",
        "specialpages-group-other": "Ostale posebne stranice",
        "specialpages-group-login": "Prijava/otvaranje računa",
        "specialpages-group-changes": "Nedavne promjene i evidencije",
-       "specialpages-group-media": "Izvještaji i postavljanje datoteka",
+       "specialpages-group-media": "Izvješća o višemedijskome sadržaju i postavljanju datoteka",
        "specialpages-group-users": "Suradnici i suradnička prava",
        "specialpages-group-highuse": "Najčešće korištene stranice",
        "specialpages-group-pages": "Popisi stranica",
        "revdelete-uname-unhid": "suradničko ime je otkriveno",
        "revdelete-restricted": "primijenjeno ograničenje za administratore",
        "revdelete-unrestricted": "uklonjeno ograničenje za administratore",
+       "logentry-block-block": "$1 {{GENDER:$2|blokirao|blokirala}} je {{GENDER:$4|$3}} na rok od $5 $6",
        "logentry-merge-merge": "$1 je {{GENDER:$2|spojio|spojila}} $3 s $4 (izmjene do $5)",
        "logentry-move-move": "$1 je {{GENDER:$2|premjestio|premjestila}} stranicu $3 na $4",
        "logentry-move-move-noredirect": "$1 je {{GENDER:$2|premjestio|premjestila}} stranicu $3 na $4 bez preusmjeravanja",
        "log-name-managetags": "Evidencija upravljanja oznakama",
        "log-name-tag": "Evidencija oznaka",
        "rightsnone": "(suradnik)",
+       "rightslogentry-temporary-group": "$1 (vremenito, do $2)",
        "feedback-adding": "Dodajem povratne informacije na stranicu...",
        "feedback-back": "Natrag",
        "feedback-bugcheck": "Izvrsno! Molimo provjerite da se ne radi o nekom [$1 poznatom \"bugu\"].",
        "pagelang-select-lang": "Odaberi jezik",
        "pagelang-submit": "Pošalji",
        "right-pagelang": "Promijeni jezik stranice",
+       "log-name-pagelang": "Evidencija mijenjanja jezika",
        "mediastatistics": "Statistika datoteka",
        "mediastatistics-summary": "Slijede statistike postavljenih datoteka koje pokazuju zadnju inačicu datoteke. Starije ili izbrisane inačice nisu prikazane.",
        "mediastatistics-bytespertype": "Ukupna veličina datoteka za ovaj odlomak: {{PLURAL:$1|$1 bajt|$1 bajta|$1 bajtova}} ($2; $3%).",
index 3234291..945cea3 100644 (file)
        "search-file-match": "(ファイルの内容との一致)",
        "search-suggest": "もしかして: $1",
        "search-rewritten": "$1 の結果を表示しています。これは $2 の代わりに検索したものです。",
-       "search-interwiki-caption": "姉妹プロジェクト",
+       "search-interwiki-caption": "姉妹プロジェクトの結果",
        "search-interwiki-default": "$1からの結果:",
        "search-interwiki-more": "(続き)",
        "search-interwiki-more-results": "結果をさらに取得",
        "recentchanges-legend-plusminus": "(<em>±123</em>)",
        "recentchanges-submit": "表示",
        "rcfilters-activefilters": "絞り込み",
+       "rcfilters-quickfilters": "フィルター設定を保存",
+       "rcfilters-savedqueries-defaultlabel": "フィルターを保存",
+       "rcfilters-savedqueries-setdefault": "デフォルトに設定",
        "rcfilters-savedqueries-cancel-label": "キャンセル",
        "rcfilters-restore-default-filters": "標準設定の絞り込み条件を適用",
        "rcfilters-clear-all-filters": "すべてのフィルターをクリア",
index 80c497a..3527801 100644 (file)
        "rcfilters-savedqueries-unsetdefault": "Usuń ustawienie jako domyślne",
        "rcfilters-savedqueries-remove": "Usuń",
        "rcfilters-savedqueries-new-name-label": "Nazwa",
-       "rcfilters-savedqueries-apply-label": "Utwórz szybki link",
+       "rcfilters-savedqueries-apply-label": "Zapisz ustawienia",
        "rcfilters-savedqueries-cancel-label": "Anuluj",
        "rcfilters-savedqueries-add-new-title": "Zapisz szybki link do filtrów",
        "rcfilters-restore-default-filters": "Przywróć domyślne filtry",
index 32af31e..1602827 100644 (file)
        "special-characters-group-thai": "Таай",
        "special-characters-group-lao": "Лаос",
        "special-characters-group-khmer": "Кхмер",
+       "special-characters-group-canadianaboriginal": "Канаада суруга-бичигэ",
        "special-characters-title-endash": "орто тире",
        "special-characters-title-emdash": "уһун тире",
        "special-characters-title-minus": "минус бэлиэтэ",
        "mw-widgets-titleinput-description-new-page": "сирэй суох эбит",
        "mw-widgets-titleinput-description-redirect": "манна $1 утаарыы",
        "mw-widgets-categoryselector-add-category-placeholder": "Категория эбии...",
+       "mw-widgets-usersmultiselect-placeholder": "Эбии эп...",
+       "date-range-from": "Баччаттан:",
+       "date-range-to": "Болдьоҕо:",
        "sessionmanager-tie": "Тургутуу хас да көрүҥүн биирдэ туһанар сатаммат: $1.",
        "sessionprovider-generic": "$1 сиэссийэ",
        "sessionprovider-mediawiki-session-cookiesessionprovider": "куукаҕа олоҕурбут сиэссийэ",
        "sessionprovider-nocookies": "Куука арахсыбыт буолуон сөп. оннук түгэҥҥэ холбоон баран хатылаа.",
        "randomrootpage": "Түбэһиэх төрүт сирэй.",
        "log-action-filter-block": "Хааччах көрүҥэ:",
-       "log-action-filter-contentmodel": "Contentmodel көрүҥэ:",
+       "log-action-filter-contentmodel": "Иһинээҕитин мадьыалын көрүҥэ:",
        "log-action-filter-delete": "Сотуу көрүҥэ:",
        "log-action-filter-import": "Киллэрии көрүҥэ:",
        "log-action-filter-managetags": "Салайар тиэк көрүҥэ:",
        "log-action-filter-block-reblock": "Бобууну уларытыы",
        "log-action-filter-block-unblock": "Бобууну суох гыныы",
        "log-action-filter-contentmodel-change": "Иһинээҕитин мадьыалын уларытыы",
-       "log-action-filter-contentmodel-new": "Contentmodel диэн мадьыалынан сирэйи айыы",
+       "log-action-filter-contentmodel-new": "Иһинээҕитин мадьыалынан уратытык наардыыр сирэйи айыы",
        "log-action-filter-delete-delete": "Сирэйи сотуу",
        "log-action-filter-delete-delete_redir": "Утаарыыны хат суруйуу",
        "log-action-filter-delete-restore": "Сирэйи сөргүтүү",
index 2d0646a..3d8563d 100644 (file)
        "poolcounter-usage-error": "用法錯誤:$1",
        "aboutsite": "關於 {{SITENAME}}",
        "aboutpage": "Project:關於",
-       "copyright": "除非另有註明,否則頁面內容均以 $1 條款授權",
+       "copyright": "除非另有註明,否則頁面內容均以 $1 條款授權",
        "copyrightpage": "{{ns:project}}:版權",
        "currentevents": "新聞動態",
        "currentevents-url": "Project:Current events",
index b2c8d89..440604e 100644 (file)
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <ruleset name="MediaWiki">
-       <rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
+       <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
                <!-- Disable rules added in 0.8.0 that don't pass yet -->
                <exclude name="MediaWiki.Commenting.FunctionComment.ExtraParamComment" />
                <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamComment" />
index c4baab7..46aafd5 100644 (file)
@@ -1944,6 +1944,9 @@ return [
                'styles' => 'resources/src/mediawiki.special/mediawiki.special.changeslist.css',
                'targets' => [ 'desktop', 'mobile' ],
        ],
+       'mediawiki.special.changeslist.enhanced' => [
+               'styles' => 'resources/src/mediawiki.special/mediawiki.special.changeslist.enhanced.css',
+       ],
        'mediawiki.special.changeslist.legend' => [
                'styles' => 'resources/src/mediawiki.special/mediawiki.special.changeslist.legend.css',
                'targets' => [ 'desktop', 'mobile' ],
@@ -1956,9 +1959,6 @@ return [
                ],
                'targets' => [ 'desktop', 'mobile' ],
        ],
-       'mediawiki.special.changeslist.enhanced' => [
-               'styles' => 'resources/src/mediawiki.special/mediawiki.special.changeslist.enhanced.css',
-       ],
        'mediawiki.special.changeslist.visitedstatus' => [
                'scripts' => 'resources/src/mediawiki.special/mediawiki.special.changeslist.visitedstatus.js',
        ],
@@ -2027,13 +2027,6 @@ return [
                        'mediawiki.notification.convertmessagebox',
                ],
        ],
-       'mediawiki.special.userrights' => [
-               'styles' => 'resources/src/mediawiki.special/mediawiki.special.userrights.css',
-               'scripts' => 'resources/src/mediawiki.special/mediawiki.special.userrights.js',
-               'dependencies' => [
-                       'mediawiki.notification.convertmessagebox',
-               ],
-       ],
        'mediawiki.special.preferences.styles' => [
                'styles' => 'resources/src/mediawiki.special/mediawiki.special.preferences.styles.css',
        ],
@@ -2051,15 +2044,6 @@ return [
                        'powersearch-togglenone',
                ],
        ],
-       'mediawiki.special.search.styles' => [
-               'styles' => 'resources/src/mediawiki.special/mediawiki.special.search.styles.css',
-               'targets' => [ 'desktop', 'mobile' ],
-       ],
-       'mediawiki.special.search.interwikiwidget.styles' => [
-               'styles' => 'resources/src/mediawiki.special/'
-                       . 'mediawiki.special.search.interwikiwidget.styles.less',
-               'targets' => [ 'desktop', 'mobile' ]
-       ],
        'mediawiki.special.search.commonsInterwikiWidget' => [
                'scripts' => 'resources/src/mediawiki.special/mediawiki.special.search.commonsInterwikiWidget.js',
                'dependencies' => [
@@ -2072,9 +2056,38 @@ return [
                        'searchprofile-images'
                ],
        ],
+       'mediawiki.special.search.interwikiwidget.styles' => [
+               'styles' => 'resources/src/mediawiki.special/'
+                       . 'mediawiki.special.search.interwikiwidget.styles.less',
+               'targets' => [ 'desktop', 'mobile' ]
+       ],
+       'mediawiki.special.search.styles' => [
+               'styles' => 'resources/src/mediawiki.special/mediawiki.special.search.styles.css',
+               'targets' => [ 'desktop', 'mobile' ],
+       ],
        'mediawiki.special.undelete' => [
                'scripts' => 'resources/src/mediawiki.special/mediawiki.special.undelete.js',
        ],
+       'mediawiki.special.unwatchedPages' => [
+               'scripts' => 'resources/src/mediawiki.special/mediawiki.special.unwatchedPages.js',
+               'styles' => 'resources/src/mediawiki.special/mediawiki.special.unwatchedPages.css',
+               'messages' => [
+                       'addedwatchtext-short',
+                       'removedwatchtext-short',
+                       'unwatch',
+                       'unwatching',
+                       'watch',
+                       'watcherrortext',
+                       'watching',
+               ],
+               'dependencies' => [
+                       'mediawiki.api',
+                       'mediawiki.api.watch',
+                       'mediawiki.notify',
+                       'mediawiki.Title',
+                       'mediawiki.util',
+               ],
+       ],
        'mediawiki.special.upload' => [
                'templates' => [
                        'thumbnail.html' => 'resources/src/mediawiki.special/templates/thumbnail.html',
@@ -2111,11 +2124,6 @@ return [
                        'resources/src/mediawiki.special/mediawiki.special.userlogin.common.css',
                ],
        ],
-       'mediawiki.special.userlogin.signup.styles' => [
-               'styles' => [
-                       'resources/src/mediawiki.special/mediawiki.special.userlogin.signup.css',
-               ],
-       ],
        'mediawiki.special.userlogin.login.styles' => [
                'styles' => [
                        'resources/src/mediawiki.special/mediawiki.special.userlogin.login.css',
@@ -2135,24 +2143,16 @@ return [
                        'mediawiki.htmlform.checker',
                ],
        ],
-       'mediawiki.special.unwatchedPages' => [
-               'scripts' => 'resources/src/mediawiki.special/mediawiki.special.unwatchedPages.js',
-               'styles' => 'resources/src/mediawiki.special/mediawiki.special.unwatchedPages.css',
-               'messages' => [
-                       'addedwatchtext-short',
-                       'removedwatchtext-short',
-                       'unwatch',
-                       'unwatching',
-                       'watch',
-                       'watcherrortext',
-                       'watching',
+       'mediawiki.special.userlogin.signup.styles' => [
+               'styles' => [
+                       'resources/src/mediawiki.special/mediawiki.special.userlogin.signup.css',
                ],
+       ],
+       'mediawiki.special.userrights' => [
+               'styles' => 'resources/src/mediawiki.special/mediawiki.special.userrights.css',
+               'scripts' => 'resources/src/mediawiki.special/mediawiki.special.userrights.js',
                'dependencies' => [
-                       'mediawiki.api',
-                       'mediawiki.api.watch',
-                       'mediawiki.notify',
-                       'mediawiki.Title',
-                       'mediawiki.util',
+                       'mediawiki.notification.convertmessagebox',
                ],
        ],
        'mediawiki.special.watchlist' => [
@@ -2587,6 +2587,9 @@ return [
                        'oojs-ui.styles.indicators',
                        'oojs-ui.styles.textures',
                        'mediawiki.language',
+                       'oojs-ui.styles.icons-content',
+                       'oojs-ui.styles.icons-alerts',
+                       'oojs-ui.styles.icons-interactions',
                ],
                'targets' => [ 'desktop', 'mobile' ],
        ],
@@ -2602,7 +2605,14 @@ return [
                'class' => 'ResourceLoaderOOUIFileModule',
                'scripts' => 'resources/lib/oojs-ui/oojs-ui-widgets.js',
                'themeStyles' => 'widgets',
-               'dependencies' => 'oojs-ui-core',
+               'dependencies' => [
+                       'oojs-ui-core',
+                       'oojs-ui.styles.icons-interactions',
+                       'oojs-ui.styles.icons-content',
+                       'oojs-ui.styles.icons-editing-advanced',
+                       'oojs-ui.styles.icons-movement',
+                       'oojs-ui.styles.icons-moderation',
+               ],
                'messages' => [
                        'ooui-outline-control-move-down',
                        'ooui-outline-control-move-up',
@@ -2619,7 +2629,10 @@ return [
                'class' => 'ResourceLoaderOOUIFileModule',
                'scripts' => 'resources/lib/oojs-ui/oojs-ui-toolbars.js',
                'themeStyles' => 'toolbars',
-               'dependencies' => 'oojs-ui-core',
+               'dependencies' => [
+                       'oojs-ui-core',
+                       'oojs-ui.styles.icons-movement',
+               ],
                'messages' => [
                        'ooui-toolbar-more',
                        'ooui-toolgroup-collapse',
@@ -2632,7 +2645,10 @@ return [
                'class' => 'ResourceLoaderOOUIFileModule',
                'scripts' => 'resources/lib/oojs-ui/oojs-ui-windows.js',
                'themeStyles' => 'windows',
-               'dependencies' => 'oojs-ui-core',
+               'dependencies' => [
+                       'oojs-ui-core',
+                       'oojs-ui.styles.icons-movement',
+               ],
                'messages' => [
                        'ooui-dialog-message-accept',
                        'ooui-dialog-message-reject',
index 3337a03..20a78d0 100644 (file)
 
        // Two colors
        .highlight-color-mix( c1, c2 );
-       .highlight-color-mix( c1, c3 );
+       // Overriding .highlight-color-mix( c1, c3 ); to produce
+       // a custom color rather than the computed tint
+       // see https://phabricator.wikimedia.org/T161267
+       .mw-rcfilters-highlight-color-c1.mw-rcfilters-highlight-color-c3 {
+               background-color: #ccdecc;
+       }
        .highlight-color-mix( c1, c4 );
        .highlight-color-mix( c1, c5 );
        .highlight-color-mix( c2, c3 );
index 88f1195..4a7c3f8 100644 (file)
@@ -9,12 +9,24 @@
 
        &-buttonSelect {
                &-color {
-                       .oo-ui-iconElement-icon {
-                               width: 2em;
-                               height: 2em;
+                       // Make the rule much more specific to override OOUI
+                       .oo-ui-iconElement-icon.oo-ui-icon-check {
+                               // Override OOUI icon dimensions
+                               // The parent is 2em with 0.5em margin
+                               // (see mw-rcfilters-mixin-circle below)
+                               // so here we want 2em - 0.5em = 1.5em
+                               width: 1.5em;
+                               height: 1.5em;
+                               // By eye, this is centered horizontally for the color circle
+                               margin-left: -0.1em;
                        }
 
                        &-none {
+                               .oo-ui-iconElement-icon.oo-ui-icon-check {
+                                       // By eye, this is centered horizontally for the white circle
+                                       margin-left: -0.2em;
+                               }
+
                                .mw-rcfilters-mixin-circle( @highlight-none, 2em, 0.5em, true );
                                // Override border to dashed
                                border: 1px dashed #565656;
index 1809617..00c04bc 100644 (file)
                        } );
                }
                if ( action === 'cancel' ) {
-                       return new OO.ui.Process( this.close() );
+                       return new OO.ui.Process( this.close().closed );
                }
                if ( action === 'cancelupload' ) {
                        return new OO.ui.Process( this.uploadBooklet.initialize() );
diff --git a/tests/phpunit/data/resourceloader/abc.gif b/tests/phpunit/data/resourceloader/abc.gif
new file mode 100644 (file)
index 0000000..5f454ca
Binary files /dev/null and b/tests/phpunit/data/resourceloader/abc.gif differ
diff --git a/tests/phpunit/data/resourceloader/add.gif b/tests/phpunit/data/resourceloader/add.gif
deleted file mode 100644 (file)
index 5f454ca..0000000
Binary files a/tests/phpunit/data/resourceloader/add.gif and /dev/null differ
diff --git a/tests/phpunit/data/resourceloader/bold-a.svg b/tests/phpunit/data/resourceloader/bold-a.svg
deleted file mode 100644 (file)
index 4b82877..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
-    <g id="bold-a">
-        <path d="M16 18h3l-5-12h-3l-5 12h3l1.25-3h4.5l1.25 3zm-4.917-5l1.417-3.4 1.417 3.4h-2.834z"/>
-    </g>
-</svg>
diff --git a/tests/phpunit/data/resourceloader/bold-b.svg b/tests/phpunit/data/resourceloader/bold-b.svg
deleted file mode 100644 (file)
index 4f64820..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
-    <g id="bold-b">
-        <path id="b" d="M7 18h6c2 0 4-1 4-3 0-1.064.011-1.975-1.989-3 2-.975 1.989-1.935 1.989-3 0-2-2-3-4-3h-6v12zm7-8c0 1.001 0 1-2 1h-2v-3h2c2 0 2 0 2 1v1zm-2 6h-2v-3h2c2 0 2 0 2 1v1s0 1-2 1z"/>
-    </g>
-</svg>
diff --git a/tests/phpunit/data/resourceloader/bold-f.svg b/tests/phpunit/data/resourceloader/bold-f.svg
deleted file mode 100644 (file)
index 357d2e5..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
-    <g id="bold-f">
-        <path id="f" d="M16 8v-2h-8v12h3v-5h4v-2h-4v-3z"/>
-    </g>
-</svg>
diff --git a/tests/phpunit/data/resourceloader/def.svg b/tests/phpunit/data/resourceloader/def.svg
new file mode 100644 (file)
index 0000000..6ad7917
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+    <g id="remove">
+        <path id="trash-can" d="M12 10h-1v6h1v-6zm-2 0h-1v6h1v-6zm4 0h-1v6h1v-6zm0-4v-1h-5v1h-3v3h1v7.966l1 1.031v-.074.077h6.984l.016-.018v.015l1-1.031v-7.966h1v-3h-3zm1 11h-7v-8h7v8zm1-9h-9v-1h9v1z"/>
+    </g>
+</svg>
diff --git a/tests/phpunit/data/resourceloader/def_variantize.svg b/tests/phpunit/data/resourceloader/def_variantize.svg
new file mode 100644 (file)
index 0000000..bcbe871
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="red">
+    <g xmlns:default="http://www.w3.org/2000/svg" id="remove">
+        <path id="trash-can" d="M12 10h-1v6h1v-6zm-2 0h-1v6h1v-6zm4 0h-1v6h1v-6zm0-4v-1h-5v1h-3v3h1v7.966l1 1.031v-.074.077h6.984l.016-.018v.015l1-1.031v-7.966h1v-3h-3zm1 11h-7v-8h7v8zm1-9h-9v-1h9v1z"/>
+    </g>
+</g></svg>
diff --git a/tests/phpunit/data/resourceloader/ghi.svg b/tests/phpunit/data/resourceloader/ghi.svg
new file mode 100644 (file)
index 0000000..02b4e38
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+    <path d="M16.5 13.1l-8.9 8.9c-.8-.8-.8-2 0-2.8l6.1-6.1-6-6.1c-.8-.8-.8-2 0-2.8l8.8 8.9z" id="path108"/>
+</svg>
diff --git a/tests/phpunit/data/resourceloader/ghi_massage.svg b/tests/phpunit/data/resourceloader/ghi_massage.svg
new file mode 100644 (file)
index 0000000..bbd1a8d
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+    <path d="M 16.5   13.1 l -8.9   8.9 c -0.8  -0.8  -0.8  -2   0  -2.8 l 6.1  -6.1  -6  -6.1 c -0.8  -0.8  -0.8  -2   0  -2.8 l 8.8   8.9 z" id="path108"/>
+</svg>
diff --git a/tests/phpunit/data/resourceloader/help-ltr.svg b/tests/phpunit/data/resourceloader/help-ltr.svg
deleted file mode 100644 (file)
index bb2545c..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
-    <g id="help">
-        <path id="circle" d="M12.001 2.085c-5.478 0-9.916 4.438-9.916 9.916 0 5.476 4.438 9.914 9.916 9.914 5.476 0 9.914-4.438 9.914-9.914 0-5.478-4.438-9.916-9.914-9.916zm.001 18c-4.465 0-8.084-3.619-8.084-8.083 0-4.465 3.619-8.084 8.084-8.084 4.464 0 8.083 3.619 8.083 8.084 0 4.464-3.619 8.083-8.083 8.083z"/>
-        <g id="question-mark">
-            <path id="top" d="M11.766 6.688c-2.5 0-3.219 2.188-3.219 2.188l1.411.854s.298-.791.901-1.229c.516-.375 1.625-.625 2.219.125.701.885-.17 1.587-1.078 2.719-.953 1.186-1 3.655-1 3.655h1.969s.135-2.318 1.041-3.381c.603-.707 1.443-1.338 1.443-2.494s-1.187-2.437-3.687-2.437z"/>
-            <path id="bottom" d="M11 16h2v2h-2z"/>
-        </g>
-    </g>
-</svg>
diff --git a/tests/phpunit/data/resourceloader/help-rtl.svg b/tests/phpunit/data/resourceloader/help-rtl.svg
deleted file mode 100644 (file)
index 255ae95..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
-    <g id="help">
-        <path id="circle" d="M12.001 2.085c-5.478 0-9.916 4.438-9.916 9.916 0 5.476 4.438 9.914 9.916 9.914 5.476 0 9.914-4.438 9.914-9.914 0-5.478-4.438-9.916-9.914-9.916zm.001 18c-4.465 0-8.084-3.619-8.084-8.083 0-4.465 3.619-8.084 8.084-8.084 4.464 0 8.083 3.619 8.083 8.084 0 4.464-3.619 8.083-8.083 8.083z"/>
-        <g id="question-mark" transform="translate(24, 0) scale(-1, 1)">
-            <path id="top" d="M11.766 6.688c-2.5 0-3.219 2.188-3.219 2.188l1.411.854s.298-.791.901-1.229c.516-.375 1.625-.625 2.219.125.701.885-.17 1.587-1.078 2.719-.953 1.186-1 3.655-1 3.655h1.969s.135-2.318 1.041-3.381c.603-.707 1.443-1.338 1.443-2.494s-1.187-2.437-3.687-2.437z"/>
-            <path id="bottom" d="M11 16h2v2h-2z"/>
-        </g>
-    </g>
-</svg>
diff --git a/tests/phpunit/data/resourceloader/jkl.svg b/tests/phpunit/data/resourceloader/jkl.svg
new file mode 100644 (file)
index 0000000..f31ec09
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+    <path d="M7 13.1l8.9 8.9c.8-.8.8-2 0-2.8l-6.1-6.1 6-6.1c.8-.8.8-2 0-2.8l-8.8 8.9z"/>
+</svg>
diff --git a/tests/phpunit/data/resourceloader/mno-ltr.svg b/tests/phpunit/data/resourceloader/mno-ltr.svg
new file mode 100644 (file)
index 0000000..bb2545c
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+    <g id="help">
+        <path id="circle" d="M12.001 2.085c-5.478 0-9.916 4.438-9.916 9.916 0 5.476 4.438 9.914 9.916 9.914 5.476 0 9.914-4.438 9.914-9.914 0-5.478-4.438-9.916-9.914-9.916zm.001 18c-4.465 0-8.084-3.619-8.084-8.083 0-4.465 3.619-8.084 8.084-8.084 4.464 0 8.083 3.619 8.083 8.084 0 4.464-3.619 8.083-8.083 8.083z"/>
+        <g id="question-mark">
+            <path id="top" d="M11.766 6.688c-2.5 0-3.219 2.188-3.219 2.188l1.411.854s.298-.791.901-1.229c.516-.375 1.625-.625 2.219.125.701.885-.17 1.587-1.078 2.719-.953 1.186-1 3.655-1 3.655h1.969s.135-2.318 1.041-3.381c.603-.707 1.443-1.338 1.443-2.494s-1.187-2.437-3.687-2.437z"/>
+            <path id="bottom" d="M11 16h2v2h-2z"/>
+        </g>
+    </g>
+</svg>
diff --git a/tests/phpunit/data/resourceloader/mno-rtl.svg b/tests/phpunit/data/resourceloader/mno-rtl.svg
new file mode 100644 (file)
index 0000000..255ae95
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+    <g id="help">
+        <path id="circle" d="M12.001 2.085c-5.478 0-9.916 4.438-9.916 9.916 0 5.476 4.438 9.914 9.916 9.914 5.476 0 9.914-4.438 9.914-9.914 0-5.478-4.438-9.916-9.914-9.916zm.001 18c-4.465 0-8.084-3.619-8.084-8.083 0-4.465 3.619-8.084 8.084-8.084 4.464 0 8.083 3.619 8.083 8.084 0 4.464-3.619 8.083-8.083 8.083z"/>
+        <g id="question-mark" transform="translate(24, 0) scale(-1, 1)">
+            <path id="top" d="M11.766 6.688c-2.5 0-3.219 2.188-3.219 2.188l1.411.854s.298-.791.901-1.229c.516-.375 1.625-.625 2.219.125.701.885-.17 1.587-1.078 2.719-.953 1.186-1 3.655-1 3.655h1.969s.135-2.318 1.041-3.381c.603-.707 1.443-1.338 1.443-2.494s-1.187-2.437-3.687-2.437z"/>
+            <path id="bottom" d="M11 16h2v2h-2z"/>
+        </g>
+    </g>
+</svg>
diff --git a/tests/phpunit/data/resourceloader/next.svg b/tests/phpunit/data/resourceloader/next.svg
deleted file mode 100644 (file)
index 02b4e38..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
-    <path d="M16.5 13.1l-8.9 8.9c-.8-.8-.8-2 0-2.8l6.1-6.1-6-6.1c-.8-.8-.8-2 0-2.8l8.8 8.9z" id="path108"/>
-</svg>
diff --git a/tests/phpunit/data/resourceloader/next_massage.svg b/tests/phpunit/data/resourceloader/next_massage.svg
deleted file mode 100644 (file)
index bbd1a8d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
-    <path d="M 16.5   13.1 l -8.9   8.9 c -0.8  -0.8  -0.8  -2   0  -2.8 l 6.1  -6.1  -6  -6.1 c -0.8  -0.8  -0.8  -2   0  -2.8 l 8.8   8.9 z" id="path108"/>
-</svg>
index 4fe3d81..fdb4d12 100644 (file)
@@ -1,6 +1,6 @@
 {
        "prefix": "oo-ui-icon",
        "images": {
-               "search": { "file": "images/icons/search.svg" }
+               "stu": { "file": "images/icons/stu.svg" }
        }
 }
diff --git a/tests/phpunit/data/resourceloader/oouiimagemodule/apex/images/icons/search.svg b/tests/phpunit/data/resourceloader/oouiimagemodule/apex/images/icons/search.svg
deleted file mode 100644 (file)
index 6952997..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
-    <g id="search">
-        <path id="magnifying-glass-apex" d="M18.87 18.375l-3.987-3.99-.286-.17a5.774 5.774 0 0 0 1.082-3.372C15.67 7.616 13.06 5 9.84 5A5.843 5.843 0 0 0 4 10.844a5.84 5.84 0 0 0 5.842 5.842c1.26 0 2.423-.403 3.377-1.08l.16.286 3.99 3.987c.32.31.91.24 1.33-.18.41-.42.49-1.01.17-1.33zM9.837 14.56a3.72 3.72 0 0 1-3.718-3.717c0-2.05 1.67-3.72 3.72-3.72s3.72 1.668 3.72 3.72a3.722 3.722 0 0 1-3.72 3.718z"/>
-    </g>
-</svg>
diff --git a/tests/phpunit/data/resourceloader/oouiimagemodule/apex/images/icons/stu.svg b/tests/phpunit/data/resourceloader/oouiimagemodule/apex/images/icons/stu.svg
new file mode 100644 (file)
index 0000000..27f14df
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+    <g id="stu">
+        <path id="stu-apex" d="M18.87 18.375l-3.987-3.99-.286-.17a5.774 5.774 0 0 0 1.082-3.372C15.67 7.616 13.06 5 9.84 5A5.843 5.843 0 0 0 4 10.844a5.84 5.84 0 0 0 5.842 5.842c1.26 0 2.423-.403 3.377-1.08l.16.286 3.99 3.987c.32.31.91.24 1.33-.18.41-.42.49-1.01.17-1.33zM9.837 14.56a3.72 3.72 0 0 1-3.718-3.717c0-2.05 1.67-3.72 3.72-3.72s3.72 1.668 3.72 3.72a3.722 3.722 0 0 1-3.72 3.718z"/>
+    </g>
+</svg>
index 4fe3d81..fdb4d12 100644 (file)
@@ -1,6 +1,6 @@
 {
        "prefix": "oo-ui-icon",
        "images": {
-               "search": { "file": "images/icons/search.svg" }
+               "stu": { "file": "images/icons/stu.svg" }
        }
 }
diff --git a/tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/images/icons/search.svg b/tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/images/icons/search.svg
deleted file mode 100644 (file)
index 40438ea..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
-    <g id="search">
-        <path id="magnifying-glass-mediawiki" d="M10.5 4a6.5 6.5 0 1 0 2.844 12.344L16 19c1.4 1.4 2.5 1.5 4 0l-4.438-4.438A6.426 6.426 0 0 0 17 10.5 6.5 6.5 0 0 0 10.5 4zm0 2a4.5 4.5 0 1 1 0 9 4.5 4.5 0 0 1 0-9z"/>
-    </g>
-</svg>
diff --git a/tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/images/icons/stu.svg b/tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/images/icons/stu.svg
new file mode 100644 (file)
index 0000000..fcaaa8d
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+    <g id="stu">
+        <path id="stu-wikimediaui" d="M10.5 4a6.5 6.5 0 1 0 2.844 12.344L16 19c1.4 1.4 2.5 1.5 4 0l-4.438-4.438A6.426 6.426 0 0 0 17 10.5 6.5 6.5 0 0 0 10.5 4zm0 2a4.5 4.5 0 1 1 0 9 4.5 4.5 0 0 1 0-9z"/>
+    </g>
+</svg>
diff --git a/tests/phpunit/data/resourceloader/pqr-a.svg b/tests/phpunit/data/resourceloader/pqr-a.svg
new file mode 100644 (file)
index 0000000..4b82877
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+    <g id="bold-a">
+        <path d="M16 18h3l-5-12h-3l-5 12h3l1.25-3h4.5l1.25 3zm-4.917-5l1.417-3.4 1.417 3.4h-2.834z"/>
+    </g>
+</svg>
diff --git a/tests/phpunit/data/resourceloader/pqr-b.svg b/tests/phpunit/data/resourceloader/pqr-b.svg
new file mode 100644 (file)
index 0000000..4f64820
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+    <g id="bold-b">
+        <path id="b" d="M7 18h6c2 0 4-1 4-3 0-1.064.011-1.975-1.989-3 2-.975 1.989-1.935 1.989-3 0-2-2-3-4-3h-6v12zm7-8c0 1.001 0 1-2 1h-2v-3h2c2 0 2 0 2 1v1zm-2 6h-2v-3h2c2 0 2 0 2 1v1s0 1-2 1z"/>
+    </g>
+</svg>
diff --git a/tests/phpunit/data/resourceloader/pqr-f.svg b/tests/phpunit/data/resourceloader/pqr-f.svg
new file mode 100644 (file)
index 0000000..357d2e5
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+    <g id="bold-f">
+        <path id="f" d="M16 8v-2h-8v12h3v-5h4v-2h-4v-3z"/>
+    </g>
+</svg>
diff --git a/tests/phpunit/data/resourceloader/prev.svg b/tests/phpunit/data/resourceloader/prev.svg
deleted file mode 100644 (file)
index f31ec09..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
-    <path d="M7 13.1l8.9 8.9c.8-.8.8-2 0-2.8l-6.1-6.1 6-6.1c.8-.8.8-2 0-2.8l-8.8 8.9z"/>
-</svg>
diff --git a/tests/phpunit/data/resourceloader/remove.svg b/tests/phpunit/data/resourceloader/remove.svg
deleted file mode 100644 (file)
index 6ad7917..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
-    <g id="remove">
-        <path id="trash-can" d="M12 10h-1v6h1v-6zm-2 0h-1v6h1v-6zm4 0h-1v6h1v-6zm0-4v-1h-5v1h-3v3h1v7.966l1 1.031v-.074.077h6.984l.016-.018v.015l1-1.031v-7.966h1v-3h-3zm1 11h-7v-8h7v8zm1-9h-9v-1h9v1z"/>
-    </g>
-</svg>
diff --git a/tests/phpunit/data/resourceloader/remove_variantize.svg b/tests/phpunit/data/resourceloader/remove_variantize.svg
deleted file mode 100644 (file)
index bcbe871..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="red">
-    <g xmlns:default="http://www.w3.org/2000/svg" id="remove">
-        <path id="trash-can" d="M12 10h-1v6h1v-6zm-2 0h-1v6h1v-6zm4 0h-1v6h1v-6zm0-4v-1h-5v1h-3v3h1v7.966l1 1.031v-.074.077h6.984l.016-.018v.015l1-1.031v-7.966h1v-3h-3zm1 11h-7v-8h7v8zm1-9h-9v-1h9v1z"/>
-    </g>
-</g></svg>
diff --git a/tests/phpunit/includes/api/ApiComparePagesTest.php b/tests/phpunit/includes/api/ApiComparePagesTest.php
new file mode 100644 (file)
index 0000000..989d6bb
--- /dev/null
@@ -0,0 +1,611 @@
+<?php
+
+/**
+ * @group API
+ * @group Database
+ * @group medium
+ * @covers ApiComparePages
+ */
+class ApiComparePagesTest extends ApiTestCase {
+
+       protected static $repl = [];
+
+       protected function setUp() {
+               parent::setUp();
+
+               // Set $wgExternalDiffEngine to something bogus to try to force use of
+               // the PHP engine rather than wikidiff2.
+               $this->setMwGlobals( [
+                       'wgExternalDiffEngine' => '/dev/null',
+               ] );
+       }
+
+       protected function addPage( $page, $text, $model = CONTENT_MODEL_WIKITEXT ) {
+               $title = Title::newFromText( 'ApiComparePagesTest ' . $page );
+               $content = ContentHandler::makeContent( $text, $title, $model );
+
+               $page = WikiPage::factory( $title );
+               $user = static::getTestSysop()->getUser();
+               $status = $page->doEditContent(
+                       $content, 'Test for ApiComparePagesTest: ' . $text, 0, false, $user
+               );
+               if ( !$status->isOk() ) {
+                       $this->fail( "Failed to create $title: " . $status->getWikiText( false, false, 'en' ) );
+               }
+               return $status->value['revision']->getId();
+       }
+
+       public function addDBDataOnce() {
+               $user = static::getTestSysop()->getUser();
+               self::$repl['creator'] = $user->getName();
+               self::$repl['creatorid'] = $user->getId();
+
+               self::$repl['revA1'] = $this->addPage( 'A', 'A 1' );
+               self::$repl['revA2'] = $this->addPage( 'A', 'A 2' );
+               self::$repl['revA3'] = $this->addPage( 'A', 'A 3' );
+               self::$repl['revA4'] = $this->addPage( 'A', 'A 4' );
+               self::$repl['pageA'] = Title::newFromText( 'ApiComparePagesTest A' )->getArticleId();
+
+               self::$repl['revB1'] = $this->addPage( 'B', 'B 1' );
+               self::$repl['revB2'] = $this->addPage( 'B', 'B 2' );
+               self::$repl['revB3'] = $this->addPage( 'B', 'B 3' );
+               self::$repl['revB4'] = $this->addPage( 'B', 'B 4' );
+               self::$repl['pageB'] = Title::newFromText( 'ApiComparePagesTest B' )->getArticleId();
+
+               self::$repl['revC1'] = $this->addPage( 'C', 'C 1' );
+               self::$repl['revC2'] = $this->addPage( 'C', 'C 2' );
+               self::$repl['revC3'] = $this->addPage( 'C', 'C 3' );
+               self::$repl['pageC'] = Title::newFromText( 'ApiComparePagesTest C' )->getArticleId();
+
+               $id = $this->addPage( 'D', 'D 1' );
+               self::$repl['pageD'] = Title::newFromText( 'ApiComparePagesTest D' )->getArticleId();
+               wfGetDB( DB_MASTER )->delete( 'revision', [ 'rev_id' => $id ] );
+
+               self::$repl['revE1'] = $this->addPage( 'E', 'E 1' );
+               self::$repl['revE2'] = $this->addPage( 'E', 'E 2' );
+               self::$repl['revE3'] = $this->addPage( 'E', 'E 3' );
+               self::$repl['revE4'] = $this->addPage( 'E', 'E 4' );
+               self::$repl['pageE'] = Title::newFromText( 'ApiComparePagesTest E' )->getArticleId();
+               wfGetDB( DB_MASTER )->update(
+                       'page', [ 'page_latest' => 0 ], [ 'page_id' => self::$repl['pageE'] ]
+               );
+
+               WikiPage::factory( Title::newFromText( 'ApiComparePagesTest C' ) )
+                       ->doDeleteArticleReal( 'Test for ApiComparePagesTest' );
+
+               RevisionDeleter::createList(
+                       'revision',
+                       RequestContext::getMain(),
+                       Title::newFromText( 'ApiComparePagesTest B' ),
+                       [ self::$repl['revB2'] ]
+               )->setVisibility( [
+                       'value' => [
+                               Revision::DELETED_TEXT => 1,
+                               Revision::DELETED_USER => 1,
+                               Revision::DELETED_COMMENT => 1,
+                       ],
+                       'comment' => 'Test for ApiComparePages',
+               ] );
+
+               RevisionDeleter::createList(
+                       'revision',
+                       RequestContext::getMain(),
+                       Title::newFromText( 'ApiComparePagesTest B' ),
+                       [ self::$repl['revB3'] ]
+               )->setVisibility( [
+                       'value' => [
+                               Revision::DELETED_USER => 1,
+                               Revision::DELETED_COMMENT => 1,
+                               Revision::DELETED_RESTRICTED => 1,
+                       ],
+                       'comment' => 'Test for ApiComparePages',
+               ] );
+
+               Title::clearCaches(); // Otherwise it has the wrong latest revision for some reason
+       }
+
+       protected function doReplacements( &$value ) {
+               if ( is_string( $value ) ) {
+                       if ( preg_match( '/^{{REPL:(.+?)}}$/', $value, $m ) ) {
+                               $value = self::$repl[$m[1]];
+                       } else {
+                               $value = preg_replace_callback( '/{{REPL:(.+?)}}/', function ( $m ) {
+                                       return isset( self::$repl[$m[1]] ) ? self::$repl[$m[1]] : $m[0];
+                               }, $value );
+                       }
+               } elseif ( is_array( $value ) || is_object( $value ) ) {
+                       foreach ( $value as &$v ) {
+                               $this->doReplacements( $v );
+                       }
+                       unset( $v );
+               }
+       }
+
+       /**
+        * @dataProvider provideDiff
+        */
+       public function testDiff( $params, $expect, $exceptionCode = false, $sysop = false ) {
+               $this->doReplacements( $params );
+
+               $params += [
+                       'action' => 'compare',
+               ];
+
+               $user = $sysop
+                       ? static::getTestSysop()->getUser()
+                       : static::getTestUser()->getUser();
+               if ( $exceptionCode ) {
+                       try {
+                               $this->doApiRequest( $params, null, false, $user );
+                               $this->fail( 'Expected exception not thrown' );
+                       } catch ( ApiUsageException $ex ) {
+                               $this->assertTrue( $this->apiExceptionHasCode( $ex, $exceptionCode ),
+                                       "Exception with code $exceptionCode" );
+                       }
+               } else {
+                       $apiResult = $this->doApiRequest( $params, null, false, $user );
+                       $apiResult = $apiResult[0];
+                       $this->doReplacements( $expect );
+                       $this->assertEquals( $expect, $apiResult );
+               }
+       }
+
+       public static function provideDiff() {
+               return [
+                       // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
+                       'Basic diff, titles' => [
+                               [
+                                       'fromtitle' => 'ApiComparePagesTest A',
+                                       'totitle' => 'ApiComparePagesTest B',
+                               ],
+                               [
+                                       'compare' => [
+                                               'fromid' => '{{REPL:pageA}}',
+                                               'fromrevid' => '{{REPL:revA4}}',
+                                               'fromns' => 0,
+                                               'fromtitle' => 'ApiComparePagesTest A',
+                                               'toid' => '{{REPL:pageB}}',
+                                               'torevid' => '{{REPL:revB4}}',
+                                               'tons' => 0,
+                                               'totitle' => 'ApiComparePagesTest B',
+                                               'body' => '<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>' . "\n"
+                                                       . '<td colspan="2" class="diff-lineno">Line 1:</td></tr>' . "\n"
+                                                       . '<tr><td class=\'diff-marker\'>−</td><td class=\'diff-deletedline\'><div><del class="diffchange diffchange-inline">A </del>4</div></td><td class=\'diff-marker\'>+</td><td class=\'diff-addedline\'><div><ins class="diffchange diffchange-inline">B </ins>4</div></td></tr>' . "\n",
+                                       ]
+                               ],
+                       ],
+                       'Basic diff, page IDs' => [
+                               [
+                                       'fromid' => '{{REPL:pageA}}',
+                                       'toid' => '{{REPL:pageB}}',
+                               ],
+                               [
+                                       'compare' => [
+                                               'fromid' => '{{REPL:pageA}}',
+                                               'fromrevid' => '{{REPL:revA4}}',
+                                               'fromns' => 0,
+                                               'fromtitle' => 'ApiComparePagesTest A',
+                                               'toid' => '{{REPL:pageB}}',
+                                               'torevid' => '{{REPL:revB4}}',
+                                               'tons' => 0,
+                                               'totitle' => 'ApiComparePagesTest B',
+                                               'body' => '<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>' . "\n"
+                                                       . '<td colspan="2" class="diff-lineno">Line 1:</td></tr>' . "\n"
+                                                       . '<tr><td class=\'diff-marker\'>−</td><td class=\'diff-deletedline\'><div><del class="diffchange diffchange-inline">A </del>4</div></td><td class=\'diff-marker\'>+</td><td class=\'diff-addedline\'><div><ins class="diffchange diffchange-inline">B </ins>4</div></td></tr>' . "\n",
+                                       ]
+                               ],
+                       ],
+                       'Basic diff, revision IDs' => [
+                               [
+                                       'fromrev' => '{{REPL:revA2}}',
+                                       'torev' => '{{REPL:revA3}}',
+                               ],
+                               [
+                                       'compare' => [
+                                               'fromid' => '{{REPL:pageA}}',
+                                               'fromrevid' => '{{REPL:revA2}}',
+                                               'fromns' => 0,
+                                               'fromtitle' => 'ApiComparePagesTest A',
+                                               'toid' => '{{REPL:pageA}}',
+                                               'torevid' => '{{REPL:revA3}}',
+                                               'tons' => 0,
+                                               'totitle' => 'ApiComparePagesTest A',
+                                               'body' => '<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>' . "\n"
+                                                       . '<td colspan="2" class="diff-lineno">Line 1:</td></tr>' . "\n"
+                                                       . '<tr><td class=\'diff-marker\'>−</td><td class=\'diff-deletedline\'><div>A <del class="diffchange diffchange-inline">2</del></div></td><td class=\'diff-marker\'>+</td><td class=\'diff-addedline\'><div>A <ins class="diffchange diffchange-inline">3</ins></div></td></tr>' . "\n",
+                                       ]
+                               ],
+                       ],
+                       'Basic diff, deleted revision ID as sysop' => [
+                               [
+                                       'fromrev' => '{{REPL:revA2}}',
+                                       'torev' => '{{REPL:revC2}}',
+                               ],
+                               [
+                                       'compare' => [
+                                               'fromid' => '{{REPL:pageA}}',
+                                               'fromrevid' => '{{REPL:revA2}}',
+                                               'fromns' => 0,
+                                               'fromtitle' => 'ApiComparePagesTest A',
+                                               'toid' => 0,
+                                               'torevid' => '{{REPL:revC2}}',
+                                               'tons' => 0,
+                                               'totitle' => 'ApiComparePagesTest C',
+                                               'toarchive' => true,
+                                               'body' => '<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>' . "\n"
+                                                       . '<td colspan="2" class="diff-lineno">Line 1:</td></tr>' . "\n"
+                                                       . '<tr><td class=\'diff-marker\'>−</td><td class=\'diff-deletedline\'><div><del class="diffchange diffchange-inline">A </del>2</div></td><td class=\'diff-marker\'>+</td><td class=\'diff-addedline\'><div><ins class="diffchange diffchange-inline">C </ins>2</div></td></tr>' . "\n",
+                                       ]
+                               ],
+                               false, true
+                       ],
+                       'Basic diff, revdel as sysop' => [
+                               [
+                                       'fromrev' => '{{REPL:revA2}}',
+                                       'torev' => '{{REPL:revB2}}',
+                               ],
+                               [
+                                       'compare' => [
+                                               'fromid' => '{{REPL:pageA}}',
+                                               'fromrevid' => '{{REPL:revA2}}',
+                                               'fromns' => 0,
+                                               'fromtitle' => 'ApiComparePagesTest A',
+                                               'toid' => '{{REPL:pageB}}',
+                                               'torevid' => '{{REPL:revB2}}',
+                                               'tons' => 0,
+                                               'totitle' => 'ApiComparePagesTest B',
+                                               'totexthidden' => true,
+                                               'touserhidden' => true,
+                                               'tocommenthidden' => true,
+                                               'body' => '<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>' . "\n"
+                                                       . '<td colspan="2" class="diff-lineno">Line 1:</td></tr>' . "\n"
+                                                       . '<tr><td class=\'diff-marker\'>−</td><td class=\'diff-deletedline\'><div><del class="diffchange diffchange-inline">A </del>2</div></td><td class=\'diff-marker\'>+</td><td class=\'diff-addedline\'><div><ins class="diffchange diffchange-inline">B </ins>2</div></td></tr>' . "\n",
+                                       ]
+                               ],
+                               false, true
+                       ],
+                       'Basic diff, text' => [
+                               [
+                                       'fromtext' => 'From text',
+                                       'fromcontentmodel' => 'wikitext',
+                                       'totext' => 'To text {{subst:PAGENAME}}',
+                                       'tocontentmodel' => 'wikitext',
+                               ],
+                               [
+                                       'compare' => [
+                                               'body' => '<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>' . "\n"
+                                                       . '<td colspan="2" class="diff-lineno">Line 1:</td></tr>' . "\n"
+                                                       . '<tr><td class=\'diff-marker\'>−</td><td class=\'diff-deletedline\'><div><del class="diffchange diffchange-inline">From </del>text</div></td><td class=\'diff-marker\'>+</td><td class=\'diff-addedline\'><div><ins class="diffchange diffchange-inline">To </ins>text <ins class="diffchange diffchange-inline">{{subst:PAGENAME}}</ins></div></td></tr>' . "\n",
+                                       ]
+                               ],
+                       ],
+                       'Basic diff, text 2' => [
+                               [
+                                       'fromtext' => 'From text',
+                                       'totext' => 'To text {{subst:PAGENAME}}',
+                                       'tocontentmodel' => 'wikitext',
+                               ],
+                               [
+                                       'compare' => [
+                                               'body' => '<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>' . "\n"
+                                                       . '<td colspan="2" class="diff-lineno">Line 1:</td></tr>' . "\n"
+                                                       . '<tr><td class=\'diff-marker\'>−</td><td class=\'diff-deletedline\'><div><del class="diffchange diffchange-inline">From </del>text</div></td><td class=\'diff-marker\'>+</td><td class=\'diff-addedline\'><div><ins class="diffchange diffchange-inline">To </ins>text <ins class="diffchange diffchange-inline">{{subst:PAGENAME}}</ins></div></td></tr>' . "\n",
+                                       ]
+                               ],
+                       ],
+                       'Basic diff, guessed model' => [
+                               [
+                                       'fromtext' => 'From text',
+                                       'totext' => 'To text',
+                               ],
+                               [
+                                       'warnings' => [
+                                               'compare' => [
+                                                       'warnings' => 'No content model could be determined, assuming wikitext.',
+                                               ],
+                                       ],
+                                       'compare' => [
+                                               'body' => '<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>' . "\n"
+                                                       . '<td colspan="2" class="diff-lineno">Line 1:</td></tr>' . "\n"
+                                                       . '<tr><td class=\'diff-marker\'>−</td><td class=\'diff-deletedline\'><div><del class="diffchange diffchange-inline">From </del>text</div></td><td class=\'diff-marker\'>+</td><td class=\'diff-addedline\'><div><ins class="diffchange diffchange-inline">To </ins>text</div></td></tr>' . "\n",
+                                       ]
+                               ],
+                       ],
+                       'Basic diff, text with title and PST' => [
+                               [
+                                       'fromtext' => 'From text',
+                                       'totitle' => 'Test',
+                                       'totext' => 'To text {{subst:PAGENAME}}',
+                                       'topst' => true,
+                               ],
+                               [
+                                       'compare' => [
+                                               'body' => '<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>' . "\n"
+                                                       . '<td colspan="2" class="diff-lineno">Line 1:</td></tr>' . "\n"
+                                                       . '<tr><td class=\'diff-marker\'>−</td><td class=\'diff-deletedline\'><div><del class="diffchange diffchange-inline">From </del>text</div></td><td class=\'diff-marker\'>+</td><td class=\'diff-addedline\'><div><ins class="diffchange diffchange-inline">To </ins>text <ins class="diffchange diffchange-inline">Test</ins></div></td></tr>' . "\n",
+                                       ]
+                               ],
+                       ],
+                       'Basic diff, text with page ID and PST' => [
+                               [
+                                       'fromtext' => 'From text',
+                                       'toid' => '{{REPL:pageB}}',
+                                       'totext' => 'To text {{subst:PAGENAME}}',
+                                       'topst' => true,
+                               ],
+                               [
+                                       'compare' => [
+                                               'body' => '<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>' . "\n"
+                                                       . '<td colspan="2" class="diff-lineno">Line 1:</td></tr>' . "\n"
+                                                       . '<tr><td class=\'diff-marker\'>−</td><td class=\'diff-deletedline\'><div><del class="diffchange diffchange-inline">From </del>text</div></td><td class=\'diff-marker\'>+</td><td class=\'diff-addedline\'><div><ins class="diffchange diffchange-inline">To </ins>text <ins class="diffchange diffchange-inline">ApiComparePagesTest B</ins></div></td></tr>' . "\n",
+                                       ]
+                               ],
+                       ],
+                       'Basic diff, text with revision and PST' => [
+                               [
+                                       'fromtext' => 'From text',
+                                       'torev' => '{{REPL:revB2}}',
+                                       'totext' => 'To text {{subst:PAGENAME}}',
+                                       'topst' => true,
+                               ],
+                               [
+                                       'compare' => [
+                                               'body' => '<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>' . "\n"
+                                                       . '<td colspan="2" class="diff-lineno">Line 1:</td></tr>' . "\n"
+                                                       . '<tr><td class=\'diff-marker\'>−</td><td class=\'diff-deletedline\'><div><del class="diffchange diffchange-inline">From </del>text</div></td><td class=\'diff-marker\'>+</td><td class=\'diff-addedline\'><div><ins class="diffchange diffchange-inline">To </ins>text <ins class="diffchange diffchange-inline">ApiComparePagesTest B</ins></div></td></tr>' . "\n",
+                                       ]
+                               ],
+                       ],
+                       'Basic diff, text with deleted revision and PST' => [
+                               [
+                                       'fromtext' => 'From text',
+                                       'torev' => '{{REPL:revC2}}',
+                                       'totext' => 'To text {{subst:PAGENAME}}',
+                                       'topst' => true,
+                               ],
+                               [
+                                       'compare' => [
+                                               'body' => '<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>' . "\n"
+                                                       . '<td colspan="2" class="diff-lineno">Line 1:</td></tr>' . "\n"
+                                                       . '<tr><td class=\'diff-marker\'>−</td><td class=\'diff-deletedline\'><div><del class="diffchange diffchange-inline">From </del>text</div></td><td class=\'diff-marker\'>+</td><td class=\'diff-addedline\'><div><ins class="diffchange diffchange-inline">To </ins>text <ins class="diffchange diffchange-inline">ApiComparePagesTest C</ins></div></td></tr>' . "\n",
+                                       ]
+                               ],
+                               false, true
+                       ],
+                       'Diff with all props' => [
+                               [
+                                       'fromrev' => '{{REPL:revB1}}',
+                                       'torev' => '{{REPL:revB3}}',
+                                       'totitle' => 'ApiComparePagesTest B',
+                                       'prop' => 'diff|diffsize|rel|ids|title|user|comment|parsedcomment|size'
+                               ],
+                               [
+                                       'compare' => [
+                                               'fromid' => '{{REPL:pageB}}',
+                                               'fromrevid' => '{{REPL:revB1}}',
+                                               'fromns' => 0,
+                                               'fromtitle' => 'ApiComparePagesTest B',
+                                               'fromsize' => 3,
+                                               'fromuser' => '{{REPL:creator}}',
+                                               'fromuserid' => '{{REPL:creatorid}}',
+                                               'fromcomment' => 'Test for ApiComparePagesTest: B 1',
+                                               'fromparsedcomment' => 'Test for ApiComparePagesTest: B 1',
+                                               'toid' => '{{REPL:pageB}}',
+                                               'torevid' => '{{REPL:revB3}}',
+                                               'tons' => 0,
+                                               'totitle' => 'ApiComparePagesTest B',
+                                               'tosize' => 3,
+                                               'touserhidden' => true,
+                                               'tocommenthidden' => true,
+                                               'tosuppressed' => true,
+                                               'next' => '{{REPL:revB4}}',
+                                               'diffsize' => 391,
+                                               'body' => '<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>' . "\n"
+                                                       . '<td colspan="2" class="diff-lineno">Line 1:</td></tr>' . "\n"
+                                                       . '<tr><td class=\'diff-marker\'>−</td><td class=\'diff-deletedline\'><div>B <del class="diffchange diffchange-inline">1</del></div></td><td class=\'diff-marker\'>+</td><td class=\'diff-addedline\'><div>B <ins class="diffchange diffchange-inline">3</ins></div></td></tr>' . "\n",
+                                       ]
+                               ],
+                       ],
+                       'Diff with all props as sysop' => [
+                               [
+                                       'fromrev' => '{{REPL:revB2}}',
+                                       'torev' => '{{REPL:revB3}}',
+                                       'totitle' => 'ApiComparePagesTest B',
+                                       'prop' => 'diff|diffsize|rel|ids|title|user|comment|parsedcomment|size'
+                               ],
+                               [
+                                       'compare' => [
+                                               'fromid' => '{{REPL:pageB}}',
+                                               'fromrevid' => '{{REPL:revB2}}',
+                                               'fromns' => 0,
+                                               'fromtitle' => 'ApiComparePagesTest B',
+                                               'fromsize' => 3,
+                                               'fromtexthidden' => true,
+                                               'fromuserhidden' => true,
+                                               'fromuser' => '{{REPL:creator}}',
+                                               'fromuserid' => '{{REPL:creatorid}}',
+                                               'fromcommenthidden' => true,
+                                               'fromcomment' => 'Test for ApiComparePagesTest: B 2',
+                                               'fromparsedcomment' => 'Test for ApiComparePagesTest: B 2',
+                                               'toid' => '{{REPL:pageB}}',
+                                               'torevid' => '{{REPL:revB3}}',
+                                               'tons' => 0,
+                                               'totitle' => 'ApiComparePagesTest B',
+                                               'tosize' => 3,
+                                               'touserhidden' => true,
+                                               'tocommenthidden' => true,
+                                               'tosuppressed' => true,
+                                               'prev' => '{{REPL:revB1}}',
+                                               'next' => '{{REPL:revB4}}',
+                                               'diffsize' => 391,
+                                               'body' => '<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>' . "\n"
+                                                       . '<td colspan="2" class="diff-lineno">Line 1:</td></tr>' . "\n"
+                                                       . '<tr><td class=\'diff-marker\'>−</td><td class=\'diff-deletedline\'><div>B <del class="diffchange diffchange-inline">2</del></div></td><td class=\'diff-marker\'>+</td><td class=\'diff-addedline\'><div>B <ins class="diffchange diffchange-inline">3</ins></div></td></tr>' . "\n",
+                                       ]
+                               ],
+                               false, true
+                       ],
+                       'Relative diff, cur' => [
+                               [
+                                       'fromrev' => '{{REPL:revA2}}',
+                                       'torelative' => 'cur',
+                                       'prop' => 'ids',
+                               ],
+                               [
+                                       'compare' => [
+                                               'fromid' => '{{REPL:pageA}}',
+                                               'fromrevid' => '{{REPL:revA2}}',
+                                               'toid' => '{{REPL:pageA}}',
+                                               'torevid' => '{{REPL:revA4}}',
+                                       ]
+                               ],
+                       ],
+                       'Relative diff, next' => [
+                               [
+                                       'fromrev' => '{{REPL:revE2}}',
+                                       'torelative' => 'next',
+                                       'prop' => 'ids|rel',
+                               ],
+                               [
+                                       'compare' => [
+                                               'fromid' => '{{REPL:pageE}}',
+                                               'fromrevid' => '{{REPL:revE2}}',
+                                               'toid' => '{{REPL:pageE}}',
+                                               'torevid' => '{{REPL:revE3}}',
+                                               'prev' => '{{REPL:revE1}}',
+                                               'next' => '{{REPL:revE4}}',
+                                       ]
+                               ],
+                       ],
+                       'Relative diff, prev' => [
+                               [
+                                       'fromrev' => '{{REPL:revE3}}',
+                                       'torelative' => 'prev',
+                                       'prop' => 'ids|rel',
+                               ],
+                               [
+                                       'compare' => [
+                                               'fromid' => '{{REPL:pageE}}',
+                                               'fromrevid' => '{{REPL:revE2}}',
+                                               'toid' => '{{REPL:pageE}}',
+                                               'torevid' => '{{REPL:revE3}}',
+                                               'prev' => '{{REPL:revE1}}',
+                                               'next' => '{{REPL:revE4}}',
+                                       ]
+                               ],
+                       ],
+
+                       'Error, missing title' => [
+                               [
+                                       'fromtitle' => 'ApiComparePagesTest X',
+                                       'totitle' => 'ApiComparePagesTest B',
+                               ],
+                               [],
+                               'missingtitle',
+                       ],
+                       'Error, invalid title' => [
+                               [
+                                       'fromtitle' => '<bad>',
+                                       'totitle' => 'ApiComparePagesTest B',
+                               ],
+                               [],
+                               'invalidtitle',
+                       ],
+                       'Error, missing page ID' => [
+                               [
+                                       'fromid' => 8817900,
+                                       'totitle' => 'ApiComparePagesTest B',
+                               ],
+                               [],
+                               'nosuchpageid',
+                       ],
+                       'Error, page with missing revision' => [
+                               [
+                                       'fromtitle' => 'ApiComparePagesTest D',
+                                       'totitle' => 'ApiComparePagesTest B',
+                               ],
+                               [],
+                               'nosuchrevid',
+                       ],
+                       'Error, page with no revision' => [
+                               [
+                                       'fromtitle' => 'ApiComparePagesTest E',
+                                       'totitle' => 'ApiComparePagesTest B',
+                               ],
+                               [],
+                               'nosuchrevid',
+                       ],
+                       'Error, bad rev ID' => [
+                               [
+                                       'fromrev' => 8817900,
+                                       'totitle' => 'ApiComparePagesTest B',
+                               ],
+                               [],
+                               'nosuchrevid',
+                       ],
+                       'Error, deleted revision ID, non-sysop' => [
+                               [
+                                       'fromrev' => '{{REPL:revA2}}',
+                                       'torev' => '{{REPL:revC2}}',
+                               ],
+                               [],
+                               'nosuchrevid',
+                       ],
+                       'Error, revision-deleted content' => [
+                               [
+                                       'fromrev' => '{{REPL:revA2}}',
+                                       'torev' => '{{REPL:revB2}}',
+                               ],
+                               [],
+                               'missingcontent',
+                       ],
+                       'Error, text with no title and PST' => [
+                               [
+                                       'fromtext' => 'From text',
+                                       'totext' => 'To text {{subst:PAGENAME}}',
+                                       'topst' => true,
+                               ],
+                               [],
+                               'compare-no-title',
+                       ],
+                       'Error, Relative diff, no from revision' => [
+                               [
+                                       'fromtext' => 'Foo',
+                                       'torelative' => 'cur',
+                                       'prop' => 'ids',
+                               ],
+                               [],
+                               'compare-relative-to-nothing'
+                       ],
+                       'Error, Relative diff, cur with no current revision' => [
+                               [
+                                       'fromrev' => '{{REPL:revE2}}',
+                                       'torelative' => 'cur',
+                                       'prop' => 'ids',
+                               ],
+                               [],
+                               'nosuchrevid'
+                       ],
+                       'Error, Relative diff, next revdeleted' => [
+                               [
+                                       'fromrev' => '{{REPL:revB1}}',
+                                       'torelative' => 'next',
+                                       'prop' => 'ids',
+                               ],
+                               [],
+                               'missingcontent'
+                       ],
+                       'Error, Relative diff, prev revdeleted' => [
+                               [
+                                       'fromrev' => '{{REPL:revB3}}',
+                                       'torelative' => 'prev',
+                                       'prop' => 'ids',
+                               ],
+                               [],
+                               'missingcontent'
+                       ],
+
+                       // @codingStandardsIgnoreEnd
+               ];
+       }
+}
index 9cc3ffd..639c323 100644 (file)
@@ -167,7 +167,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase {
 
                $this->assertRecentChangeByCategorization(
                        $title,
-                       $wikiPage->getParserOutput( new ParserOptions() ),
+                       $wikiPage->getParserOutput( ParserOptions::newCanonical() ),
                        Title::newFromText( 'Category:Foo' ),
                        [ [ 'Foo', '[[:Testing]] added to category' ] ]
                );
@@ -177,7 +177,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase {
 
                $this->assertRecentChangeByCategorization(
                        $title,
-                       $wikiPage->getParserOutput( new ParserOptions() ),
+                       $wikiPage->getParserOutput( ParserOptions::newCanonical() ),
                        Title::newFromText( 'Category:Foo' ),
                        [
                                [ 'Foo', '[[:Testing]] added to category' ],
@@ -187,7 +187,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase {
 
                $this->assertRecentChangeByCategorization(
                        $title,
-                       $wikiPage->getParserOutput( new ParserOptions() ),
+                       $wikiPage->getParserOutput( ParserOptions::newCanonical() ),
                        Title::newFromText( 'Category:Bar' ),
                        [
                                [ 'Bar', '[[:Testing]] added to category' ],
@@ -211,7 +211,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase {
 
                $this->assertRecentChangeByCategorization(
                        $templateTitle,
-                       $templatePage->getParserOutput( new ParserOptions() ),
+                       $templatePage->getParserOutput( ParserOptions::newCanonical() ),
                        Title::newFromText( 'Baz' ),
                        []
                );
@@ -221,7 +221,7 @@ class LinksUpdateTest extends MediaWikiLangTestCase {
 
                $this->assertRecentChangeByCategorization(
                        $templateTitle,
-                       $templatePage->getParserOutput( new ParserOptions() ),
+                       $templatePage->getParserOutput( ParserOptions::newCanonical() ),
                        Title::newFromText( 'Baz' ),
                        [ [
                                'Baz',
index 3aeed09..728e671 100644 (file)
@@ -426,6 +426,153 @@ class WANObjectCacheTest extends PHPUnit_Framework_TestCase  {
                ];
        }
 
+       /**
+        * @dataProvider getMultiWithUnionSetCallback_provider
+        * @covers WANObjectCache::getMultiWithUnionSetCallback()
+        * @covers WANObjectCache::makeMultiKeys()
+        * @param array $extOpts
+        * @param bool $versioned
+        */
+       public function testGetMultiWithUnionSetCallback( array $extOpts, $versioned ) {
+               $cache = $this->cache;
+
+               $keyA = wfRandomString();
+               $keyB = wfRandomString();
+               $keyC = wfRandomString();
+               $cKey1 = wfRandomString();
+               $cKey2 = wfRandomString();
+
+               $wasSet = 0;
+               $genFunc = function ( array $ids, array &$ttls, array &$setOpts ) use (
+                       &$wasSet, &$priorValue, &$priorAsOf
+               ) {
+                       $newValues = [];
+                       foreach ( $ids as $id ) {
+                               ++$wasSet;
+                               $newValues[$id] = "@$id$";
+                               $ttls[$id] = 20; // override with another value
+                       }
+
+                       return $newValues;
+               };
+
+               $wasSet = 0;
+               $keyedIds = new ArrayIterator( [ $keyA => 3353 ] );
+               $value = "@3353$";
+               $v = $cache->getMultiWithUnionSetCallback(
+                       $keyedIds, 30, $genFunc, $extOpts );
+               $this->assertEquals( $value, $v[$keyA], "Value returned" );
+               $this->assertEquals( 1, $wasSet, "Value regenerated" );
+
+               $curTTL = null;
+               $cache->get( $keyA, $curTTL );
+               $this->assertLessThanOrEqual( 20, $curTTL, 'Current TTL between 19-20 (overriden)' );
+               $this->assertGreaterThanOrEqual( 19, $curTTL, 'Current TTL between 19-20 (overriden)' );
+
+               $wasSet = 0;
+               $value = "@efef$";
+               $keyedIds = new ArrayIterator( [ $keyB => 'efef' ] );
+               $v = $cache->getMultiWithUnionSetCallback(
+                       $keyedIds, 30, $genFunc, [ 'lowTTL' => 0 ] + $extOpts );
+               $this->assertEquals( $value, $v[$keyB], "Value returned" );
+               $this->assertEquals( 1, $wasSet, "Value regenerated" );
+               $this->assertEquals( 0, $cache->getWarmupKeyMisses(), "Keys warmed yet in process cache" );
+               $v = $cache->getMultiWithUnionSetCallback(
+                       $keyedIds, 30, $genFunc, [ 'lowTTL' => 0 ] + $extOpts );
+               $this->assertEquals( $value, $v[$keyB], "Value returned" );
+               $this->assertEquals( 1, $wasSet, "Value not regenerated" );
+               $this->assertEquals( 0, $cache->getWarmupKeyMisses(), "Keys warmed in process cache" );
+
+               $priorTime = microtime( true );
+               usleep( 1 );
+               $wasSet = 0;
+               $keyedIds = new ArrayIterator( [ $keyB => 'efef' ] );
+               $v = $cache->getMultiWithUnionSetCallback(
+                       $keyedIds, 30, $genFunc, [ 'checkKeys' => [ $cKey1, $cKey2 ] ] + $extOpts
+               );
+               $this->assertEquals( $value, $v[$keyB], "Value returned" );
+               $this->assertEquals( 1, $wasSet, "Value regenerated due to check keys" );
+               $t1 = $cache->getCheckKeyTime( $cKey1 );
+               $this->assertGreaterThanOrEqual( $priorTime, $t1, 'Check keys generated on miss' );
+               $t2 = $cache->getCheckKeyTime( $cKey2 );
+               $this->assertGreaterThanOrEqual( $priorTime, $t2, 'Check keys generated on miss' );
+
+               $priorTime = microtime( true );
+               $value = "@43636$";
+               $wasSet = 0;
+               $keyedIds = new ArrayIterator( [ $keyC => 43636 ] );
+               $v = $cache->getMultiWithUnionSetCallback(
+                       $keyedIds, 30, $genFunc, [ 'checkKeys' => [ $cKey1, $cKey2 ] ] + $extOpts
+               );
+               $this->assertEquals( $value, $v[$keyC], "Value returned" );
+               $this->assertEquals( 1, $wasSet, "Value regenerated due to still-recent check keys" );
+               $t1 = $cache->getCheckKeyTime( $cKey1 );
+               $this->assertLessThanOrEqual( $priorTime, $t1, 'Check keys did not change again' );
+               $t2 = $cache->getCheckKeyTime( $cKey2 );
+               $this->assertLessThanOrEqual( $priorTime, $t2, 'Check keys did not change again' );
+
+               $curTTL = null;
+               $v = $cache->get( $keyC, $curTTL, [ $cKey1, $cKey2 ] );
+               if ( $versioned ) {
+                       $this->assertEquals( $value, $v[$cache::VFLD_DATA], "Value returned" );
+               } else {
+                       $this->assertEquals( $value, $v, "Value returned" );
+               }
+               $this->assertLessThanOrEqual( 0, $curTTL, "Value has current TTL < 0 due to check keys" );
+
+               $wasSet = 0;
+               $key = wfRandomString();
+               $keyedIds = new ArrayIterator( [ $key => 242424 ] );
+               $v = $cache->getMultiWithUnionSetCallback(
+                       $keyedIds, 30, $genFunc, [ 'pcTTL' => 5 ] + $extOpts );
+               $this->assertEquals( "@{$keyedIds[$key]}$", $v[$key], "Value returned" );
+               $cache->delete( $key );
+               $keyedIds = new ArrayIterator( [ $key => 242424 ] );
+               $v = $cache->getMultiWithUnionSetCallback(
+                       $keyedIds, 30, $genFunc, [ 'pcTTL' => 5 ] + $extOpts );
+               $this->assertEquals( "@{$keyedIds[$key]}$", $v[$key], "Value still returned after deleted" );
+               $this->assertEquals( 1, $wasSet, "Value process cached while deleted" );
+
+               $calls = 0;
+               $ids = [ 1, 2, 3, 4, 5, 6 ];
+               $keyFunc = function ( $id, WANObjectCache $wanCache ) {
+                       return $wanCache->makeKey( 'test', $id );
+               };
+               $keyedIds = $cache->makeMultiKeys( $ids, $keyFunc );
+               $genFunc = function ( array $ids, array &$ttls, array &$setOpts ) use ( &$calls ) {
+                       $newValues = [];
+                       foreach ( $ids as $id ) {
+                               ++$calls;
+                               $newValues[$id] = "val-{$id}";
+                       }
+
+                       return $newValues;
+               };
+               $values = $cache->getMultiWithUnionSetCallback( $keyedIds, 10, $genFunc );
+
+               $this->assertEquals(
+                       [ "val-1", "val-2", "val-3", "val-4", "val-5", "val-6" ],
+                       array_values( $values ),
+                       "Correct values in correct order"
+               );
+               $this->assertEquals(
+                       array_map( $keyFunc, $ids, array_fill( 0, count( $ids ), $this->cache ) ),
+                       array_keys( $values ),
+                       "Correct keys in correct order"
+               );
+               $this->assertEquals( count( $ids ), $calls );
+
+               $cache->getMultiWithUnionSetCallback( $keyedIds, 10, $genFunc );
+               $this->assertEquals( count( $ids ), $calls, "Values cached" );
+       }
+
+       public static function getMultiWithUnionSetCallback_provider() {
+               return [
+                       [ [], false ],
+                       [ [ 'version' => 1 ], true ]
+               ];
+       }
+
        /**
         * @covers WANObjectCache::getWithSetCallback()
         * @covers WANObjectCache::doGetWithSetCallback()
index aacdb1a..81f0564 100644 (file)
@@ -6,13 +6,46 @@ use Wikimedia\ScopedCallback;
 class ParserOptionsTest extends MediaWikiTestCase {
 
        /**
-        * @dataProvider provideOptionsHash
+        * @dataProvider provideIsSafeToCache
+        * @param bool $expect Expected value
+        * @param array $options Options to set
+        */
+       public function testIsSafeToCache( $expect, $options ) {
+               $popt = ParserOptions::newCanonical();
+               foreach ( $options as $name => $value ) {
+                       $popt->setOption( $name, $value );
+               }
+               $this->assertSame( $expect, $popt->isSafeToCache() );
+       }
+
+       public static function provideIsSafeToCache() {
+               return [
+                       'No overrides' => [ true, [] ],
+                       'In-key options are ok' => [ true, [
+                               'editsection' => false,
+                               'thumbsize' => 1e100,
+                               'wrapclass' => false,
+                       ] ],
+                       'Non-in-key options are not ok' => [ false, [
+                               'removeComments' => false,
+                       ] ],
+                       'Canonical override, not default (1)' => [ true, [
+                               'tidy' => true,
+                       ] ],
+                       'Canonical override, not default (2)' => [ false, [
+                               'tidy' => false,
+                       ] ],
+               ];
+       }
+
+       /**
+        * @dataProvider provideOptionsHashPre30
         * @param array $usedOptions Used options
         * @param string $expect Expected value
         * @param array $options Options to set
         * @param array $globals Globals to set
         */
-       public function testOptionsHash( $usedOptions, $expect, $options, $globals = [] ) {
+       public function testOptionsHashPre30( $usedOptions, $expect, $options, $globals = [] ) {
                global $wgHooks;
 
                $globals += [
@@ -28,10 +61,10 @@ class ParserOptionsTest extends MediaWikiTestCase {
                foreach ( $options as $setter => $value ) {
                        $popt->$setter( $value );
                }
-               $this->assertSame( $expect, $popt->optionsHash( $usedOptions ) );
+               $this->assertSame( $expect, $popt->optionsHashPre30( $usedOptions ) );
        }
 
-       public static function provideOptionsHash() {
+       public static function provideOptionsHashPre30() {
                $used = [ 'wrapclass', 'editsection', 'printable' ];
 
                return [
@@ -57,13 +90,99 @@ class ParserOptionsTest extends MediaWikiTestCase {
                ];
        }
 
+       /**
+        * @dataProvider provideOptionsHash
+        * @param array $usedOptions Used options
+        * @param string $expect Expected value
+        * @param array $options Options to set
+        * @param array $globals Globals to set
+        */
+       public function testOptionsHash( $usedOptions, $expect, $options, $globals = [] ) {
+               global $wgHooks;
+
+               $globals += [
+                       'wgRenderHashAppend' => '',
+                       'wgHooks' => [],
+               ];
+               $globals['wgHooks'] += [
+                       'PageRenderingHash' => [],
+               ] + $wgHooks;
+               $this->setMwGlobals( $globals );
+
+               $popt = ParserOptions::newCanonical();
+               foreach ( $options as $name => $value ) {
+                       $popt->setOption( $name, $value );
+               }
+               $this->assertSame( $expect, $popt->optionsHash( $usedOptions ) );
+       }
+
+       public static function provideOptionsHash() {
+               $used = [ 'wrapclass', 'editsection', 'printable' ];
+
+               $classWrapper = TestingAccessWrapper::newFromClass( ParserOptions::class );
+               $classWrapper->getDefaults();
+               $allUsableOptions = array_diff(
+                       array_keys( $classWrapper->inCacheKey ),
+                       array_keys( $classWrapper->lazyOptions )
+               );
+
+               return [
+                       'Canonical options, nothing used' => [ [], 'canonical', [] ],
+                       'Canonical options, used some options' => [ $used, 'canonical', [] ],
+                       'Used some options, non-default values' => [
+                               $used,
+                               'printable=1!wrapclass=foobar',
+                               [
+                                       'wrapclass' => 'foobar',
+                                       'printable' => true,
+                               ]
+                       ],
+                       'Canonical options, used all non-lazy options' => [ $allUsableOptions, 'canonical', [] ],
+                       'Canonical options, nothing used, but with hooks and $wgRenderHashAppend' => [
+                               [],
+                               'canonical!wgRenderHashAppend!onPageRenderingHash',
+                               [],
+                               [
+                                       'wgRenderHashAppend' => '!wgRenderHashAppend',
+                                       'wgHooks' => [ 'PageRenderingHash' => [ [ __CLASS__ . '::onPageRenderingHash' ] ] ],
+                               ]
+                       ],
+               ];
+       }
+
        public static function onPageRenderingHash( &$confstr ) {
                $confstr .= '!onPageRenderingHash';
        }
 
+       /**
+        * @expectedException InvalidArgumentException
+        * @expectedExceptionMessage Unknown parser option bogus
+        */
+       public function testGetInvalidOption() {
+               $popt = ParserOptions::newCanonical();
+               $popt->getOption( 'bogus' );
+       }
+
+       /**
+        * @expectedException InvalidArgumentException
+        * @expectedExceptionMessage Unknown parser option bogus
+        */
+       public function testSetInvalidOption() {
+               $popt = ParserOptions::newCanonical();
+               $popt->setOption( 'bogus', true );
+       }
+
        public function testMatches() {
-               $popt1 = new ParserOptions();
-               $popt2 = new ParserOptions();
+               $classWrapper = TestingAccessWrapper::newFromClass( ParserOptions::class );
+               $oldDefaults = $classWrapper->defaults;
+               $oldLazy = $classWrapper->lazyOptions;
+               $reset = new ScopedCallback( function () use ( $classWrapper, $oldDefaults, $oldLazy ) {
+                       $classWrapper->defaults = $oldDefaults;
+                       $classWrapper->lazyOptions = $oldLazy;
+               } );
+
+               $popt1 = ParserOptions::newCanonical();
+               $popt2 = ParserOptions::newCanonical();
                $this->assertTrue( $popt1->matches( $popt2 ) );
 
                $popt1->enableLimitReport( true );
@@ -72,6 +191,17 @@ class ParserOptionsTest extends MediaWikiTestCase {
 
                $popt2->setTidy( !$popt2->getTidy() );
                $this->assertFalse( $popt1->matches( $popt2 ) );
+
+               $ctr = 0;
+               $classWrapper->defaults += [ __METHOD__ => null ];
+               $classWrapper->lazyOptions += [ __METHOD__ => function () use ( &$ctr ) {
+                       return ++$ctr;
+               } ];
+               $popt1 = ParserOptions::newCanonical();
+               $popt2 = ParserOptions::newCanonical();
+               $this->assertFalse( $popt1->matches( $popt2 ) );
+
+               ScopedCallback::consume( $reset );
        }
 
 }
index 0015486..f53cd06 100644 (file)
@@ -8,32 +8,32 @@ use Wikimedia\TestingAccessWrapper;
 class ResourceLoaderImageModuleTest extends ResourceLoaderTestCase {
 
        public static $commonImageData = [
-               'add' => 'add.gif',
-               'remove' => [
-                       'file' => 'remove.svg',
+               'abc' => 'abc.gif',
+               'def' => [
+                       'file' => 'def.svg',
                        'variants' => [ 'destructive' ],
                ],
-               'next' => [
+               'ghi' => [
                        'file' => [
-                               'ltr' => 'next.svg',
-                               'rtl' => 'prev.svg'
+                               'ltr' => 'ghi.svg',
+                               'rtl' => 'jkl.svg'
                        ],
                ],
-               'help' => [
+               'mno' => [
                        'file' => [
-                               'ltr' => 'help-ltr.svg',
-                               'rtl' => 'help-rtl.svg',
+                               'ltr' => 'mno-ltr.svg',
+                               'rtl' => 'mno-rtl.svg',
                                'lang' => [
-                                       'he' => 'help-ltr.svg',
+                                       'he' => 'mno-ltr.svg',
                                ]
                        ],
                ],
-               'bold' => [
+               'pqr' => [
                        'file' => [
-                               'default' => 'bold-a.svg',
+                               'default' => 'pqr-a.svg',
                                'lang' => [
-                                       'en' => 'bold-b.svg',
-                                       'ar,de' => 'bold-f.svg',
+                                       'en' => 'pqr-b.svg',
+                                       'ar,de' => 'pqr-f.svg',
                                ]
                        ],
                ]
@@ -64,37 +64,37 @@ class ResourceLoaderImageModuleTest extends ResourceLoaderTestCase {
                                        'variants' => self::$commonImageVariants,
                                        'images' => self::$commonImageData,
                                ],
-                               '.oo-ui-icon-add {
+                               '.oo-ui-icon-abc {
        ...
 }
-.oo-ui-icon-add-invert {
+.oo-ui-icon-abc-invert {
        ...
 }
-.oo-ui-icon-remove {
+.oo-ui-icon-def {
        ...
 }
-.oo-ui-icon-remove-invert {
+.oo-ui-icon-def-invert {
        ...
 }
-.oo-ui-icon-remove-destructive {
+.oo-ui-icon-def-destructive {
        ...
 }
-.oo-ui-icon-next {
+.oo-ui-icon-ghi {
        ...
 }
-.oo-ui-icon-next-invert {
+.oo-ui-icon-ghi-invert {
        ...
 }
-.oo-ui-icon-help {
+.oo-ui-icon-mno {
        ...
 }
-.oo-ui-icon-help-invert {
+.oo-ui-icon-mno-invert {
        ...
 }
-.oo-ui-icon-bold {
+.oo-ui-icon-pqr {
        ...
 }
-.oo-ui-icon-bold-invert {
+.oo-ui-icon-pqr-invert {
        ...
 }',
                        ],
@@ -107,37 +107,37 @@ class ResourceLoaderImageModuleTest extends ResourceLoaderTestCase {
                                        'variants' => self::$commonImageVariants,
                                        'images' => self::$commonImageData,
                                ],
-                               '.mw-ui-icon-add:after, .mw-ui-icon-add:before {
+                               '.mw-ui-icon-abc:after, .mw-ui-icon-abc:before {
        ...
 }
-.mw-ui-icon-add-invert:after, .mw-ui-icon-add-invert:before {
+.mw-ui-icon-abc-invert:after, .mw-ui-icon-abc-invert:before {
        ...
 }
-.mw-ui-icon-remove:after, .mw-ui-icon-remove:before {
+.mw-ui-icon-def:after, .mw-ui-icon-def:before {
        ...
 }
-.mw-ui-icon-remove-invert:after, .mw-ui-icon-remove-invert:before {
+.mw-ui-icon-def-invert:after, .mw-ui-icon-def-invert:before {
        ...
 }
-.mw-ui-icon-remove-destructive:after, .mw-ui-icon-remove-destructive:before {
+.mw-ui-icon-def-destructive:after, .mw-ui-icon-def-destructive:before {
        ...
 }
-.mw-ui-icon-next:after, .mw-ui-icon-next:before {
+.mw-ui-icon-ghi:after, .mw-ui-icon-ghi:before {
        ...
 }
-.mw-ui-icon-next-invert:after, .mw-ui-icon-next-invert:before {
+.mw-ui-icon-ghi-invert:after, .mw-ui-icon-ghi-invert:before {
        ...
 }
-.mw-ui-icon-help:after, .mw-ui-icon-help:before {
+.mw-ui-icon-mno:after, .mw-ui-icon-mno:before {
        ...
 }
-.mw-ui-icon-help-invert:after, .mw-ui-icon-help-invert:before {
+.mw-ui-icon-mno-invert:after, .mw-ui-icon-mno-invert:before {
        ...
 }
-.mw-ui-icon-bold:after, .mw-ui-icon-bold:before {
+.mw-ui-icon-pqr:after, .mw-ui-icon-pqr:before {
        ...
 }
-.mw-ui-icon-bold-invert:after, .mw-ui-icon-bold-invert:before {
+.mw-ui-icon-pqr-invert:after, .mw-ui-icon-pqr-invert:before {
        ...
 }',
                        ],
index 84b56d4..aea2776 100644 (file)
@@ -29,20 +29,20 @@ class ResourceLoaderImageTest extends ResourceLoaderTestCase {
 
        public static function provideGetPath() {
                return [
-                       [ 'add', 'en', 'add.gif' ],
-                       [ 'add', 'he', 'add.gif' ],
-                       [ 'remove', 'en', 'remove.svg' ],
-                       [ 'remove', 'he', 'remove.svg' ],
-                       [ 'next', 'en', 'next.svg' ],
-                       [ 'next', 'he', 'prev.svg' ],
-                       [ 'help', 'en', 'help-ltr.svg' ],
-                       [ 'help', 'ar', 'help-rtl.svg' ],
-                       [ 'help', 'he', 'help-ltr.svg' ],
-                       [ 'bold', 'en', 'bold-b.svg' ],
-                       [ 'bold', 'de', 'bold-f.svg' ],
-                       [ 'bold', 'ar', 'bold-f.svg' ],
-                       [ 'bold', 'fr', 'bold-a.svg' ],
-                       [ 'bold', 'he', 'bold-a.svg' ],
+                       [ 'abc', 'en', 'abc.gif' ],
+                       [ 'abc', 'he', 'abc.gif' ],
+                       [ 'def', 'en', 'def.svg' ],
+                       [ 'def', 'he', 'def.svg' ],
+                       [ 'ghi', 'en', 'ghi.svg' ],
+                       [ 'ghi', 'he', 'jkl.svg' ],
+                       [ 'mno', 'en', 'mno-ltr.svg' ],
+                       [ 'mno', 'ar', 'mno-rtl.svg' ],
+                       [ 'mno', 'he', 'mno-ltr.svg' ],
+                       [ 'pqr', 'en', 'pqr-b.svg' ],
+                       [ 'pqr', 'de', 'pqr-f.svg' ],
+                       [ 'pqr', 'ar', 'pqr-f.svg' ],
+                       [ 'pqr', 'fr', 'pqr-a.svg' ],
+                       [ 'pqr', 'he', 'pqr-a.svg' ],
                ];
        }
 
@@ -74,11 +74,11 @@ class ResourceLoaderImageTest extends ResourceLoaderTestCase {
         * @covers ResourceLoaderImage::getMimeType
         */
        public function testGetExtension() {
-               $image = $this->getTestImage( 'remove' );
+               $image = $this->getTestImage( 'def' );
                $this->assertEquals( $image->getExtension(), 'svg' );
                $this->assertEquals( $image->getExtension( 'original' ), 'svg' );
                $this->assertEquals( $image->getExtension( 'rasterized' ), 'png' );
-               $image = $this->getTestImage( 'add' );
+               $image = $this->getTestImage( 'abc' );
                $this->assertEquals( $image->getExtension(), 'gif' );
                $this->assertEquals( $image->getExtension( 'original' ), 'gif' );
                $this->assertEquals( $image->getExtension( 'rasterized' ), 'gif' );
@@ -92,9 +92,9 @@ class ResourceLoaderImageTest extends ResourceLoaderTestCase {
        public function testGetImageData() {
                $context = $this->getResourceLoaderContext();
 
-               $image = $this->getTestImage( 'remove' );
-               $data = file_get_contents( $this->imagesPath . '/remove.svg' );
-               $dataConstructive = file_get_contents( $this->imagesPath . '/remove_variantize.svg' );
+               $image = $this->getTestImage( 'def' );
+               $data = file_get_contents( $this->imagesPath . '/def.svg' );
+               $dataConstructive = file_get_contents( $this->imagesPath . '/def_variantize.svg' );
                $this->assertEquals( $image->getImageData( $context, null, 'original' ), $data );
                $this->assertEquals(
                        $image->getImageData( $context, 'destructive', 'original' ),
@@ -103,8 +103,8 @@ class ResourceLoaderImageTest extends ResourceLoaderTestCase {
                // Stub, since we don't know if we even have a SVG handler, much less what exactly it'll output
                $this->assertEquals( $image->getImageData( $context, null, 'rasterized' ), 'RASTERIZESTUB' );
 
-               $image = $this->getTestImage( 'add' );
-               $data = file_get_contents( $this->imagesPath . '/add.gif' );
+               $image = $this->getTestImage( 'abc' );
+               $data = file_get_contents( $this->imagesPath . '/abc.gif' );
                $this->assertEquals( $image->getImageData( $context, null, 'original' ), $data );
                $this->assertEquals( $image->getImageData( $context, null, 'rasterized' ), $data );
        }
@@ -113,9 +113,9 @@ class ResourceLoaderImageTest extends ResourceLoaderTestCase {
         * @covers ResourceLoaderImage::massageSvgPathdata
         */
        public function testMassageSvgPathdata() {
-               $image = $this->getTestImage( 'next' );
-               $data = file_get_contents( $this->imagesPath . '/next.svg' );
-               $dataMassaged = file_get_contents( $this->imagesPath . '/next_massage.svg' );
+               $image = $this->getTestImage( 'ghi' );
+               $data = file_get_contents( $this->imagesPath . '/ghi.svg' );
+               $dataMassaged = file_get_contents( $this->imagesPath . '/ghi_massage.svg' );
                $this->assertEquals( $image->massageSvgPathdata( $data ), $dataMassaged );
        }
 }
index 4e482c8..491fff6 100644 (file)
@@ -39,7 +39,7 @@ class ResourceLoaderOOUIImageModuleTest extends ResourceLoaderTestCase {
 
                $styles = $module->getStyles( $this->getResourceLoaderContext( [ 'skin' => 'fakemonobook' ] ) );
                $this->assertRegExp(
-                       '/magnifying-glass-apex/',
+                       '/stu-apex/',
                        $styles['all'],
                        'Generated styles use the non-default image (embed)'
                );
@@ -51,7 +51,7 @@ class ResourceLoaderOOUIImageModuleTest extends ResourceLoaderTestCase {
 
                $styles = $module->getStyles( $this->getResourceLoaderContext() );
                $this->assertRegExp(
-                       '/magnifying-glass-mediawiki/',
+                       '/stu-wikimediaui/',
                        $styles['all'],
                        'Generated styles use the default image (embed)'
                );