Merge "rdbms: split out private LoadBalancer::getServerInfoStrict method"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 24 Jun 2019 17:03:05 +0000 (17:03 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 24 Jun 2019 17:03:05 +0000 (17:03 +0000)
81 files changed:
RELEASE-NOTES-1.34
includes/AutoLoader.php
includes/GlobalFunctions.php
includes/Revision/RenderedRevision.php
includes/Revision/RevisionRenderer.php
includes/Storage/DerivedPageDataUpdater.php
includes/Storage/PageEditStash.php
includes/api/i18n/ar.json
includes/api/i18n/ja.json
includes/api/i18n/zh-hant.json
includes/installer/i18n/fa.json
includes/installer/i18n/io.json
includes/installer/i18n/ja.json
includes/libs/ParamValidator/Callbacks.php [new file with mode: 0644]
includes/libs/ParamValidator/ParamValidator.php [new file with mode: 0644]
includes/libs/ParamValidator/README.md [new file with mode: 0644]
includes/libs/ParamValidator/SimpleCallbacks.php [new file with mode: 0644]
includes/libs/ParamValidator/TypeDef.php [new file with mode: 0644]
includes/libs/ParamValidator/TypeDef/BooleanDef.php [new file with mode: 0644]
includes/libs/ParamValidator/TypeDef/EnumDef.php [new file with mode: 0644]
includes/libs/ParamValidator/TypeDef/FloatDef.php [new file with mode: 0644]
includes/libs/ParamValidator/TypeDef/IntegerDef.php [new file with mode: 0644]
includes/libs/ParamValidator/TypeDef/LimitDef.php [new file with mode: 0644]
includes/libs/ParamValidator/TypeDef/PasswordDef.php [new file with mode: 0644]
includes/libs/ParamValidator/TypeDef/PresenceBooleanDef.php [new file with mode: 0644]
includes/libs/ParamValidator/TypeDef/StringDef.php [new file with mode: 0644]
includes/libs/ParamValidator/TypeDef/TimestampDef.php [new file with mode: 0644]
includes/libs/ParamValidator/TypeDef/UploadDef.php [new file with mode: 0644]
includes/libs/ParamValidator/Util/UploadedFile.php [new file with mode: 0644]
includes/libs/ParamValidator/Util/UploadedFileStream.php [new file with mode: 0644]
includes/libs/ParamValidator/ValidationException.php [new file with mode: 0644]
includes/page/WikiPage.php
includes/parser/Parser.php
includes/parser/ParserOptions.php
includes/parser/ParserOutput.php
includes/skins/Skin.php
includes/skins/SkinTemplate.php
languages/i18n/ar.json
languages/i18n/as.json
languages/i18n/az.json
languages/i18n/bcc.json
languages/i18n/be-tarask.json
languages/i18n/ckb.json
languages/i18n/diq.json
languages/i18n/el.json
languages/i18n/eo.json
languages/i18n/exif/zh-hans.json
languages/i18n/fa.json
languages/i18n/fy.json
languages/i18n/hr.json
languages/i18n/hu.json
languages/i18n/io.json
languages/i18n/it.json
languages/i18n/ko.json
languages/i18n/lb.json
languages/i18n/lrc.json
languages/i18n/ml.json
languages/i18n/my.json
languages/i18n/nl.json
languages/i18n/nqo.json
languages/i18n/pl.json
tests/common/TestsAutoLoader.php
tests/phpunit/includes/GlobalFunctions/wfShellExecTest.php
tests/phpunit/includes/libs/ParamValidator/ParamValidatorTest.php [new file with mode: 0644]
tests/phpunit/includes/libs/ParamValidator/SimpleCallbacksTest.php [new file with mode: 0644]
tests/phpunit/includes/libs/ParamValidator/TypeDef/BooleanDefTest.php [new file with mode: 0644]
tests/phpunit/includes/libs/ParamValidator/TypeDef/EnumDefTest.php [new file with mode: 0644]
tests/phpunit/includes/libs/ParamValidator/TypeDef/FloatDefTest.php [new file with mode: 0644]
tests/phpunit/includes/libs/ParamValidator/TypeDef/IntegerDefTest.php [new file with mode: 0644]
tests/phpunit/includes/libs/ParamValidator/TypeDef/LimitDefTest.php [new file with mode: 0644]
tests/phpunit/includes/libs/ParamValidator/TypeDef/PasswordDefTest.php [new file with mode: 0644]
tests/phpunit/includes/libs/ParamValidator/TypeDef/PresenceBooleanDefTest.php [new file with mode: 0644]
tests/phpunit/includes/libs/ParamValidator/TypeDef/StringDefTest.php [new file with mode: 0644]
tests/phpunit/includes/libs/ParamValidator/TypeDef/TimestampDefTest.php [new file with mode: 0644]
tests/phpunit/includes/libs/ParamValidator/TypeDef/TypeDefTestCase.php [new file with mode: 0644]
tests/phpunit/includes/libs/ParamValidator/TypeDef/UploadDefTest.php [new file with mode: 0644]
tests/phpunit/includes/libs/ParamValidator/TypeDefTest.php [new file with mode: 0644]
tests/phpunit/includes/libs/ParamValidator/Util/UploadedFileStreamTest.php [new file with mode: 0644]
tests/phpunit/includes/libs/ParamValidator/Util/UploadedFileTest.php [new file with mode: 0644]
tests/phpunit/includes/libs/ParamValidator/Util/UploadedFileTestBase.php [new file with mode: 0644]
tests/phpunit/includes/shell/CommandTest.php

index f3baa52..5c0b57e 100644 (file)
@@ -229,6 +229,7 @@ because of Phabricator reports.
   \Maintenance::countDown() method instead.
 * OutputPage::wrapWikiMsg() no longer accepts an options parameter. This was
   deprecated since 1.20.
+* Skin::outputPage() no longer accepts a context. This was deprecated in 1.20.
 * …
 
 === Deprecations in 1.34 ===
index 57e4341..b893bc9 100644 (file)
@@ -143,6 +143,7 @@ class AutoLoader {
                        'MediaWiki\\Sparql\\' => __DIR__ . '/sparql/',
                        'MediaWiki\\Storage\\' => __DIR__ . '/Storage/',
                        'MediaWiki\\Tidy\\' => __DIR__ . '/tidy/',
+                       'Wikimedia\\ParamValidator\\' => __DIR__ . '/libs/ParamValidator/',
                        'Wikimedia\\Services\\' => __DIR__ . '/libs/services/',
                ];
        }
index c3829be..fed9234 100644 (file)
@@ -1882,10 +1882,9 @@ function wfTimestampOrNull( $outputtype = TS_UNIX, $ts = null ) {
 /**
  * Convenience function; returns MediaWiki timestamp for the present time.
  *
- * @return string
+ * @return string TS_MW timestamp
  */
 function wfTimestampNow() {
-       # return NOW
        return MWTimestamp::now( TS_MW );
 }
 
index c4a0054..4acb9c0 100644 (file)
@@ -291,19 +291,28 @@ class RenderedRevision implements SlotRenderingProvider {
 
                $this->setRevisionInternal( $rev );
 
-               $this->pruneRevisionSensitiveOutput( $this->revision->getId() );
+               $this->pruneRevisionSensitiveOutput(
+                       $this->revision->getId(),
+                       $this->revision->getTimestamp()
+               );
        }
 
        /**
         * Prune any output that depends on the revision ID.
         *
-        * @param int|bool  $actualRevId The actual rev id, to check the used speculative rev ID
+        * @param int|bool $actualRevId The actual rev id, to check the used speculative rev ID
         *        against, or false to not purge on vary-revision-id, or true to purge on
         *        vary-revision-id unconditionally.
+        * @param string|bool $actualRevTimestamp The actual rev timestamp, to check against the
+        *        parser output revision timestamp, or false to not purge on vary-revision-timestamp
         */
-       private function pruneRevisionSensitiveOutput( $actualRevId ) {
+       private function pruneRevisionSensitiveOutput( $actualRevId, $actualRevTimestamp ) {
                if ( $this->revisionOutput ) {
-                       if ( $this->outputVariesOnRevisionMetaData( $this->revisionOutput, $actualRevId ) ) {
+                       if ( $this->outputVariesOnRevisionMetaData(
+                               $this->revisionOutput,
+                               $actualRevId,
+                               $actualRevTimestamp
+                       ) ) {
                                $this->revisionOutput = null;
                        }
                } else {
@@ -311,7 +320,11 @@ class RenderedRevision implements SlotRenderingProvider {
                }
 
                foreach ( $this->slotsOutput as $role => $output ) {
-                       if ( $this->outputVariesOnRevisionMetaData( $output, $actualRevId ) ) {
+                       if ( $this->outputVariesOnRevisionMetaData(
+                               $output,
+                               $actualRevId,
+                               $actualRevTimestamp
+                       ) ) {
                                unset( $this->slotsOutput[$role] );
                        }
                }
@@ -372,19 +385,24 @@ class RenderedRevision implements SlotRenderingProvider {
        /**
         * @param ParserOutput $out
         * @param int|bool  $actualRevId The actual rev id, to check the used speculative rev ID
-        *        against, or false to not purge on vary-revision-id, or true to purge on
+        *        against, false to not purge on vary-revision-id, or true to purge on
         *        vary-revision-id unconditionally.
+        * @param string|bool $actualRevTimestamp The actual rev timestamp, to check against the
+        *        parser output revision timestamp, false to not purge on vary-revision-timestamp,
+        *        or true to purge on vary-revision-timestamp unconditionally.
         * @return bool
         */
-       private function outputVariesOnRevisionMetaData( ParserOutput $out, $actualRevId ) {
+       private function outputVariesOnRevisionMetaData(
+               ParserOutput $out,
+               $actualRevId,
+               $actualRevTimestamp
+       ) {
                $method = __METHOD__;
 
                if ( $out->getFlag( 'vary-revision' ) ) {
-                       // If {{PAGEID}} resolved to 0 or {{REVISIONTIMESTAMP}} used the current
-                       // timestamp rather than that of an actual revision, then those words need
-                       // to resolve to the actual page ID or revision timestamp, respectively.
+                       // If {{PAGEID}} resolved to 0, then that word need to resolve to the actual page ID
                        $this->saveParseLogger->info(
-                               "$method: Prepared output has vary-revision...\n"
+                               "$method: Prepared output has vary-revision..."
                        );
                        return true;
                } elseif ( $out->getFlag( 'vary-revision-id' )
@@ -392,7 +410,16 @@ class RenderedRevision implements SlotRenderingProvider {
                        && ( $actualRevId === true || $out->getSpeculativeRevIdUsed() !== $actualRevId )
                ) {
                        $this->saveParseLogger->info(
-                               "$method: Prepared output has vary-revision-id with wrong ID...\n"
+                               "$method: Prepared output has vary-revision-id with wrong ID..."
+                       );
+                       return true;
+               } elseif ( $out->getFlag( 'vary-revision-timestamp' )
+                       && $actualRevTimestamp !== false
+                       && ( $actualRevTimestamp === true ||
+                               $out->getRevisionTimestampUsed() !== $actualRevTimestamp )
+               ) {
+                       $this->saveParseLogger->info(
+                               "$method: Prepared output has vary-revision-timestamp with wrong timestamp..."
                        );
                        return true;
                } elseif ( $out->getFlag( 'vary-revision-exists' ) ) {
@@ -400,7 +427,7 @@ class RenderedRevision implements SlotRenderingProvider {
                        // Note that edit stashing always uses '-', which can be used for both
                        // edit filter checks and canonical parser cache.
                        $this->saveParseLogger->info(
-                               "$method: Prepared output has vary-revision-exists...\n"
+                               "$method: Prepared output has vary-revision-exists..."
                        );
                        return true;
                } else {
@@ -412,7 +439,7 @@ class RenderedRevision implements SlotRenderingProvider {
                        // constructs the ParserOptions: For a null-edit, setCurrentRevisionCallback is called
                        // with the old, existing revision.
 
-                       wfDebug( "$method: Keeping prepared output...\n" );
+                       $this->saveParseLogger->debug( "$method: Keeping prepared output..." );
                        return false;
                }
        }
index f97390a..a63e4f1 100644 (file)
@@ -132,6 +132,13 @@ class RevisionRenderer {
                        return $this->getSpeculativeRevId( $dbIndex );
                } );
 
+               if ( !$rev->getId() && $rev->getTimestamp() ) {
+                       // This is an unsaved revision with an already determined timestamp.
+                       // Make the "current" time used during parsing match that of the revision.
+                       // Any REVISION* parser variables will match up if the revision is saved.
+                       $options->setTimestamp( $rev->getTimestamp() );
+               }
+
                $title = Title::newFromLinkTarget( $rev->getPageAsLinkTarget() );
 
                $renderedRevision = new RenderedRevision(
index 0008ef7..b4d6f05 100644 (file)
@@ -52,6 +52,9 @@ use MWCallableUpdate;
 use ParserCache;
 use ParserOptions;
 use ParserOutput;
+use Psr\Log\LoggerAwareInterface;
+use Psr\Log\LoggerInterface;
+use Psr\Log\NullLogger;
 use RecentChangesUpdateJob;
 use ResourceLoaderWikiModule;
 use Revision;
@@ -94,7 +97,7 @@ use WikiPage;
  * @since 1.32
  * @ingroup Page
  */
-class DerivedPageDataUpdater implements IDBAccessObject {
+class DerivedPageDataUpdater implements IDBAccessObject, LoggerAwareInterface {
 
        /**
         * @var UserIdentity|null
@@ -136,6 +139,11 @@ class DerivedPageDataUpdater implements IDBAccessObject {
         */
        private $loadbalancerFactory;
 
+       /**
+        * @var LoggerInterface
+        */
+       private $logger;
+
        /**
         * @var string see $wgArticleCountMethod
         */
@@ -293,6 +301,11 @@ class DerivedPageDataUpdater implements IDBAccessObject {
                // XXX only needed for waiting for replicas to catch up; there should be a narrower
                // interface for that.
                $this->loadbalancerFactory = $loadbalancerFactory;
+               $this->logger = new NullLogger();
+       }
+
+       public function setLogger( LoggerInterface $logger ) {
+               $this->logger = $logger;
        }
 
        /**
@@ -850,11 +863,12 @@ class DerivedPageDataUpdater implements IDBAccessObject {
                if ( $stashedEdit ) {
                        /** @var ParserOutput $output */
                        $output = $stashedEdit->output;
-
                        // TODO: this should happen when stashing the ParserOutput, not now!
                        $output->setCacheTime( $stashedEdit->timestamp );
 
                        $renderHints['known-revision-output'] = $output;
+
+                       $this->logger->debug( __METHOD__ . ': using stashed edit output...' );
                }
 
                // NOTE: we want a canonical rendering, so don't pass $this->user or ParserOptions
index 9c2b3e7..2285f4a 100644 (file)
@@ -280,6 +280,12 @@ class PageEditStash {
                                "Cache for key '{key}' has vary_revision_id; post-insertion parse possible.",
                                $context
                        );
+               } elseif ( $editInfo->output->getFlag( 'vary-revision-timestamp' ) ) {
+                       // Similar to the above if we didn't guess the timestamp correctly.
+                       $logger->debug(
+                               "Cache for key '{key}' has vary_revision_timestamp; post-insertion parse possible.",
+                               $context
+                       );
                }
 
                return $editInfo;
index eadf3f7..8d7aaa3 100644 (file)
        "api-help-param-templated-var-first": "يجب استبدال <var>&#x7B;$1&#x7D;</var> في اسم الوسيط بقيم <var>$2</var>",
        "api-help-param-templated-var": "<var>&#x7B;$1&#x7D;</var> بقيم <var>$2</var>",
        "api-help-datatypes-header": "أنواع البيانات",
-       "api-help-datatypes": "Ù\8aجب Ø£Ù\86 Ù\8aÙ\83Ù\88Ù\86 Ø§Ù\84إدخاÙ\84 Ø¥Ù\84Ù\89 Ù\85Ù\8aدÙ\8aاÙ\88Ù\8aÙ\83Ù\8a Ù\87Ù\88 UTF-8 Ø§Ù\84Ù\85عÙ\8aÙ\8eÙ\91Ù\86 Ù\84Ù\80NFCØ\8c Ù\82د Ù\8aحاÙ\88Ù\84 Ù\85Ù\8aدÙ\8aاÙ\88Ù\8aÙ\83Ù\8a ØªØ­Ù\88Ù\8aÙ\84 Ù\85دخÙ\84ات Ø£Ø®Ø±Ù\89Ø\8c Ù\88Ù\84Ù\83Ù\86 Ù\82د Ù\8aتسبب Ø°Ù\84Ù\83 Ù\81Ù\8a Ù\81Ø´Ù\84 Ø¨Ø¹Ø¶ Ø§Ù\84عÙ\85Ù\84Ù\8aات (Ù\85Ø«Ù\84 [[Special:ApiHelp/edit|اÙ\84تعدÙ\8aÙ\84ات]] Ù\85ع Ø¹Ù\85Ù\84Ù\8aات Ù\81حص MD5).\n\nتحتاج Ø¨Ø¹Ø¶ Ø£Ù\86Ù\88اع Ø§Ù\84Ù\88سائط Ù\81Ù\8a Ø·Ù\84بات API Ø¥Ù\84Ù\89 Ù\85زÙ\8aد Ù\85Ù\86 Ø§Ù\84شرح:\n;Ù\85Ù\86Ø·Ù\82Ù\8aØ©\n:تعÙ\85Ù\84 Ø§Ù\84Ù\88سائط Ø§Ù\84Ù\85Ù\86Ø·Ù\82Ù\8aØ© Ù\85Ø«Ù\84 ØµÙ\86ادÙ\8aÙ\82 Ø§Ø®ØªÙ\8aار HTML: Ø¥Ø°Ø§ ØªÙ\85 ØªØ­Ø¯Ù\8aد Ø§Ù\84Ù\88سÙ\8aØ·Ø\8c Ø¨ØºØ¶ Ø§Ù\84Ù\86ظر Ø¹Ù\86 Ø§Ù\84Ù\82Ù\8aÙ\85Ø©Ø\8c Ù\81Ù\8aتÙ\85 Ø§Ø¹ØªØ¨Ø§Ø±Ù\87 ØµØ­Ù\8aحاØ\8c Ù\84Ù\84حصÙ\88Ù\84 Ø¹Ù\84Ù\89 Ù\82Ù\8aÙ\85Ø© Ø®Ø§Ø·Ø¦Ø©; Ø§Ø­Ø°Ù\81 Ø§Ù\84Ù\88سÙ\8aØ· ØªÙ\85اÙ\85ا.\n;اÙ\84طابع Ø§Ù\84زÙ\85Ù\86Ù\8a\n:Ù\82د Ù\8aتÙ\85 ØªØ­Ø¯Ù\8aد Ø§Ù\84Ø·Ù\88ابع Ø§Ù\84زÙ\85Ù\86Ù\8aØ© Ø¨ØªÙ\86سÙ\8aÙ\82ات Ù\85تعددةØ\8c Ù\8aÙ\8fÙ\88صÙ\8eÙ\89 Ø¨Ù\80ISO 8601 Ø§Ù\84تارÙ\8aØ® Ù\88اÙ\84Ù\88Ù\82تØ\8c Ø¬Ù\85Ù\8aع Ø§Ù\84Ø£Ù\88Ù\82ات Ø¨Ø§Ù\84تÙ\88Ù\82Ù\8aت Ø§Ù\84عاÙ\84Ù\85Ù\8a Ø§Ù\84Ù\85Ù\86سÙ\82Ø\8c Ù\8aتÙ\85 ØªØ¬Ø§Ù\87Ù\84 Ø£Ù\8aØ© Ù\85Ù\86Ø·Ù\82Ø© Ø²Ù\85Ù\86Ù\8aØ© Ù\85ضÙ\85Ù\86Ø©.\n:* ØªØ§Ø±Ù\8aØ® Ù\88Ù\88Ù\82ت ISO 8601Ø\8c <kbd><var>2001</var>-<var>01</var>-<var>15</var>T<var>14</var>:<var>56</var>:<var>00</var>Z</kbd> (عÙ\84اÙ\85ات Ø§Ù\84ترÙ\82Ù\8aÙ\85 Ù\88<kbd>Z</kbd> Ø§Ø®ØªÙ\8aارÙ\8aØ©)\n:* ØªØ§Ø±Ù\8aØ® Ù\88Ù\88Ù\82ت ISO 8601Ù\85ع Ø§Ù\84Ø«Ù\88اÙ\86Ù\8a Ø§Ù\84Ù\85جزأة (Ù\85تجاÙ\87Ù\84Ø©)Ø\8c <kbd><var>2001</var>-<var>01</var>-<var>15</var>T<var>14</var>:<var>56</var>:<var>00</var>.<var>00001</var>Z</kbd>  (اÙ\84شرطاتØ\8c Ù\88اÙ\84Ù\86Ù\82طتاÙ\86 Ø§Ù\84رأسÙ\8aتاÙ\86 Ø§Ø®ØªÙ\8aارÙ\8aØ© Ù\88<kbd>Z</kbd>)\n:* ØªÙ\86سÙ\8aÙ\82 Ù\85Ù\8aدÙ\8aاÙ\88Ù\8aÙ\83Ù\8aØ\8c <kbd><var>2001</var><var>01</var><var>15</var><var>14</var><var>56</var><var>00</var></kbd>\n:* ØªÙ\86سÙ\8aÙ\82 Ø±Ù\82Ù\85Ù\8a Ø¹Ø§Ù\85Ø\8c (تÙ\88Ù\82Ù\8aت Ø§Ø®ØªÙ\8aارÙ\8aØ\8c Ø£Ù\88 Ù\8aتÙ\85 ØªØ¬Ø§Ù\87Ù\84) <kbd><var>2001</var>-<var>01</var>-<var>15</var> <var>14</var>:<var>56</var>:<var>00</var></kbd> (Ù\85Ù\86Ø·Ù\82Ø© Ø²Ù\85Ù\86Ù\8aØ© Ø§Ø®ØªÙ\8aارÙ\8aØ© Ù\84Ù\80<kbd>GMT</kbd>Ø\8c <kbd>+<var>##</var></kbd>Ø\8c Ø£Ù\88 Ù\8aتÙ\85 ØªØ¬Ø§Ù\87Ù\84 <kbd>-<var>##</var></kbd>)\n:* ØªÙ\86سÙ\8aÙ\82 EXIFØ\8c <kbd><var>2001</var>:<var>01</var>:<var>15</var> <var>14</var>:<var>56</var>:<var>00</var></kbd>\n:*تÙ\86سÙ\8aÙ\82 RFC 2822 (Ù\82د Ù\8aتÙ\85 Ø­Ø°Ù\81 Ø§Ù\84Ù\85Ù\86Ø·Ù\82Ø© Ø§Ù\84زÙ\85Ù\86Ù\8aØ©)Ø\8c <kbd><var>Mon</var>, <var>15</var> <var>Jan</var> <var>2001</var> <var>14</var>:<var>56</var>:<var>00</var></kbd>\n:*تÙ\86سÙ\8aÙ\82 RFC 850 format (Ù\82د Ù\8aتÙ\85 Ø­Ø°Ù\81 Ø§Ù\84Ù\85Ù\86Ø·Ù\82Ø© Ø§Ù\84زÙ\85Ù\86Ù\8aØ©)Ø\8c <kbd><var>Monday</var>, <var>15</var>-<var>Jan</var>-<var>2001</var> <var>14</var>:<var>56</var>:<var>00</var></kbd>\n:* ØªÙ\86سÙ\8aÙ\82 C ctime format, <kbd><var>Mon</var> <var>Jan</var> <var>15</var> <var>14</var>:<var>56</var>:<var>00</var> <var>2001</var></kbd>\n:* Ø§Ù\84Ø«Ù\88اÙ\86Ù\8a Ù\85Ù\86Ø° 1970-01-01T00:00:00Z Ù\83عدد ØµØ­Ù\8aØ­ Ù\8aتراÙ\88Ø­ Ø¨Ù\8aÙ\86 1 Ù\8813 (باستثÙ\86اء <kbd>0</kbd>)\n:* Ø§Ù\84سÙ\84سÙ\84Ø© <kbd>now</kbd>\n;فاصل بديل متعدد القيم\n:يتم عادةً إرسال الوسائط التي تأخذ قيم متعددة مع القيم المفصولة باستخدام حرف الأنبوب، على سبيل المثال <kbd>param=value1|value2</kbd> or <kbd>param=value1%7Cvalue2</kbd> إذا كانت القيمة يجب أن تحتوي على حرف الأنبوب، فاستخدم U+001F (فاصل الوحدة) مثل الفاصل ''و'' بادئة القيمة بـU+001F، على سبيل المثال <kbd>param=%1Fvalue1%1Fvalue2</kbd>.",
+       "api-help-datatypes": "Ù\8aجب Ø£Ù\86 Ù\8aÙ\83Ù\88Ù\86 Ø§Ù\84إدخاÙ\84 Ø¥Ù\84Ù\89 Ù\85Ù\8aدÙ\8aاÙ\88Ù\8aÙ\83Ù\8a Ù\87Ù\88 UTF-8 Ø§Ù\84Ù\85عÙ\8aÙ\8eÙ\91Ù\86 Ù\84Ù\80NFCØ\8c Ù\82د Ù\8aحاÙ\88Ù\84 Ù\85Ù\8aدÙ\8aاÙ\88Ù\8aÙ\83Ù\8a ØªØ­Ù\88Ù\8aÙ\84 Ù\85دخÙ\84ات Ø£Ø®Ø±Ù\89Ø\8c Ù\88Ù\84Ù\83Ù\86 Ù\82د Ù\8aتسبب Ø°Ù\84Ù\83 Ù\81Ù\8a Ù\81Ø´Ù\84 Ø¨Ø¹Ø¶ Ø§Ù\84عÙ\85Ù\84Ù\8aات (Ù\85Ø«Ù\84 [[Special:ApiHelp/edit|اÙ\84تعدÙ\8aÙ\84ات]] Ù\85ع Ø¹Ù\85Ù\84Ù\8aات Ù\81حص MD5).\n\nتحتاج Ø¨Ø¹Ø¶ Ø£Ù\86Ù\88اع Ø§Ù\84Ù\88سائط Ù\81Ù\8a Ø·Ù\84بات API Ø¥Ù\84Ù\89 Ù\85زÙ\8aد Ù\85Ù\86 Ø§Ù\84شرح:\n;Ù\85Ù\86Ø·Ù\82Ù\8aØ©\n:تعÙ\85Ù\84 Ø§Ù\84Ù\88سائط Ø§Ù\84Ù\85Ù\86Ø·Ù\82Ù\8aØ© Ù\85Ø«Ù\84 ØµÙ\86ادÙ\8aÙ\82 Ø§Ø®ØªÙ\8aار HTML: Ø¥Ø°Ø§ ØªÙ\85 ØªØ­Ø¯Ù\8aد Ø§Ù\84Ù\88سÙ\8aØ·Ø\8c Ø¨ØºØ¶ Ø§Ù\84Ù\86ظر Ø¹Ù\86 Ø§Ù\84Ù\82Ù\8aÙ\85Ø©Ø\8c Ù\81Ù\8aتÙ\85 Ø§Ø¹ØªØ¨Ø§Ø±Ù\87 ØµØ­Ù\8aحاØ\8c Ù\84Ù\84حصÙ\88Ù\84 Ø¹Ù\84Ù\89 Ù\82Ù\8aÙ\85Ø© Ø®Ø§Ø·Ø¦Ø©; Ø§Ø­Ø°Ù\81 Ø§Ù\84Ù\88سÙ\8aØ· ØªÙ\85اÙ\85ا.\n;اÙ\84طابع Ø§Ù\84زÙ\85Ù\86Ù\8a\n:Ù\8aÙ\85Ù\83Ù\86 ØªØ­Ø¯Ù\8aد Ø§Ù\84Ø·Ù\88ابع Ø§Ù\84زÙ\85Ù\86Ù\8aØ© Ø¨ØªÙ\86سÙ\8aÙ\82ات Ù\85تعددةØ\8c Ø±Ø§Ø¬Ø¹ [[mw:Special:MyLanguage/Timestamp|تÙ\86سÙ\8aÙ\82ات Ø¥Ø¯Ø®Ø§Ù\84 Ù\85Ù\83تبة Ø§Ù\84طابع Ø§Ù\84زÙ\85Ù\86Ù\8a Ø§Ù\84Ù\85Ù\88Ø«Ù\82Ø© Ø¹Ù\84Ù\89 mediawiki.org]] Ù\84Ù\84تÙ\81اصÙ\8aÙ\84Ø\8c Ù\8aÙ\8fÙ\88صÙ\8eÙ\89 Ø¨ØªØ§Ø±Ù\8aØ® ISO 8601 Ù\88Ù\88Ù\82ت: <kbd><var>2001</var>-<var>01</var>-<var>15</var>T<var>14</var>:<var>56</var>:<var>00</var>Z</kbd>Ø\8c Ø¨Ø§Ù\84إضاÙ\81Ø© Ø¥Ù\84Ù\89 Ø°Ù\84Ù\83Ø\8c Ù\8aÙ\85Ù\83Ù\86 Ø§Ø³ØªØ®Ø¯Ø§Ù\85 Ø§Ù\84سÙ\84سÙ\84Ø© <kbd>now</kbd> Ù\84تحدÙ\8aد Ø§Ù\84طابع Ø§Ù\84زÙ\85Ù\86Ù\8a Ø§Ù\84حاÙ\84Ù\8a.\n;فاصل بديل متعدد القيم\n:يتم عادةً إرسال الوسائط التي تأخذ قيم متعددة مع القيم المفصولة باستخدام حرف الأنبوب، على سبيل المثال <kbd>param=value1|value2</kbd> or <kbd>param=value1%7Cvalue2</kbd> إذا كانت القيمة يجب أن تحتوي على حرف الأنبوب، فاستخدم U+001F (فاصل الوحدة) مثل الفاصل ''و'' بادئة القيمة بـU+001F، على سبيل المثال <kbd>param=%1Fvalue1%1Fvalue2</kbd>.",
        "api-help-templatedparams-header": "وسائط القالب",
        "api-help-templatedparams": "تدعم وسائط القوالب الحالات التي تحتاج فيها API إلى قيمة لكل قيمة من وسيط آخر، على سبيل المثال، إذا كانت هناك وحدة API لطلب الفاكهة، فإنه قد يكون لديك وسيط <var>fruits</var>  لتحديد أي الفواكه تم طلبها ووسيط قالب <var>{fruit}-quantity</var>لتحديد عدد الفواكه لكل طلب، يمكن لعميل API الذي يريد 1 تفاحة، 5 موز، 20 فراولة ثم تقديم طلب مثل <kbd>fruits=apples|bananas|strawberries&apples-quantity=1&bananas-quantity=5&strawberries-quantity=20</kbd>.",
        "api-help-param-type-limit": "النوع: عدد صحيح أو <kbd>max</kbd>",
index 70fa9da..a7ff703 100644 (file)
@@ -14,7 +14,8 @@
                        "ネイ",
                        "Omotecho",
                        "Yusuke1109",
-                       "Suyama"
+                       "Suyama",
+                       "Yuukin0248"
                ]
        },
        "apihelp-main-extended-description": "<div class=\"hlist plainlinks api-main-links\">\n* [[mw:Special:MyLanguage/API:Main_page|説明文書]]\n* [[mw:Special:MyLanguage/API:FAQ|よくある質問]]\n* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-api メーリングリスト]\n* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce API 告知]\n* [https://phabricator.wikimedia.org/maniphest/query/GebfyV4uCaLd/#R バグの報告とリクエスト]\n</div>\n<strong>状態:</strong> MediaWiki APIは、積極的にサポートされ、改善された成熟した安定したインターフェースです。避けようとはしていますが、時には壊れた変更が加えられるかもしれません。アップデートの通知を受け取るには、[https://lists.wikimedia.org/pipermail/mediawiki-api-announce/ the mediawiki-api-announce メーリングリスト]に参加してください。\n\n<strong>誤ったリクエスト:</strong> 誤ったリクエストが API に送られた場合、\"MediaWiki-API-Error\" HTTP ヘッダーが送信され、そのヘッダーの値と送り返されるエラーコードは同じ値にセットされます。より詳しい情報は [[mw:Special:MyLanguage/API:Errors_and_warnings|API: Errors and warnings]] を参照してください。\n\n<p class=\"mw-apisandbox-link\"><strong>テスト:</strong> API のリクエストのテストは、[[Special:ApiSandbox]]で簡単に行えます。</p>",
@@ -45,6 +46,8 @@
        "apihelp-block-param-watchuser": "その利用者またはIPアドレスの利用者ページとトークページをウォッチします。",
        "apihelp-block-param-tags": "ブロック記録の項目に適用する変更タグ。",
        "apihelp-block-param-partial": "サイト全体ではなく特定のページまたは名前空間での編集をブロックします。",
+       "apihelp-block-param-pagerestrictions": "利用者が編集できないようにするページのタイトルのリスト。<var>partial</var> に true が設定されている場合のみ適用します。",
+       "apihelp-block-param-namespacerestrictions": "利用者が編集できないようにする名前空間のID。<var>partial</var> に true が設定されている場合のみ適用します。",
        "apihelp-block-example-ip-simple": "IPアドレス <kbd>192.0.2.5</kbd> を <kbd>First strike<kbd> という理由で3日ブロックする",
        "apihelp-block-example-user-complex": "利用者 <kbd>Vandal</kbd> を <kbd>Vandalism</kbd> という理由で無期限ブロックし、新たなアカウント作成とメールの送信を禁止する。",
        "apihelp-changeauthenticationdata-summary": "現在の利用者の認証データを変更します。",
        "apihelp-edit-param-text": "ページの本文。",
        "apihelp-edit-param-summary": "編集の要約。$1section=new で $1sectiontitle が設定されていない場合は節名としても利用されます。",
        "apihelp-edit-param-tags": "この版に適用する変更タグ。",
-       "apihelp-edit-param-minor": "細部の編集",
+       "apihelp-edit-param-minor": "この編集に細部の変更の印を付ける",
        "apihelp-edit-param-notminor": "細部の編集ではない。",
        "apihelp-edit-param-bot": "この編集をボットの編集としてマークする。",
        "apihelp-edit-param-basetimestamp": "編集前の版のタイムスタンプ。編集競合を検出するために使用されます。\n[[Special:ApiHelp/query+revisions|action=query&prop=revisions&rvprop=timestamp]] で取得できます。",
        "apihelp-query+tags-paramvalue-prop-description": "タグの説明を追加します。",
        "apihelp-query+tags-paramvalue-prop-hitcount": "版の記録項目の数と、このタグを持っている記録項目の数を、追加します。",
        "apihelp-query+tags-example-simple": "利用可能なタグを一覧表示する。",
-       "apihelp-query+templates-summary": "与えられたページでトランスクルードされているすべてのページを返します。",
+       "apihelp-query+templates-summary": "与えられたページで参照読み込みされているすべてのページを返します。",
        "apihelp-query+templates-param-namespace": "この名前空間のテンプレートのみ表示する。",
        "apihelp-query+templates-param-limit": "返すテンプレートの数。",
        "apihelp-query+templates-param-dir": "昇順・降順の別。",
        "apihelp-query+templates-example-simple": "<kbd>Main Page</kbd> で使用されているテンプレートを取得する。",
        "apihelp-query+templates-example-generator": "<kbd>Main Page</kbd> で使用されているテンプレートに関する情報を取得する。",
-       "apihelp-query+templates-example-namespaces": "<kbd>Main Page</kbd> でトランスクルードされている {{ns:user}} および {{ns:template}} 名前空間のページを取得する。",
+       "apihelp-query+templates-example-namespaces": "<kbd>Main Page</kbd> で参照読み込みされている {{ns:user}} および {{ns:template}} 名前空間のページを取得する。",
        "apihelp-query+tokens-summary": "データ変更操作用のトークンを取得します。",
        "apihelp-query+tokens-param-type": "リクエストするトークンの種類。",
        "apihelp-query+tokens-example-simple": "csrfトークンを取得する (既定)。",
        "apihelp-query+tokens-example-types": "ウォッチトークンおよび巡回トークンを取得する。",
-       "apihelp-query+transcludedin-summary": "与えられたページをトランスクルードしているすべてのページを検索します。",
+       "apihelp-query+transcludedin-summary": "与えられたページを参照読み込みしているすべてのページを検索します。",
        "apihelp-query+transcludedin-param-prop": "取得するプロパティ:",
        "apihelp-query+transcludedin-paramvalue-prop-pageid": "各ページのページID。",
        "apihelp-query+transcludedin-paramvalue-prop-title": "各ページのページ名。",
        "apihelp-query+transcludedin-paramvalue-prop-redirect": "ページがリダイレクトである場合マークします。",
        "apihelp-query+transcludedin-param-namespace": "この名前空間に含まれるページのみを一覧表示します。",
        "apihelp-query+transcludedin-param-limit": "返す数。",
-       "apihelp-query+transcludedin-example-simple": "<kbd>Main Page</kbd> をトランスクルードしているページの一覧を取得する。",
+       "apihelp-query+transcludedin-example-simple": "<kbd>Main Page</kbd> を参照読み込みしているページの一覧を取得する。",
        "apihelp-query+transcludedin-example-generator": "<kbd>Main Page</kbd> を参照読み込みしているページに関する情報を取得する。",
        "apihelp-query+usercontribs-summary": "利用者によるすべての編集を取得します。",
        "apihelp-query+usercontribs-param-limit": "返す投稿記録の最大数。",
index a1d7cb9..9647675 100644 (file)
        "apihelp-query+langlinks-param-dir": "列出時所採用的方向。",
        "apihelp-query+langlinks-param-inlanguagecode": "用於本地化語言名稱的語言代碼。",
        "apihelp-query+langlinks-example-simple": "從頁面 <kbd>Main Page</kbd> 取得跨語言連結。",
+       "apihelp-query+languageinfo-paramvalue-prop-bcp47": "BCP-47 語言代碼。",
+       "apihelp-query+languageinfo-paramvalue-prop-autonym": "語言的本語稱呼,也就是該語言用自己語言本身寫出的名稱。",
+       "apihelp-query+languageinfo-example-simple": "取得所有支援語言的語言代碼。",
+       "apihelp-query+languageinfo-example-autonym-name-de": "取得所有支援語言的本語稱呼和德語名稱。",
        "apihelp-query+links-summary": "回傳指定頁面的所有連結。",
        "apihelp-query+links-param-namespace": "僅顯示在這些命名空間的連結。",
        "apihelp-query+links-param-limit": "要回傳的連結數量。",
index b17b093..daa4de9 100644 (file)
        "config-install-stats": "شروع آمار",
        "config-install-keys": "تولید کلیدهای مخفی",
        "config-install-updates": "جلوگیری از به روز رسانی‌های غیر ضروری در حال اجرا",
-       "config-install-updates-failed": "<strong>خطا:</strong> قراردادن کلیدهای به روز رسانی به داخل جداول با خطای روبرو مواجه شد: $1",
+       "config-install-updates-failed": "<strong>خطا:</strong> قرار دادن کلیدهای روزآمدسازی در جدول‌ها با شکست و این خطا مواجه شد: $1",
        "config-install-sysop": "ایجاد حساب کاربری مدیر",
        "config-install-subscribe-fail": "قادر تصدیق اعلام مدیاویکی نیست:$1",
        "config-install-subscribe-notpossible": "سی‌یوآر‌ال نصب نشده‌است و <code>allow_url_fopen</code> در دسترس نیست.",
index eb3042b..f1e441b 100644 (file)
@@ -10,6 +10,8 @@
        "config-title": "Instalo di MediaWiki $1",
        "config-information": "Informo",
        "config-localsettings-upgrade": "L'arkivo <code>LocalSettings.php</code> trovesis.\nPor plubonigar l'instaluro, voluntez informar la valoro dil  <code>$wgUpgradeKey</code> en l'infra buxo.\nVu trovos ol en <code>LocalSettings.php</code>.",
+       "config-session-error": "Eroro dum komenco di seciono: $1",
+       "config-session-expired": "Vua sesiono probable finis.\nSesioni programesis por durar $1\nVu povas augmentar to per modifiko di <code>session.gc_maxlifetime</code> en php.ini.\nRikomencez l'instalo-procedo.",
        "config-your-language": "Vua idiomo:",
        "config-your-language-help": "Selektez l'idiomo por uzar dum l'instalo-procedo.",
        "config-wiki-language": "Wiki linguo:",
        "config-env-php": "PHP $1 instalesis.",
        "config-env-hhvm": "HHVM $1 instalesis.",
        "config-unicode-pure-php-warning": "<strong>Atencez:</strong> La [https://php.net/manual/en/book.intl.php prolonguro PHP intl] ne esas disponebla por traktar skribo-normaligo \"Unicode\". Vice, uzesas la plu lenta laborado en pura PHP.\nSe vu administras pagini multe vizitata, vu mustas lektar la [https://www.mediawiki.org/wiki/Special:MyLanguage/Unicode_normalization_considerations skribo-normaligo Unicode].",
+       "config-memory-raised": "Parametro <code>memory_limit</code> esas $1, modifikata a $2.",
+       "config-memory-bad": "<strong>Atences:</strong> la limito por PHP <code>memory_limit</code> esas $1.\nTo probable esas nesuficanta.\nL'instalo-procedo povas faliar!",
        "config-apc": "[https://www.php.net/apc APC] instalesis",
        "config-apcu": "[https://www.php.net/apcu APCu] instalesis",
+       "config-wincache": "[https://www.iis.net/downloads/microsoft/wincache-extension WinCache] instalesis",
+       "config-using-uri": "Ret-adreso (URL) dil servero \"<nowiki>$1$2</nowiki>\".",
+       "config-db-wiki-settings": "Identifikez ca wiki",
+       "config-db-name": "Nomo dil datumaro (sen strekteti):",
+       "config-db-install-account": "Konto dil uzero por instalo",
+       "config-db-username": "Uzero-nomo dil datumaro:",
+       "config-db-password": "Pasovorto dil datumaro:",
+       "config-type-mssql": "Microsoft SQL Server",
+       "config-header-oracle": "Ajusti por Oracle-sistemo:",
+       "config-header-mssql": "Ajusti por Microsoft SQL Server",
+       "config-invalid-db-type": "Nevalida tipo di datumaro.",
+       "config-mysql-myisam": "MyISAM",
+       "config-ns-generic": "Projeto",
+       "config-ns-site-name": "Sama kam la wiki-nomo: $1",
+       "config-ns-other": "Altra (definez precise)",
+       "config-ns-other-default": "MyWiki",
+       "config-admin-name": "Vua uzero-nomo:",
+       "config-admin-password": "Pasovorto:",
+       "config-admin-password-confirm": "Riskribez la pasovorto:",
+       "config-admin-email": "E-postal adreso:",
+       "config-profile-wiki": "Aperta wiki",
+       "config-profile-no-anon": "Bezonas krear konto",
+       "config-profile-fishbowl": "Nur permisata redakteri",
        "config-profile-private": "Privata wiki",
+       "config-profile-help": "Wikis work best when you let as many people edit them as possible.\nIn MediaWiki, it is easy to review the recent changes, and to revert any damage that is done by naive or malicious users.\n\nHowever, many have found MediaWiki to be useful in a wide variety of roles, and sometimes it is not easy to convince everyone of the benefits of the wiki way.\nSo you have the choice.\n\nThe <strong>{{int:config-profile-wiki}}</strong> model allows anyone to edit, without even logging in.\nA wiki with <strong>{{int:config-profile-no-anon}}</strong> provides extra accountability, but may deter casual contributors.\n\nThe <strong>{{int:config-profile-fishbowl}}</strong> scenario allows approved users to edit, but the public can view the pages, including history.\nA <strong>{{int:config-profile-private}}</strong> only allows approved users to view pages, with the same group allowed to edit.\n\nMore complex user rights configurations are available after installation, see the [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:User_rights relevant manual entry].",
        "config-license": "Autoroyuro e permiso:",
        "config-license-cc-0": "Creative Commons Zero (Publika domeno)",
+       "config-license-pd": "Publika domeno",
        "config-install-step-done": "Facita",
        "config-install-step-failed": "faliis",
        "config-install-extensions": "Komplementi inkluzita",
index 934c7c6..ec17b0b 100644 (file)
@@ -75,7 +75,7 @@
        "config-unicode-pure-php-warning": "<strong>警告:</strong> Unicode 正規化の処理に[https://php.net/manual/en/book.intl.php PHP intl 拡張機能]を利用できないため、処理が遅いピュア PHP の実装を代わりに使用しています。\n高トラフィックのサイトを運営する場合、[https://www.mediawiki.org/wiki/Special:MyLanguage/Unicode_normalization_considerations Unicode 正規化]は必ず読むよう推奨されます。",
        "config-unicode-update-warning": "<strong>警告:</strong> インストールされているバージョンの Unicode 正規化ラッパーは、[http://site.icu-project.org/ ICU プロジェクト]のライブラリの古いバージョンを使用しています。\nUnicode を少しでも利用する可能性がある場合は、[https://www.mediawiki.org/wiki/Special:MyLanguage/Unicode_normalization_considerations アップグレード]してください。",
        "config-no-db": "適切なデータベース ドライバーが見つかりませんでした! PHP にデータベース ドライバーをインストールする必要があります。\n以下の種類のデータベース{{PLURAL:$2|のタイプ}}に対応しています: $1\n\nPHP を自分でコンパイルした場合は、例えば <code>./configure --with-mysqli</code> を実行して、データベース クライアントを使用できるように再設定してください。\nDebian または Ubuntu のパッケージから PHP をインストールした場合は、モジュール (例: <code>php-mysql</code>) もインストールする必要があります。",
-       "config-outdated-sqlite": "<strong>警告:</strong> あなたは SQLite $1 を使用していますが、最低限必要なバージョン $2 より古いバージョンです。SQLite は利用できません。",
+       "config-outdated-sqlite": "<strong>警告:</strong> ご利用の SQLite $2 は容認されている最古の版 $1 よりも古い版です。SQLite が対応しません。",
        "config-no-fts3": "<strong>警告:</strong> SQLite は [//sqlite.org/fts3.html FTS3] モジュールなしでコンパイルされており、このバックエンドでは検索機能は利用できなくなります。",
        "config-pcre-old": "<strong>致命的エラー:</strong> PCRE $1 以降が必要です。\nご使用中の PHP のバイナリは PCRE $2 とリンクされています。\n[https://www.mediawiki.org/wiki/Manual:Errors_and_symptoms/PCRE 詳細情報]",
        "config-pcre-no-utf8": "<strong>致命的エラー:</strong> PHP の PCRE が PCRE_UTF8 対応なしでコンパイルされているようです。\nMediaWiki を正しく動作させるには、UTF-8 対応が必要です。",
diff --git a/includes/libs/ParamValidator/Callbacks.php b/includes/libs/ParamValidator/Callbacks.php
new file mode 100644 (file)
index 0000000..d94a81f
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+
+namespace Wikimedia\ParamValidator;
+
+use Psr\Http\Message\UploadedFileInterface;
+
+/**
+ * Interface defining callbacks needed by ParamValidator
+ *
+ * The user of ParamValidator is expected to pass an object implementing this
+ * interface to ParamValidator's constructor.
+ *
+ * All methods in this interface accept an "options array". This is the same `$options`
+ * passed to ParamValidator::getValue(), ParamValidator::validateValue(), and the like
+ * and is intended for communication of non-global state.
+ *
+ * @since 1.34
+ */
+interface Callbacks {
+
+       /**
+        * Test if a parameter exists in the request
+        * @param string $name Parameter name
+        * @param array $options Options array
+        * @return bool True if present, false if absent.
+        *  Return false for file upload parameters.
+        */
+       public function hasParam( $name, array $options );
+
+       /**
+        * Fetch a value from the request
+        *
+        * Return `$default` for file-upload parameters.
+        *
+        * @param string $name Parameter name to fetch
+        * @param mixed $default Default value to return if the parameter is unset.
+        * @param array $options Options array
+        * @return string|string[]|mixed A string or string[] if the parameter was found,
+        *  or $default if it was not.
+        */
+       public function getValue( $name, $default, array $options );
+
+       /**
+        * Test if a parameter exists as an upload in the request
+        * @param string $name Parameter name
+        * @param array $options Options array
+        * @return bool True if present, false if absent.
+        */
+       public function hasUpload( $name, array $options );
+
+       /**
+        * Fetch data for a file upload
+        * @param string $name Parameter name of the upload
+        * @param array $options Options array
+        * @return UploadedFileInterface|null Uploaded file, or null if there is no file for $name.
+        */
+       public function getUploadedFile( $name, array $options );
+
+       /**
+        * Record non-fatal conditions.
+        * @param ValidationException $condition
+        * @param array $options Options array
+        */
+       public function recordCondition( ValidationException $condition, array $options );
+
+       /**
+        * Indicate whether "high limits" should be used.
+        *
+        * Some settings have multiple limits, one for "normal" users and a higher
+        * one for "privileged" users. This is used to determine which class the
+        * current user is in when necessary.
+        *
+        * @param array $options Options array
+        * @return bool Whether the current user is privileged to use high limits
+        */
+       public function useHighLimits( array $options );
+
+}
diff --git a/includes/libs/ParamValidator/ParamValidator.php b/includes/libs/ParamValidator/ParamValidator.php
new file mode 100644 (file)
index 0000000..1085375
--- /dev/null
@@ -0,0 +1,522 @@
+<?php
+
+namespace Wikimedia\ParamValidator;
+
+use DomainException;
+use InvalidArgumentException;
+use Wikimedia\Assert\Assert;
+use Wikimedia\ObjectFactory;
+
+/**
+ * Service for formatting and validating API parameters
+ *
+ * A settings array is simply an array with keys being the relevant PARAM_*
+ * constants from this class, TypeDef, and its subclasses.
+ *
+ * As a general overview of the architecture here:
+ *  - ParamValidator handles some general validation of the parameter,
+ *    then hands off to a TypeDef subclass to validate the specific representation
+ *    based on the parameter's type.
+ *  - TypeDef subclasses handle conversion between the string representation
+ *    submitted by the client and the output PHP data types, validating that the
+ *    strings are valid representations of the intended type as they do so.
+ *  - ValidationException is used to report fatal errors in the validation back
+ *    to the caller, since the return value represents the successful result of
+ *    the validation and might be any type or class.
+ *  - The Callbacks interface allows ParamValidator to reach out and fetch data
+ *    it needs to perform the validation. Currently that includes:
+ *    - Fetching the value of the parameter being validated (largely since a generic
+ *      caller cannot know whether it needs to fetch a string from $_GET/$_POST or
+ *      an array from $_FILES).
+ *    - Reporting of non-fatal warnings back to the caller.
+ *    - Fetching the "high limits" flag when necessary, to avoid the need for loading
+ *      the user unnecessarily.
+ *
+ * @since 1.34
+ */
+class ParamValidator {
+
+       /**
+        * @name Constants for parameter settings arrays
+        * These constants are keys in the settings array that define how the
+        * parameters coming in from the request are to be interpreted.
+        *
+        * If a constant is associated with a ValidationException, the failure code
+        * and data are described. ValidationExceptions are typically thrown, but
+        * those indicated as "non-fatal" are instead passed to
+        * Callbacks::recordCondition().
+        *
+        * Additional constants may be defined by TypeDef subclasses, or by other
+        * libraries for controlling things like auto-generated parameter documentation.
+        * For purposes of namespacing the constants, the values of all constants
+        * defined by this library begin with 'param-'.
+        *
+        * @{
+        */
+
+       /** (mixed) Default value of the parameter. If omitted, null is the default. */
+       const PARAM_DEFAULT = 'param-default';
+
+       /**
+        * (string|array) Type of the parameter.
+        * Must be a registered type or an array of enumerated values (in which case the "enum"
+        * type must be registered). If omitted, the default is the PHP type of the default value
+        * (see PARAM_DEFAULT).
+        */
+       const PARAM_TYPE = 'param-type';
+
+       /**
+        * (bool) Indicate that the parameter is required.
+        *
+        * ValidationException codes:
+        *  - 'missingparam': The parameter is omitted/empty (and no default was set). No data.
+        */
+       const PARAM_REQUIRED = 'param-required';
+
+       /**
+        * (bool) Indicate that the parameter is multi-valued.
+        *
+        * A multi-valued parameter may be submitted in one of several formats. All
+        * of the following result a value of `[ 'a', 'b', 'c' ]`.
+        *  - "a|b|c", i.e. pipe-separated.
+        *  - "\x1Fa\x1Fb\x1Fc", i.e. separated by U+001F, with a signalling U+001F at the start.
+        *  - As a string[], e.g. from a query string like "foo[]=a&foo[]=b&foo[]=c".
+        *
+        * Each of the multiple values is passed individually to the TypeDef.
+        * $options will contain a 'values-list' key holding the entire list.
+        *
+        * By default duplicates are removed from the resulting parameter list. Use
+        * PARAM_ALLOW_DUPLICATES to override that behavior.
+        *
+        * ValidationException codes:
+        *  - 'toomanyvalues': More values were supplied than are allowed. See
+        *    PARAM_ISMULTI_LIMIT1, PARAM_ISMULTI_LIMIT2, and constructor option
+        *    'ismultiLimits'. Data:
+        *     - 'limit': The limit that was exceeded.
+        *  - 'unrecognizedvalues': Non-fatal. Invalid values were passed and
+        *    PARAM_IGNORE_INVALID_VALUES was set. Data:
+        *     - 'values': The unrecognized values.
+        */
+       const PARAM_ISMULTI = 'param-ismulti';
+
+       /**
+        * (int) Maximum number of multi-valued parameter values allowed
+        *
+        * PARAM_ISMULTI_LIMIT1 is the normal limit, and PARAM_ISMULTI_LIMIT2 is
+        * the limit when useHighLimits() returns true.
+        *
+        * ValidationException codes:
+        *  - 'toomanyvalues': The limit was exceeded. Data:
+        *     - 'limit': The limit that was exceeded.
+        */
+       const PARAM_ISMULTI_LIMIT1 = 'param-ismulti-limit1';
+
+       /**
+        * (int) Maximum number of multi-valued parameter values allowed for users
+        * allowed high limits.
+        *
+        * PARAM_ISMULTI_LIMIT1 is the normal limit, and PARAM_ISMULTI_LIMIT2 is
+        * the limit when useHighLimits() returns true.
+        *
+        * ValidationException codes:
+        *  - 'toomanyvalues': The limit was exceeded. Data:
+        *     - 'limit': The limit that was exceeded.
+        */
+       const PARAM_ISMULTI_LIMIT2 = 'param-ismulti-limit2';
+
+       /**
+        * (bool|string) Whether a magic "all values" value exists for multi-valued
+        * enumerated types, and if so what that value is.
+        *
+        * When PARAM_TYPE has a defined set of values and PARAM_ISMULTI is true,
+        * this allows for an asterisk ('*') to be passed in place of a pipe-separated list of
+        * every possible value. If a string is set, it will be used in place of the asterisk.
+        */
+       const PARAM_ALL = 'param-all';
+
+       /**
+        * (bool) Allow the same value to be set more than once when PARAM_ISMULTI is true?
+        *
+        * If not truthy, the set of values will be passed through
+        * `array_values( array_unique() )`. The default is falsey.
+        */
+       const PARAM_ALLOW_DUPLICATES = 'param-allow-duplicates';
+
+       /**
+        * (bool) Indicate that the parameter's value should not be logged.
+        *
+        * ValidationException codes: (non-fatal)
+        *  - 'param-sensitive': Always recorded.
+        */
+       const PARAM_SENSITIVE = 'param-sensitive';
+
+       /**
+        * (bool) Indicate that a deprecated parameter was used.
+        *
+        * ValidationException codes: (non-fatal)
+        *  - 'param-deprecated': Always recorded.
+        */
+       const PARAM_DEPRECATED = 'param-deprecated';
+
+       /**
+        * (bool) Whether to ignore invalid values.
+        *
+        * This controls whether certain ValidationExceptions are considered fatal
+        * or non-fatal. The default is false.
+        */
+       const PARAM_IGNORE_INVALID_VALUES = 'param-ignore-invalid-values';
+
+       /**@}*/
+
+       /** Magic "all values" value when PARAM_ALL is true. */
+       const ALL_DEFAULT_STRING = '*';
+
+       /** A list of standard type names and types that may be passed as `$typeDefs` to __construct(). */
+       public static $STANDARD_TYPES = [
+               'boolean' => [ 'class' => TypeDef\BooleanDef::class ],
+               'checkbox' => [ 'class' => TypeDef\PresenceBooleanDef::class ],
+               'integer' => [ 'class' => TypeDef\IntegerDef::class ],
+               'limit' => [ 'class' => TypeDef\LimitDef::class ],
+               'float' => [ 'class' => TypeDef\FloatDef::class ],
+               'double' => [ 'class' => TypeDef\FloatDef::class ],
+               'string' => [ 'class' => TypeDef\StringDef::class ],
+               'password' => [ 'class' => TypeDef\PasswordDef::class ],
+               'NULL' => [
+                       'class' => TypeDef\StringDef::class,
+                       'args' => [ [
+                               'allowEmptyWhenRequired' => true,
+                       ] ],
+               ],
+               'timestamp' => [ 'class' => TypeDef\TimestampDef::class ],
+               'upload' => [ 'class' => TypeDef\UploadDef::class ],
+               'enum' => [ 'class' => TypeDef\EnumDef::class ],
+       ];
+
+       /** @var Callbacks */
+       private $callbacks;
+
+       /** @var ObjectFactory */
+       private $objectFactory;
+
+       /** @var (TypeDef|array)[] Map parameter type names to TypeDef objects or ObjectFactory specs */
+       private $typeDefs = [];
+
+       /** @var int Default values for PARAM_ISMULTI_LIMIT1 */
+       private $ismultiLimit1;
+
+       /** @var int Default values for PARAM_ISMULTI_LIMIT2 */
+       private $ismultiLimit2;
+
+       /**
+        * @param Callbacks $callbacks
+        * @param ObjectFactory $objectFactory To turn specs into TypeDef objects
+        * @param array $options Associative array of additional settings
+        *  - 'typeDefs': (array) As for addTypeDefs(). If omitted, self::$STANDARD_TYPES will be used.
+        *    Pass an empty array if you want to start with no registered types.
+        *  - 'ismultiLimits': (int[]) Two ints, being the default values for PARAM_ISMULTI_LIMIT1 and
+        *    PARAM_ISMULTI_LIMIT2. If not given, defaults to `[ 50, 500 ]`.
+        */
+       public function __construct(
+               Callbacks $callbacks,
+               ObjectFactory $objectFactory,
+               array $options = []
+       ) {
+               $this->callbacks = $callbacks;
+               $this->objectFactory = $objectFactory;
+
+               $this->addTypeDefs( $options['typeDefs'] ?? self::$STANDARD_TYPES );
+               $this->ismultiLimit1 = $options['ismultiLimits'][0] ?? 50;
+               $this->ismultiLimit2 = $options['ismultiLimits'][1] ?? 500;
+       }
+
+       /**
+        * List known type names
+        * @return string[]
+        */
+       public function knownTypes() {
+               return array_keys( $this->typeDefs );
+       }
+
+       /**
+        * Register multiple type handlers
+        *
+        * @see addTypeDef()
+        * @param array $typeDefs Associative array mapping `$name` to `$typeDef`.
+        */
+       public function addTypeDefs( array $typeDefs ) {
+               foreach ( $typeDefs as $name => $def ) {
+                       $this->addTypeDef( $name, $def );
+               }
+       }
+
+       /**
+        * Register a type handler
+        *
+        * To allow code to omit PARAM_TYPE in settings arrays to derive the type
+        * from PARAM_DEFAULT, it is strongly recommended that the following types be
+        * registered: "boolean", "integer", "double", "string", "NULL", and "enum".
+        *
+        * When using ObjectFactory specs, the following extra arguments are passed:
+        * - The Callbacks object for this ParamValidator instance.
+        *
+        * @param string $name Type name
+        * @param TypeDef|array $typeDef Type handler or ObjectFactory spec to create one.
+        */
+       public function addTypeDef( $name, $typeDef ) {
+               Assert::parameterType(
+                       implode( '|', [ TypeDef::class, 'array' ] ),
+                       $typeDef,
+                       '$typeDef'
+               );
+
+               if ( isset( $this->typeDefs[$name] ) ) {
+                       throw new InvalidArgumentException( "Type '$name' is already registered" );
+               }
+               $this->typeDefs[$name] = $typeDef;
+       }
+
+       /**
+        * Register a type handler, overriding any existing handler
+        * @see addTypeDef
+        * @param string $name Type name
+        * @param TypeDef|array|null $typeDef As for addTypeDef, or null to unregister a type.
+        */
+       public function overrideTypeDef( $name, $typeDef ) {
+               Assert::parameterType(
+                       implode( '|', [ TypeDef::class, 'array', 'null' ] ),
+                       $typeDef,
+                       '$typeDef'
+               );
+
+               if ( $typeDef === null ) {
+                       unset( $this->typeDefs[$name] );
+               } else {
+                       $this->typeDefs[$name] = $typeDef;
+               }
+       }
+
+       /**
+        * Test if a type is registered
+        * @param string $name Type name
+        * @return bool
+        */
+       public function hasTypeDef( $name ) {
+               return isset( $this->typeDefs[$name] );
+       }
+
+       /**
+        * Get the TypeDef for a type
+        * @param string|array $type Any array is considered equivalent to the string "enum".
+        * @return TypeDef|null
+        */
+       public function getTypeDef( $type ) {
+               if ( is_array( $type ) ) {
+                       $type = 'enum';
+               }
+
+               if ( !isset( $this->typeDefs[$type] ) ) {
+                       return null;
+               }
+
+               $def = $this->typeDefs[$type];
+               if ( !$def instanceof TypeDef ) {
+                       $def = $this->objectFactory->createObject( $def, [
+                               'extraArgs' => [ $this->callbacks ],
+                               'assertClass' => TypeDef::class,
+                       ] );
+                       $this->typeDefs[$type] = $def;
+               }
+
+               return $def;
+       }
+
+       /**
+        * Normalize a parameter settings array
+        * @param array|mixed $settings Default value or an array of settings
+        *  using PARAM_* constants.
+        * @return array
+        */
+       public function normalizeSettings( $settings ) {
+               // Shorthand
+               if ( !is_array( $settings ) ) {
+                       $settings = [
+                               self::PARAM_DEFAULT => $settings,
+                       ];
+               }
+
+               // When type is not given, determine it from the type of the PARAM_DEFAULT
+               if ( !isset( $settings[self::PARAM_TYPE] ) ) {
+                       $settings[self::PARAM_TYPE] = gettype( $settings[self::PARAM_DEFAULT] ?? null );
+               }
+
+               $typeDef = $this->getTypeDef( $settings[self::PARAM_TYPE] );
+               if ( $typeDef ) {
+                       $settings = $typeDef->normalizeSettings( $settings );
+               }
+
+               return $settings;
+       }
+
+       /**
+        * Fetch and valiate a parameter value using a settings array
+        *
+        * @param string $name Parameter name
+        * @param array|mixed $settings Default value or an array of settings
+        *  using PARAM_* constants.
+        * @param array $options Options array, passed through to the TypeDef and Callbacks.
+        * @return mixed Validated parameter value
+        * @throws ValidationException if the value is invalid
+        */
+       public function getValue( $name, $settings, array $options = [] ) {
+               $settings = $this->normalizeSettings( $settings );
+
+               $typeDef = $this->getTypeDef( $settings[self::PARAM_TYPE] );
+               if ( !$typeDef ) {
+                       throw new DomainException(
+                               "Param $name's type is unknown - {$settings[self::PARAM_TYPE]}"
+                       );
+               }
+
+               $value = $typeDef->getValue( $name, $settings, $options );
+
+               if ( $value !== null ) {
+                       if ( !empty( $settings[self::PARAM_SENSITIVE] ) ) {
+                               $this->callbacks->recordCondition(
+                                       new ValidationException( $name, $value, $settings, 'param-sensitive', [] ),
+                                       $options
+                               );
+                       }
+
+                       // Set a warning if a deprecated parameter has been passed
+                       if ( !empty( $settings[self::PARAM_DEPRECATED] ) ) {
+                               $this->callbacks->recordCondition(
+                                       new ValidationException( $name, $value, $settings, 'param-deprecated', [] ),
+                                       $options
+                               );
+                       }
+               } elseif ( isset( $settings[self::PARAM_DEFAULT] ) ) {
+                       $value = $settings[self::PARAM_DEFAULT];
+               }
+
+               return $this->validateValue( $name, $value, $settings, $options );
+       }
+
+       /**
+        * Valiate a parameter value using a settings array
+        *
+        * @param string $name Parameter name
+        * @param null|mixed $value Parameter value
+        * @param array|mixed $settings Default value or an array of settings
+        *  using PARAM_* constants.
+        * @param array $options Options array, passed through to the TypeDef and Callbacks.
+        *  - An additional option, 'values-list', will be set when processing the
+        *    values of a multi-valued parameter.
+        * @return mixed Validated parameter value(s)
+        * @throws ValidationException if the value is invalid
+        */
+       public function validateValue( $name, $value, $settings, array $options = [] ) {
+               $settings = $this->normalizeSettings( $settings );
+
+               $typeDef = $this->getTypeDef( $settings[self::PARAM_TYPE] );
+               if ( !$typeDef ) {
+                       throw new DomainException(
+                               "Param $name's type is unknown - {$settings[self::PARAM_TYPE]}"
+                       );
+               }
+
+               if ( $value === null ) {
+                       if ( !empty( $settings[self::PARAM_REQUIRED] ) ) {
+                               throw new ValidationException( $name, $value, $settings, 'missingparam', [] );
+                       }
+                       return null;
+               }
+
+               // Non-multi
+               if ( empty( $settings[self::PARAM_ISMULTI] ) ) {
+                       return $typeDef->validate( $name, $value, $settings, $options );
+               }
+
+               // Split the multi-value and validate each parameter
+               $limit1 = $settings[self::PARAM_ISMULTI_LIMIT1] ?? $this->ismultiLimit1;
+               $limit2 = $settings[self::PARAM_ISMULTI_LIMIT2] ?? $this->ismultiLimit2;
+               $valuesList = is_array( $value ) ? $value : self::explodeMultiValue( $value, $limit2 + 1 );
+
+               // Handle PARAM_ALL
+               $enumValues = $typeDef->getEnumValues( $name, $settings, $options );
+               if ( is_array( $enumValues ) && isset( $settings[self::PARAM_ALL] ) &&
+                       count( $valuesList ) === 1
+               ) {
+                       $allValue = is_string( $settings[self::PARAM_ALL] )
+                               ? $settings[self::PARAM_ALL]
+                               : self::ALL_DEFAULT_STRING;
+                       if ( $valuesList[0] === $allValue ) {
+                               return $enumValues;
+                       }
+               }
+
+               // Avoid checking useHighLimits() unless it's actually necessary
+               $sizeLimit = count( $valuesList ) > $limit1 && $this->callbacks->useHighLimits( $options )
+                       ? $limit2
+                       : $limit1;
+               if ( count( $valuesList ) > $sizeLimit ) {
+                       throw new ValidationException( $name, $valuesList, $settings, 'toomanyvalues', [
+                               'limit' => $sizeLimit
+                       ] );
+               }
+
+               $options['values-list'] = $valuesList;
+               $validValues = [];
+               $invalidValues = [];
+               foreach ( $valuesList as $v ) {
+                       try {
+                               $validValues[] = $typeDef->validate( $name, $v, $settings, $options );
+                       } catch ( ValidationException $ex ) {
+                               if ( empty( $settings[self::PARAM_IGNORE_INVALID_VALUES] ) ) {
+                                       throw $ex;
+                               }
+                               $invalidValues[] = $v;
+                       }
+               }
+               if ( $invalidValues ) {
+                       $this->callbacks->recordCondition(
+                               new ValidationException( $name, $value, $settings, 'unrecognizedvalues', [
+                                       'values' => $invalidValues,
+                               ] ),
+                               $options
+                       );
+               }
+
+               // Throw out duplicates if requested
+               if ( empty( $settings[self::PARAM_ALLOW_DUPLICATES] ) ) {
+                       $validValues = array_values( array_unique( $validValues ) );
+               }
+
+               return $validValues;
+       }
+
+       /**
+        * Split a multi-valued parameter string, like explode()
+        *
+        * Note that, unlike explode(), this will return an empty array when given
+        * an empty string.
+        *
+        * @param string $value
+        * @param int $limit
+        * @return string[]
+        */
+       public static function explodeMultiValue( $value, $limit ) {
+               if ( $value === '' || $value === "\x1f" ) {
+                       return [];
+               }
+
+               if ( substr( $value, 0, 1 ) === "\x1f" ) {
+                       $sep = "\x1f";
+                       $value = substr( $value, 1 );
+               } else {
+                       $sep = '|';
+               }
+
+               return explode( $sep, $value, $limit );
+       }
+
+}
diff --git a/includes/libs/ParamValidator/README.md b/includes/libs/ParamValidator/README.md
new file mode 100644 (file)
index 0000000..dd992a4
--- /dev/null
@@ -0,0 +1,58 @@
+Wikimedia API Parameter Validator
+=================================
+
+This library implements a system for processing and validating parameters to an
+API from data like that in PHP's `$_GET`, `$_POST`, and `$_FILES` arrays, based
+on a declarative definition of available parameters.
+
+Usage
+-----
+
+<pre lang="php">
+use Wikimedia\ParamValidator\ParamValidator;
+use Wikimedia\ParamValidator\TypeDef\IntegerDef;
+use Wikimedia\ParamValidator\SimpleCallbacks as ParamValidatorCallbacks;
+use Wikimedia\ParamValidator\ValidationException;
+
+$validator = new ParamValidator(
+       new ParamValidatorCallbacks( $_POST + $_GET, $_FILES ),
+       $serviceContainer->getObjectFactory()
+);
+
+try {
+       $intValue = $validator->getValue( 'intParam', [
+                       ParamValidator::PARAM_TYPE => 'integer',
+                       ParamValidator::PARAM_DEFAULT => 0,
+                       IntegerDef::PARAM_MIN => 0,
+                       IntegerDef::PARAM_MAX => 5,
+       ] );
+} catch ( ValidationException $ex ) {
+       $error = lookupI18nMessage( 'param-validator-error-' . $ex->getFailureCode() );
+       echo "Validation error: $error\n";
+}
+</pre>
+
+I18n
+----
+
+This library is designed to generate output in a manner suited to use with an
+i18n system. To that end, errors and such are indicated by means of "codes"
+consisting of ASCII lowercase letters, digits, and hyphen (and always beginning
+with a letter).
+
+Additional details about each error, such as the allowed range for an integer
+value, are similarly returned by means of associative arrays with keys being
+similar "code" strings and values being strings, integers, or arrays of strings
+that are intended to be formatted as a list (e.g. joined with commas). The
+details for any particular "message" will also always have the same keys in the
+same order to facilitate use with i18n systems using positional rather than
+named parameters.
+
+For possible codes and their parameters, see the documentation of the relevant
+`PARAM_*` constants and TypeDef classes.
+
+Running tests
+-------------
+
+    composer install --prefer-dist
+    composer test
diff --git a/includes/libs/ParamValidator/SimpleCallbacks.php b/includes/libs/ParamValidator/SimpleCallbacks.php
new file mode 100644 (file)
index 0000000..77dab92
--- /dev/null
@@ -0,0 +1,79 @@
+<?php
+
+namespace Wikimedia\ParamValidator;
+
+use Wikimedia\ParamValidator\Util\UploadedFile;
+
+/**
+ * Simple Callbacks implementation for $_GET/$_POST/$_FILES data
+ *
+ * Options array keys used by this class:
+ *  - 'useHighLimits': (bool) Return value from useHighLimits()
+ *
+ * @since 1.34
+ */
+class SimpleCallbacks implements Callbacks {
+
+       /** @var (string|string[])[] $_GET/$_POST data */
+       private $params;
+
+       /** @var (array|UploadedFile)[] $_FILES data or UploadedFile instances */
+       private $files;
+
+       /** @var array Any recorded conditions */
+       private $conditions = [];
+
+       /**
+        * @param (string|string[])[] $params Data from $_POST + $_GET
+        * @param array[] $files Data from $_FILES
+        */
+       public function __construct( array $params, array $files = [] ) {
+               $this->params = $params;
+               $this->files = $files;
+       }
+
+       public function hasParam( $name, array $options ) {
+               return isset( $this->params[$name] );
+       }
+
+       public function getValue( $name, $default, array $options ) {
+               return $this->params[$name] ?? $default;
+       }
+
+       public function hasUpload( $name, array $options ) {
+               return isset( $this->files[$name] );
+       }
+
+       public function getUploadedFile( $name, array $options ) {
+               $file = $this->files[$name] ?? null;
+               if ( $file && !$file instanceof UploadedFile ) {
+                       $file = new UploadedFile( $file );
+                       $this->files[$name] = $file;
+               }
+               return $file;
+       }
+
+       public function recordCondition( ValidationException $condition, array $options ) {
+               $this->conditions[] = $condition;
+       }
+
+       /**
+        * Fetch any recorded conditions
+        * @return array[]
+        */
+       public function getRecordedConditions() {
+               return $this->conditions;
+       }
+
+       /**
+        * Clear any recorded conditions
+        */
+       public function clearRecordedConditions() {
+               $this->conditions = [];
+       }
+
+       public function useHighLimits( array $options ) {
+               return !empty( $options['useHighLimits'] );
+       }
+
+}
diff --git a/includes/libs/ParamValidator/TypeDef.php b/includes/libs/ParamValidator/TypeDef.php
new file mode 100644 (file)
index 0000000..0d54add
--- /dev/null
@@ -0,0 +1,148 @@
+<?php
+
+namespace Wikimedia\ParamValidator;
+
+/**
+ * Base definition for ParamValidator types.
+ *
+ * All methods in this class accept an "options array". This is just the `$options`
+ * passed to ParamValidator::getValue(), ParamValidator::validateValue(), and the like
+ * and is intended for communication of non-global state.
+ *
+ * @since 1.34
+ */
+abstract class TypeDef {
+
+       /** @var Callbacks */
+       protected $callbacks;
+
+       public function __construct( Callbacks $callbacks ) {
+               $this->callbacks = $callbacks;
+       }
+
+       /**
+        * Get the value from the request
+        *
+        * @note Only override this if you need to use something other than
+        *  $this->callbacks->getValue() to fetch the value. Reformatting from a
+        *  string should typically be done by self::validate().
+        * @note Handling of ParamValidator::PARAM_DEFAULT should be left to ParamValidator,
+        *  as should PARAM_REQUIRED and the like.
+        *
+        * @param string $name Parameter name being fetched.
+        * @param array $settings Parameter settings array.
+        * @param array $options Options array.
+        * @return null|mixed Return null if the value wasn't present, otherwise a
+        *  value to be passed to self::validate().
+        */
+       public function getValue( $name, array $settings, array $options ) {
+               return $this->callbacks->getValue( $name, null, $options );
+       }
+
+       /**
+        * Validate the value
+        *
+        * When ParamValidator is processing a multi-valued parameter, this will be
+        * called once for each of the supplied values. Which may mean zero calls.
+        *
+        * When getValue() returned null, this will not be called.
+        *
+        * @param string $name Parameter name being validated.
+        * @param mixed $value Value to validate, from getValue().
+        * @param array $settings Parameter settings array.
+        * @param array $options Options array. Note the following values that may be set
+        *  by ParamValidator:
+        *   - values-list: (string[]) If defined, values of a multi-valued parameter are being processed
+        *     (and this array holds the full set of values).
+        * @return mixed Validated value
+        * @throws ValidationException if the value is invalid
+        */
+       abstract public function validate( $name, $value, array $settings, array $options );
+
+       /**
+        * Normalize a settings array
+        * @param array $settings
+        * @return array
+        */
+       public function normalizeSettings( array $settings ) {
+               return $settings;
+       }
+
+       /**
+        * Get the values for enum-like parameters
+        *
+        * This is primarily intended for documentation and implementation of
+        * PARAM_ALL; it is the responsibility of the TypeDef to ensure that validate()
+        * accepts the values returned here.
+        *
+        * @param string $name Parameter name being validated.
+        * @param array $settings Parameter settings array.
+        * @param array $options Options array.
+        * @return array|null All possible enumerated values, or null if this is
+        *  not an enumeration.
+        */
+       public function getEnumValues( $name, array $settings, array $options ) {
+               return null;
+       }
+
+       /**
+        * Convert a value to a string representation.
+        *
+        * This is intended as the inverse of getValue() and validate(): this
+        * should accept anything returned by those methods or expected to be used
+        * as PARAM_DEFAULT, and if the string from this method is passed in as client
+        * input or PARAM_DEFAULT it should give equivalent output from validate().
+        *
+        * @param string $name Parameter name being converted.
+        * @param mixed $value Parameter value being converted. Do not pass null.
+        * @param array $settings Parameter settings array.
+        * @param array $options Options array.
+        * @return string|null Return null if there is no representation of $value
+        *  reasonably satisfying the description given.
+        */
+       public function stringifyValue( $name, $value, array $settings, array $options ) {
+               return (string)$value;
+       }
+
+       /**
+        * "Describe" a settings array
+        *
+        * This is intended to format data about a settings array using this type
+        * in a way that would be useful for automatically generated documentation
+        * or a machine-readable interface specification.
+        *
+        * Keys in the description array should follow the same guidelines as the
+        * code described for ValidationException.
+        *
+        * By default, each value in the description array is a single string,
+        * integer, or array. When `$options['compact']` is supplied, each value is
+        * instead an array of such and related values may be combined. For example,
+        * a non-compact description for an integer type might include
+        * `[ 'default' => 0, 'min' => 0, 'max' => 5 ]`, while in compact mode it might
+        * instead report `[ 'default' => [ 'value' => 0 ], 'minmax' => [ 'min' => 0, 'max' => 5 ] ]`
+        * to facilitate auto-generated documentation turning that 'minmax' into
+        * "Value must be between 0 and 5" rather than disconnected statements
+        * "Value must be >= 0" and "Value must be <= 5".
+        *
+        * @param string $name Parameter name being described.
+        * @param array $settings Parameter settings array.
+        * @param array $options Options array. Defined options for this base class are:
+        *  - 'compact': (bool) Enable compact mode, as described above.
+        * @return array
+        */
+       public function describeSettings( $name, array $settings, array $options ) {
+               $compact = !empty( $options['compact'] );
+
+               $ret = [];
+
+               if ( isset( $settings[ParamValidator::PARAM_DEFAULT] ) ) {
+                       $value = $this->stringifyValue(
+                               $name, $settings[ParamValidator::PARAM_DEFAULT], $settings, $options
+                       );
+                       $ret['default'] = $compact ? [ 'value' => $value ] : $value;
+               }
+
+               return $ret;
+       }
+
+}
diff --git a/includes/libs/ParamValidator/TypeDef/BooleanDef.php b/includes/libs/ParamValidator/TypeDef/BooleanDef.php
new file mode 100644 (file)
index 0000000..f77c930
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\ParamValidator\TypeDef;
+use Wikimedia\ParamValidator\ValidationException;
+
+/**
+ * Type definition for boolean types
+ *
+ * This type accepts certain defined strings to mean 'true' or 'false'.
+ * The result from validate() is a PHP boolean.
+ *
+ * ValidationException codes:
+ *  - 'badbool': The value is not a recognized boolean. Data:
+ *     - 'truevals': List of recognized values for "true".
+ *     - 'falsevals': List of recognized values for "false".
+ *
+ * @since 1.34
+ */
+class BooleanDef extends TypeDef {
+
+       public static $TRUEVALS = [ 'true', 't', 'yes', 'y', 'on', '1' ];
+       public static $FALSEVALS = [ 'false', 'f', 'no', 'n', 'off', '0' ];
+
+       public function validate( $name, $value, array $settings, array $options ) {
+               $value = strtolower( $value );
+               if ( in_array( $value, self::$TRUEVALS, true ) ) {
+                       return true;
+               }
+               if ( $value === '' || in_array( $value, self::$FALSEVALS, true ) ) {
+                       return false;
+               }
+
+               throw new ValidationException( $name, $value, $settings, 'badbool', [
+                       'truevals' => self::$TRUEVALS,
+                       'falsevals' => array_merge( self::$FALSEVALS, [ 'the empty string' ] ),
+               ] );
+       }
+
+       public function stringifyValue( $name, $value, array $settings, array $options ) {
+               return $value ? self::$TRUEVALS[0] : self::$FALSEVALS[0];
+       }
+
+}
diff --git a/includes/libs/ParamValidator/TypeDef/EnumDef.php b/includes/libs/ParamValidator/TypeDef/EnumDef.php
new file mode 100644 (file)
index 0000000..0f4f690
--- /dev/null
@@ -0,0 +1,88 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\ParamValidator\ParamValidator;
+use Wikimedia\ParamValidator\TypeDef;
+use Wikimedia\ParamValidator\ValidationException;
+
+/**
+ * Type definition for enumeration types.
+ *
+ * This class expects that PARAM_TYPE is an array of allowed values. Subclasses
+ * may override getEnumValues() to determine the allowed values differently.
+ *
+ * The result from validate() is one of the defined values.
+ *
+ * ValidationException codes:
+ *  - 'badvalue': The value is not a recognized value. No data.
+ *  - 'notmulti': PARAM_ISMULTI is not set and the unrecognized value seems to
+ *     be an attempt at using multiple values. No data.
+ *
+ * Additional codes may be generated when using certain PARAM constants. See
+ * the constants' documentation for details.
+ *
+ * @since 1.34
+ */
+class EnumDef extends TypeDef {
+
+       /**
+        * (array) Associative array of deprecated values.
+        *
+        * Keys are the deprecated parameter values, values are included in
+        * the ValidationException. If value is null, the parameter is considered
+        * not actually deprecated.
+        *
+        * Note that this does not add any values to the enumeration, it only
+        * documents existing values as being deprecated.
+        *
+        * ValidationException codes: (non-fatal)
+        *  - 'deprecated-value': A deprecated value was encountered. Data:
+        *     - 'flag': The value from the associative array.
+        */
+       const PARAM_DEPRECATED_VALUES = 'param-deprecated-values';
+
+       public function validate( $name, $value, array $settings, array $options ) {
+               $values = $this->getEnumValues( $name, $settings, $options );
+
+               if ( in_array( $value, $values, true ) ) {
+                       // Set a warning if a deprecated parameter value has been passed
+                       if ( isset( $settings[self::PARAM_DEPRECATED_VALUES][$value] ) ) {
+                               $this->callbacks->recordCondition(
+                                       new ValidationException( $name, $value, $settings, 'deprecated-value', [
+                                               'flag' => $settings[self::PARAM_DEPRECATED_VALUES][$value],
+                                       ] ),
+                                       $options
+                               );
+                       }
+
+                       return $value;
+               }
+
+               if ( !isset( $options['values-list'] ) &&
+                       count( ParamValidator::explodeMultiValue( $value, 2 ) ) > 1
+               ) {
+                       throw new ValidationException( $name, $value, $settings, 'notmulti', [] );
+               } else {
+                       throw new ValidationException( $name, $value, $settings, 'badvalue', [] );
+               }
+       }
+
+       public function getEnumValues( $name, array $settings, array $options ) {
+               return $settings[ParamValidator::PARAM_TYPE];
+       }
+
+       public function stringifyValue( $name, $value, array $settings, array $options ) {
+               if ( !is_array( $value ) ) {
+                       return parent::stringifyValue( $name, $value, $settings, $options );
+               }
+
+               foreach ( $value as $v ) {
+                       if ( strpos( $v, '|' ) !== false ) {
+                               return "\x1f" . implode( "\x1f", $value );
+                       }
+               }
+               return implode( '|', $value );
+       }
+
+}
diff --git a/includes/libs/ParamValidator/TypeDef/FloatDef.php b/includes/libs/ParamValidator/TypeDef/FloatDef.php
new file mode 100644 (file)
index 0000000..0a204b3
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\ParamValidator\TypeDef;
+use Wikimedia\ParamValidator\ValidationException;
+
+/**
+ * Type definition for a floating-point type
+ *
+ * A valid representation consists of:
+ *  - an optional sign (`+` or `-`)
+ *  - a decimal number, using `.` as the decimal separator and no grouping
+ *  - an optional E-notation suffix: the letter 'e' or 'E', an optional
+ *    sign, and an integer
+ *
+ * Thus, for example, "12", "-.4", "6.022e23", or "+1.7e-10".
+ *
+ * The result from validate() is a PHP float.
+ *
+ * ValidationException codes:
+ *  - 'badfloat': The value was invalid. No data.
+ *  - 'notfinite': The value was in a valid format, but conversion resulted in
+ *    infinity or NAN.
+ *
+ * @since 1.34
+ */
+class FloatDef extends TypeDef {
+
+       public function validate( $name, $value, array $settings, array $options ) {
+               // Use a regex so as to avoid any potential oddness PHP's default conversion might allow.
+               if ( !preg_match( '/^[+-]?(?:\d*\.)?\d+(?:[eE][+-]?\d+)?$/D', $value ) ) {
+                       throw new ValidationException( $name, $value, $settings, 'badfloat', [] );
+               }
+
+               $ret = (float)$value;
+               if ( !is_finite( $ret ) ) {
+                       throw new ValidationException( $name, $value, $settings, 'notfinite', [] );
+               }
+
+               return $ret;
+       }
+
+       /**
+        * Attempt to fix locale weirdness
+        *
+        * We don't have any usable number formatting function that's not locale-aware,
+        * and `setlocale()` isn't safe in multithreaded environments. Sigh.
+        *
+        * @param string $value Value to fix
+        * @return string
+        */
+       private function fixLocaleWeirdness( $value ) {
+               $localeData = localeconv();
+               if ( $localeData['decimal_point'] !== '.' ) {
+                       $value = strtr( $value, [
+                               $localeData['decimal_point'] => '.',
+                               // PHP's number formatting currently uses only the first byte from 'decimal_point'.
+                               // See upstream bug https://bugs.php.net/bug.php?id=78113
+                               $localeData['decimal_point'][0] => '.',
+                       ] );
+               }
+               return $value;
+       }
+
+       public function stringifyValue( $name, $value, array $settings, array $options ) {
+               // Ensure sufficient precision for round-tripping. PHP_FLOAT_DIG was added in PHP 7.2.
+               $digits = defined( 'PHP_FLOAT_DIG' ) ? PHP_FLOAT_DIG : 15;
+               return $this->fixLocaleWeirdness( sprintf( "%.{$digits}g", $value ) );
+       }
+
+}
diff --git a/includes/libs/ParamValidator/TypeDef/IntegerDef.php b/includes/libs/ParamValidator/TypeDef/IntegerDef.php
new file mode 100644 (file)
index 0000000..556301b
--- /dev/null
@@ -0,0 +1,171 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\ParamValidator\TypeDef;
+use Wikimedia\ParamValidator\ValidationException;
+
+/**
+ * Type definition for integer types
+ *
+ * A valid representation consists of an optional sign (`+` or `-`) followed by
+ * one or more decimal digits.
+ *
+ * The result from validate() is a PHP integer.
+ *
+ * * ValidationException codes:
+ *  - 'badinteger': The value was invalid or could not be represented as a PHP
+ *    integer. No data.
+ *
+ * Additional codes may be generated when using certain PARAM constants. See
+ * the constants' documentation for details.
+ *
+ * @since 1.34
+ */
+class IntegerDef extends TypeDef {
+
+       /**
+        * (bool) Whether to enforce the specified range.
+        *
+        * If set and truthy, ValidationExceptions from PARAM_MIN, PARAM_MAX, and
+        * PARAM_MAX2 are non-fatal.
+        */
+       const PARAM_IGNORE_RANGE = 'param-ignore-range';
+
+       /**
+        * (int) Minimum allowed value.
+        *
+        * ValidationException codes:
+        *  - 'belowminimum': The value was below the allowed minimum. Data:
+        *     - 'min': Allowed minimum, or empty string if there is none.
+        *     - 'max': Allowed (normal) maximum, or empty string if there is none.
+        *     - 'max2': Allowed (high limits) maximum, or empty string if there is none.
+        */
+       const PARAM_MIN = 'param-min';
+
+       /**
+        * (int) Maximum allowed value (normal limits)
+        *
+        * ValidationException codes:
+        *  - 'abovemaximum': The value was above the allowed maximum. Data:
+        *     - 'min': Allowed minimum, or empty string if there is none.
+        *     - 'max': Allowed (normal) maximum, or empty string if there is none.
+        *     - 'max2': Allowed (high limits) maximum, or empty string if there is none.
+        */
+       const PARAM_MAX = 'param-max';
+
+       /**
+        * (int) Maximum allowed value (high limits)
+        *
+        * If not specified, PARAM_MAX will be enforced for all users. Ignored if
+        * PARAM_MAX is not set.
+        *
+        * ValidationException codes:
+        *  - 'abovehighmaximum': The value was above the allowed maximum. Data:
+        *     - 'min': Allowed minimum, or empty string if there is none.
+        *     - 'max': Allowed (normal) maximum, or empty string if there is none.
+        *     - 'max2': Allowed (high limits) maximum, or empty string if there is none.
+        */
+       const PARAM_MAX2 = 'param-max2';
+
+       public function validate( $name, $value, array $settings, array $options ) {
+               if ( !preg_match( '/^[+-]?\d+$/D', $value ) ) {
+                       throw new ValidationException( $name, $value, $settings, 'badinteger', [] );
+               }
+               $ret = intval( $value, 10 );
+
+               // intval() returns min/max on overflow, so check that
+               if ( $ret === PHP_INT_MAX || $ret === PHP_INT_MIN ) {
+                       $tmp = ( $ret < 0 ? '-' : '' ) . ltrim( $value, '-0' );
+                       if ( $tmp !== (string)$ret ) {
+                               throw new ValidationException( $name, $value, $settings, 'badinteger', [] );
+                       }
+               }
+
+               $min = $settings[self::PARAM_MIN] ?? null;
+               $max = $settings[self::PARAM_MAX] ?? null;
+               $max2 = $settings[self::PARAM_MAX2] ?? null;
+               $err = null;
+
+               if ( $min !== null && $ret < $min ) {
+                       $err = 'belowminimum';
+                       $ret = $min;
+               } elseif ( $max !== null && $ret > $max ) {
+                       if ( $max2 !== null && $this->callbacks->useHighLimits( $options ) ) {
+                               if ( $ret > $max2 ) {
+                                       $err = 'abovehighmaximum';
+                                       $ret = $max2;
+                               }
+                       } else {
+                               $err = 'abovemaximum';
+                               $ret = $max;
+                       }
+               }
+               if ( $err !== null ) {
+                       $ex = new ValidationException( $name, $value, $settings, $err, [
+                               'min' => $min === null ? '' : $min,
+                               'max' => $max === null ? '' : $max,
+                               'max2' => $max2 === null ? '' : $max2,
+                       ] );
+                       if ( empty( $settings[self::PARAM_IGNORE_RANGE] ) ) {
+                               throw $ex;
+                       }
+                       $this->callbacks->recordCondition( $ex, $options );
+               }
+
+               return $ret;
+       }
+
+       public function normalizeSettings( array $settings ) {
+               if ( !isset( $settings[self::PARAM_MAX] ) ) {
+                       unset( $settings[self::PARAM_MAX2] );
+               }
+
+               if ( isset( $settings[self::PARAM_MAX2] ) && isset( $settings[self::PARAM_MAX] ) &&
+                       $settings[self::PARAM_MAX2] < $settings[self::PARAM_MAX]
+               ) {
+                       $settings[self::PARAM_MAX2] = $settings[self::PARAM_MAX];
+               }
+
+               return parent::normalizeSettings( $settings );
+       }
+
+       public function describeSettings( $name, array $settings, array $options ) {
+               $info = parent::describeSettings( $name, $settings, $options );
+
+               $min = $settings[self::PARAM_MIN] ?? '';
+               $max = $settings[self::PARAM_MAX] ?? '';
+               $max2 = $settings[self::PARAM_MAX2] ?? '';
+               if ( $max === '' || $max2 !== '' && $max2 <= $max ) {
+                       $max2 = '';
+               }
+
+               if ( empty( $options['compact'] ) ) {
+                       if ( $min !== '' ) {
+                               $info['min'] = $min;
+                       }
+                       if ( $max !== '' ) {
+                               $info['max'] = $max;
+                       }
+                       if ( $max2 !== '' ) {
+                               $info['max2'] = $max2;
+                       }
+               } else {
+                       $key = '';
+                       if ( $min !== '' ) {
+                               $key = 'min';
+                       }
+                       if ( $max2 !== '' ) {
+                               $key .= 'max2';
+                       } elseif ( $max !== '' ) {
+                               $key .= 'max';
+                       }
+                       if ( $key !== '' ) {
+                               $info[$key] = [ 'min' => $min, 'max' => $max, 'max2' => $max2 ];
+                       }
+               }
+
+               return $info;
+       }
+
+}
diff --git a/includes/libs/ParamValidator/TypeDef/LimitDef.php b/includes/libs/ParamValidator/TypeDef/LimitDef.php
new file mode 100644 (file)
index 0000000..99780c4
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+/**
+ * Type definition for "limit" types
+ *
+ * A limit type is an integer type that also accepts the magic value "max".
+ * IntegerDef::PARAM_MIN defaults to 0 for this type.
+ *
+ * @see IntegerDef
+ * @since 1.34
+ */
+class LimitDef extends IntegerDef {
+
+       /**
+        * @inheritDoc
+        *
+        * Additional `$options` accepted:
+        *  - 'parse-limit': (bool) Default true, set false to return 'max' rather
+        *    than determining the effective value.
+        */
+       public function validate( $name, $value, array $settings, array $options ) {
+               if ( $value === 'max' ) {
+                       if ( !isset( $options['parse-limit'] ) || $options['parse-limit'] ) {
+                               $value = $this->callbacks->useHighLimits( $options )
+                                       ? $settings[self::PARAM_MAX2] ?? $settings[self::PARAM_MAX] ?? PHP_INT_MAX
+                                       : $settings[self::PARAM_MAX] ?? PHP_INT_MAX;
+                       }
+                       return $value;
+               }
+
+               return parent::validate( $name, $value, $settings, $options );
+       }
+
+       public function normalizeSettings( array $settings ) {
+               $settings += [
+                       self::PARAM_MIN => 0,
+               ];
+
+               return parent::normalizeSettings( $settings );
+       }
+
+}
diff --git a/includes/libs/ParamValidator/TypeDef/PasswordDef.php b/includes/libs/ParamValidator/TypeDef/PasswordDef.php
new file mode 100644 (file)
index 0000000..289db54
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\ParamValidator\ParamValidator;
+
+/**
+ * Type definition for "password" types
+ *
+ * This is a string type that forces PARAM_SENSITIVE = true.
+ *
+ * @see StringDef
+ * @since 1.34
+ */
+class PasswordDef extends StringDef {
+
+       public function normalizeSettings( array $settings ) {
+               $settings[ParamValidator::PARAM_SENSITIVE] = true;
+               return parent::normalizeSettings( $settings );
+       }
+
+}
diff --git a/includes/libs/ParamValidator/TypeDef/PresenceBooleanDef.php b/includes/libs/ParamValidator/TypeDef/PresenceBooleanDef.php
new file mode 100644 (file)
index 0000000..2e1c8f5
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\ParamValidator\TypeDef;
+
+/**
+ * Type definition for checkbox-like boolean types
+ *
+ * This boolean is considered true if the parameter is present in the request,
+ * regardless of value. The only way for it to be false is for the parameter to
+ * be omitted entirely.
+ *
+ * The result from validate() is a PHP boolean.
+ *
+ * @since 1.34
+ */
+class PresenceBooleanDef extends TypeDef {
+
+       public function getValue( $name, array $settings, array $options ) {
+               return $this->callbacks->hasParam( $name, $options );
+       }
+
+       public function validate( $name, $value, array $settings, array $options ) {
+               return (bool)$value;
+       }
+
+       public function describeSettings( $name, array $settings, array $options ) {
+               $info = parent::describeSettings( $name, $settings, $options );
+               unset( $info['default'] );
+               return $info;
+       }
+
+}
diff --git a/includes/libs/ParamValidator/TypeDef/StringDef.php b/includes/libs/ParamValidator/TypeDef/StringDef.php
new file mode 100644 (file)
index 0000000..0ed310b
--- /dev/null
@@ -0,0 +1,88 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\ParamValidator\Callbacks;
+use Wikimedia\ParamValidator\ParamValidator;
+use Wikimedia\ParamValidator\TypeDef;
+use Wikimedia\ParamValidator\ValidationException;
+
+/**
+ * Type definition for string types
+ *
+ * The result from validate() is a PHP string.
+ *
+ * ValidationException codes:
+ *  - 'missingparam': The parameter is the empty string (and that's not allowed). No data.
+ *
+ * Additional codes may be generated when using certain PARAM constants. See
+ * the constants' documentation for details.
+ *
+ * @since 1.34
+ */
+class StringDef extends TypeDef {
+
+       /**
+        * (integer) Maximum length of a string in bytes.
+        *
+        * ValidationException codes:
+        *  - 'maxbytes': The string is too long. Data:
+        *     - 'maxbytes': The maximum number of bytes allowed
+        *     - 'maxchars': The maximum number of characters allowed
+        */
+       const PARAM_MAX_BYTES = 'param-max-bytes';
+
+       /**
+        * (integer) Maximum length of a string in characters (Unicode codepoints).
+        *
+        * The string is assumed to be encoded as UTF-8.
+        *
+        * ValidationException codes:
+        *  - 'maxchars': The string is too long. Data:
+        *     - 'maxbytes': The maximum number of bytes allowed
+        *     - 'maxchars': The maximum number of characters allowed
+        */
+       const PARAM_MAX_CHARS = 'param-max-chars';
+
+       protected $allowEmptyWhenRequired = false;
+
+       /**
+        * @param Callbacks $callbacks
+        * @param array $options Options:
+        *  - allowEmptyWhenRequired: (bool) Whether to reject the empty string when PARAM_REQUIRED.
+        *    Defaults to false.
+        */
+       public function __construct( Callbacks $callbacks, array $options = [] ) {
+               parent::__construct( $callbacks );
+
+               $this->allowEmptyWhenRequired = !empty( $options['allowEmptyWhenRequired'] );
+       }
+
+       public function validate( $name, $value, array $settings, array $options ) {
+               if ( !$this->allowEmptyWhenRequired && $value === '' &&
+                       !empty( $settings[ParamValidator::PARAM_REQUIRED] )
+               ) {
+                       throw new ValidationException( $name, $value, $settings, 'missingparam', [] );
+               }
+
+               if ( isset( $settings[self::PARAM_MAX_BYTES] )
+                       && strlen( $value ) > $settings[self::PARAM_MAX_BYTES]
+               ) {
+                       throw new ValidationException( $name, $value, $settings, 'maxbytes', [
+                               'maxbytes' => $settings[self::PARAM_MAX_BYTES] ?? '',
+                               'maxchars' => $settings[self::PARAM_MAX_CHARS] ?? '',
+                       ] );
+               }
+               if ( isset( $settings[self::PARAM_MAX_CHARS] )
+                       && mb_strlen( $value, 'UTF-8' ) > $settings[self::PARAM_MAX_CHARS]
+               ) {
+                       throw new ValidationException( $name, $value, $settings, 'maxchars', [
+                               'maxbytes' => $settings[self::PARAM_MAX_BYTES] ?? '',
+                               'maxchars' => $settings[self::PARAM_MAX_CHARS] ?? '',
+                       ] );
+               }
+
+               return $value;
+       }
+
+}
diff --git a/includes/libs/ParamValidator/TypeDef/TimestampDef.php b/includes/libs/ParamValidator/TypeDef/TimestampDef.php
new file mode 100644 (file)
index 0000000..5d0bf4e
--- /dev/null
@@ -0,0 +1,100 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\ParamValidator\Callbacks;
+use Wikimedia\ParamValidator\TypeDef;
+use Wikimedia\ParamValidator\ValidationException;
+use Wikimedia\Timestamp\ConvertibleTimestamp;
+use Wikimedia\Timestamp\TimestampException;
+
+/**
+ * Type definition for timestamp types
+ *
+ * This uses the wikimedia/timestamp library for parsing and formatting the
+ * timestamps.
+ *
+ * The result from validate() is a ConvertibleTimestamp by default, but this
+ * may be changed by both a constructor option and a PARAM constant.
+ *
+ * ValidationException codes:
+ *  - 'badtimestamp': The timestamp is not valid. No data, but the
+ *    TimestampException is available via Exception::getPrevious().
+ *  - 'unclearnowtimestamp': Non-fatal. The value is the empty string or "0".
+ *    Use 'now' instead if you really want the current timestamp. No data.
+ *
+ * @since 1.34
+ */
+class TimestampDef extends TypeDef {
+
+       /**
+        * (string|int) Timestamp format to return from validate()
+        *
+        * Values include:
+        *  - 'ConvertibleTimestamp': A ConvertibleTimestamp object.
+        *  - 'DateTime': A PHP DateTime object
+        *  - One of ConvertibleTimestamp's TS_* constants.
+        *
+        * This does not affect the format returned by stringifyValue().
+        */
+       const PARAM_TIMESTAMP_FORMAT = 'param-timestamp-format';
+
+       /** @var string|int */
+       protected $defaultFormat;
+
+       /** @var int */
+       protected $stringifyFormat;
+
+       /**
+        * @param Callbacks $callbacks
+        * @param array $options Options:
+        *  - defaultFormat: (string|int) Default for PARAM_TIMESTAMP_FORMAT.
+        *    Default if not specified is 'ConvertibleTimestamp'.
+        *  - stringifyFormat: (int) Format to use for stringifyValue().
+        *    Default is TS_ISO_8601.
+        */
+       public function __construct( Callbacks $callbacks, array $options = [] ) {
+               parent::__construct( $callbacks );
+
+               $this->defaultFormat = $options['defaultFormat'] ?? 'ConvertibleTimestamp';
+               $this->stringifyFormat = $options['stringifyFormat'] ?? TS_ISO_8601;
+       }
+
+       public function validate( $name, $value, array $settings, array $options ) {
+               // Confusing synonyms for the current time accepted by ConvertibleTimestamp
+               if ( !$value ) {
+                       $this->callbacks->recordCondition(
+                               new ValidationException( $name, $value, $settings, 'unclearnowtimestamp', [] ),
+                               $options
+                       );
+                       $value = 'now';
+               }
+
+               try {
+                       $timestamp = new ConvertibleTimestamp( $value === 'now' ? false : $value );
+               } catch ( TimestampException $ex ) {
+                       throw new ValidationException( $name, $value, $settings, 'badtimestamp', [], $ex );
+               }
+
+               $format = $settings[self::PARAM_TIMESTAMP_FORMAT] ?? $this->defaultFormat;
+               switch ( $format ) {
+                       case 'ConvertibleTimestamp':
+                               return $timestamp;
+
+                       case 'DateTime':
+                               // Eew, no getter.
+                               return $timestamp->timestamp;
+
+                       default:
+                               return $timestamp->getTimestamp( $format );
+               }
+       }
+
+       public function stringifyValue( $name, $value, array $settings, array $options ) {
+               if ( !$value instanceof ConvertibleTimestamp ) {
+                       $value = new ConvertibleTimestamp( $value );
+               }
+               return $value->getTimestamp( $this->stringifyFormat );
+       }
+
+}
diff --git a/includes/libs/ParamValidator/TypeDef/UploadDef.php b/includes/libs/ParamValidator/TypeDef/UploadDef.php
new file mode 100644 (file)
index 0000000..b436a6d
--- /dev/null
@@ -0,0 +1,116 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Psr\Http\Message\UploadedFileInterface;
+use Wikimedia\ParamValidator\TypeDef;
+use Wikimedia\ParamValidator\Util\UploadedFile;
+use Wikimedia\ParamValidator\ValidationException;
+
+/**
+ * Type definition for upload types
+ *
+ * The result from validate() is an object implementing UploadedFileInterface.
+ *
+ * ValidationException codes:
+ *  - 'badupload': The upload is not valid. No data.
+ *  - 'badupload-inisize': The upload exceeded the maximum in php.ini. Data:
+ *     - 'size': The configured size (in bytes).
+ *  - 'badupload-formsize': The upload exceeded the maximum in the form post. No data.
+ *  - 'badupload-partial': The file was only partially uploaded. No data.
+ *  - 'badupload-nofile': There was no file. No data.
+ *  - 'badupload-notmpdir': PHP has no temporary directory to store the upload. No data.
+ *  - 'badupload-cantwrite': PHP could not store the upload. No data.
+ *  - 'badupload-phpext': A PHP extension rejected the upload. No data.
+ *  - 'badupload-notupload': The field was present in the submission but was not encoded as
+ *    an upload. No data.
+ *  - 'badupload-unknown': Some unknown PHP upload error code. Data:
+ *     - 'code': The code.
+ *
+ * @since 1.34
+ */
+class UploadDef extends TypeDef {
+
+       public function getValue( $name, array $settings, array $options ) {
+               $ret = $this->callbacks->getUploadedFile( $name, $options );
+
+               if ( $ret && $ret->getError() === UPLOAD_ERR_NO_FILE &&
+                       !$this->callbacks->hasParam( $name, $options )
+               ) {
+                       // This seems to be that the client explicitly specified "no file" for the field
+                       // instead of just omitting the field completely. DWTM.
+                       $ret = null;
+               } elseif ( !$ret && $this->callbacks->hasParam( $name, $options ) ) {
+                       // The client didn't format their upload properly so it came in as an ordinary
+                       // field. Convert it to an error.
+                       $ret = new UploadedFile( [
+                               'name' => '',
+                               'type' => '',
+                               'tmp_name' => '',
+                               'error' => -42, // PHP's UPLOAD_ERR_* are all positive numbers.
+                               'size' => 0,
+                       ] );
+               }
+
+               return $ret;
+       }
+
+       /**
+        * Fetch the value of PHP's upload_max_filesize ini setting
+        *
+        * This method exists so it can be mocked by unit tests that can't
+        * affect ini_get() directly.
+        *
+        * @codeCoverageIgnore
+        * @return string|false
+        */
+       protected function getIniSize() {
+               return ini_get( 'upload_max_filesize' );
+       }
+
+       public function validate( $name, $value, array $settings, array $options ) {
+               static $codemap = [
+                       -42 => 'notupload', // Local from getValue()
+                       UPLOAD_ERR_FORM_SIZE => 'formsize',
+                       UPLOAD_ERR_PARTIAL => 'partial',
+                       UPLOAD_ERR_NO_FILE => 'nofile',
+                       UPLOAD_ERR_NO_TMP_DIR => 'notmpdir',
+                       UPLOAD_ERR_CANT_WRITE => 'cantwrite',
+                       UPLOAD_ERR_EXTENSION => 'phpext',
+               ];
+
+               if ( !$value instanceof UploadedFileInterface ) {
+                       // Err?
+                       throw new ValidationException( $name, $value, $settings, 'badupload', [] );
+               }
+
+               $err = $value->getError();
+               if ( $err === UPLOAD_ERR_OK ) {
+                       return $value;
+               } elseif ( $err === UPLOAD_ERR_INI_SIZE ) {
+                       static $prefixes = [
+                               'g' => 1024 ** 3,
+                               'm' => 1024 ** 2,
+                               'k' => 1024 ** 1,
+                       ];
+                       $size = $this->getIniSize();
+                       $last = strtolower( substr( $size, -1 ) );
+                       $size = intval( $size, 10 ) * ( $prefixes[$last] ?? 1 );
+                       throw new ValidationException( $name, $value, $settings, 'badupload-inisize', [
+                               'size' => $size,
+                       ] );
+               } elseif ( isset( $codemap[$err] ) ) {
+                       throw new ValidationException( $name, $value, $settings, 'badupload-' . $codemap[$err], [] );
+               } else {
+                       throw new ValidationException( $name, $value, $settings, 'badupload-unknown', [
+                               'code' => $err,
+                       ] );
+               }
+       }
+
+       public function stringifyValue( $name, $value, array $settings, array $options ) {
+               // Not going to happen.
+               return null;
+       }
+
+}
diff --git a/includes/libs/ParamValidator/Util/UploadedFile.php b/includes/libs/ParamValidator/Util/UploadedFile.php
new file mode 100644 (file)
index 0000000..2be9119
--- /dev/null
@@ -0,0 +1,141 @@
+<?php
+
+namespace Wikimedia\ParamValidator\Util;
+
+use Psr\Http\Message\UploadedFileInterface;
+use RuntimeException;
+use Wikimedia\AtEase\AtEase;
+
+/**
+ * A simple implementation of UploadedFileInterface
+ *
+ * This exists so ParamValidator needn't depend on any specific PSR-7
+ * implementation for a class implementing UploadedFileInterface. It shouldn't
+ * be used directly by other code, other than perhaps when implementing
+ * Callbacks::getUploadedFile() when another PSR-7 library is not already in use.
+ *
+ * @since 1.34
+ */
+class UploadedFile implements UploadedFileInterface {
+
+       /** @var array File data */
+       private $data;
+
+       /** @var bool */
+       private $fromUpload;
+
+       /** @var UploadedFileStream|null */
+       private $stream = null;
+
+       /** @var bool Whether moveTo() was called */
+       private $moved = false;
+
+       /**
+        * @param array $data Data from $_FILES
+        * @param bool $fromUpload Set false if using this task with data not from
+        *  $_FILES. Intended for unit testing.
+        */
+       public function __construct( array $data, $fromUpload = true ) {
+               $this->data = $data;
+               $this->fromUpload = $fromUpload;
+       }
+
+       /**
+        * Throw if there was an error
+        * @throws RuntimeException
+        */
+       private function checkError() {
+               switch ( $this->data['error'] ) {
+                       case UPLOAD_ERR_OK:
+                               break;
+
+                       case UPLOAD_ERR_INI_SIZE:
+                               throw new RuntimeException( 'Upload exceeded maximum size' );
+
+                       case UPLOAD_ERR_FORM_SIZE:
+                               throw new RuntimeException( 'Upload exceeded form-specified maximum size' );
+
+                       case UPLOAD_ERR_PARTIAL:
+                               throw new RuntimeException( 'File was only partially uploaded' );
+
+                       case UPLOAD_ERR_NO_FILE:
+                               throw new RuntimeException( 'No file was uploaded' );
+
+                       case UPLOAD_ERR_NO_TMP_DIR:
+                               throw new RuntimeException( 'PHP has no temporary folder for storing uploaded files' );
+
+                       case UPLOAD_ERR_CANT_WRITE:
+                               throw new RuntimeException( 'PHP was unable to save the uploaded file' );
+
+                       case UPLOAD_ERR_EXTENSION:
+                               throw new RuntimeException( 'A PHP extension stopped the file upload' );
+
+                       default:
+                               throw new RuntimeException( 'Unknown upload error code ' . $this->data['error'] );
+               }
+
+               if ( $this->moved ) {
+                       throw new RuntimeException( 'File has already been moved' );
+               }
+               if ( !isset( $this->data['tmp_name'] ) || !file_exists( $this->data['tmp_name'] ) ) {
+                       throw new RuntimeException( 'Uploaded file is missing' );
+               }
+       }
+
+       public function getStream() {
+               if ( $this->stream ) {
+                       return $this->stream;
+               }
+
+               $this->checkError();
+               $this->stream = new UploadedFileStream( $this->data['tmp_name'] );
+               return $this->stream;
+       }
+
+       public function moveTo( $targetPath ) {
+               $this->checkError();
+
+               if ( $this->fromUpload && !is_uploaded_file( $this->data['tmp_name'] ) ) {
+                       throw new RuntimeException( 'Specified file is not an uploaded file' );
+               }
+
+               // TODO remove the function_exists check once we drop HHVM support
+               if ( function_exists( 'error_clear_last' ) ) {
+                       error_clear_last();
+               }
+               $ret = AtEase::quietCall(
+                       $this->fromUpload ? 'move_uploaded_file' : 'rename',
+                       $this->data['tmp_name'],
+                       $targetPath
+               );
+               if ( $ret === false ) {
+                       $err = error_get_last();
+                       throw new RuntimeException( "Move failed: " . ( $err['message'] ?? 'Unknown error' ) );
+               }
+
+               $this->moved = true;
+               if ( $this->stream ) {
+                       $this->stream->close();
+                       $this->stream = null;
+               }
+       }
+
+       public function getSize() {
+               return $this->data['size'] ?? null;
+       }
+
+       public function getError() {
+               return $this->data['error'] ?? UPLOAD_ERR_NO_FILE;
+       }
+
+       public function getClientFilename() {
+               $ret = $this->data['name'] ?? null;
+               return $ret === '' ? null : $ret;
+       }
+
+       public function getClientMediaType() {
+               $ret = $this->data['type'] ?? null;
+               return $ret === '' ? null : $ret;
+       }
+
+}
diff --git a/includes/libs/ParamValidator/Util/UploadedFileStream.php b/includes/libs/ParamValidator/Util/UploadedFileStream.php
new file mode 100644 (file)
index 0000000..17eaaf4
--- /dev/null
@@ -0,0 +1,168 @@
+<?php
+
+namespace Wikimedia\ParamValidator\Util;
+
+use Exception;
+use Psr\Http\Message\StreamInterface;
+use RuntimeException;
+use Throwable;
+use Wikimedia\AtEase\AtEase;
+
+/**
+ * Implementation of StreamInterface for a file in $_FILES
+ *
+ * This exists so ParamValidator needn't depend on any specific PSR-7
+ * implementation for a class implementing UploadedFileInterface. It shouldn't
+ * be used directly by other code.
+ *
+ * @internal
+ * @since 1.34
+ */
+class UploadedFileStream implements StreamInterface {
+
+       /** @var resource File handle */
+       private $fp;
+
+       /** @var int|false|null File size. False if not set yet. */
+       private $size = false;
+
+       /**
+        * Call, throwing on error
+        * @param callable $func Callable to call
+        * @param array $args Arguments
+        * @param mixed $fail Failure return value
+        * @param string $msg Message prefix
+        * @return mixed
+        * @throws RuntimeException if $func returns $fail
+        */
+       private static function quietCall( callable $func, array $args, $fail, $msg ) {
+               // TODO remove the function_exists check once we drop HHVM support
+               if ( function_exists( 'error_clear_last' ) ) {
+                       error_clear_last();
+               }
+               $ret = AtEase::quietCall( $func, ...$args );
+               if ( $ret === $fail ) {
+                       $err = error_get_last();
+                       throw new RuntimeException( "$msg: " . ( $err['message'] ?? 'Unknown error' ) );
+               }
+               return $ret;
+       }
+
+       /**
+        * @param string $filename
+        */
+       public function __construct( $filename ) {
+               $this->fp = self::quietCall( 'fopen', [ $filename, 'r' ], false, 'Failed to open file' );
+       }
+
+       /**
+        * Check if the stream is open
+        * @throws RuntimeException if closed
+        */
+       private function checkOpen() {
+               if ( !$this->fp ) {
+                       throw new RuntimeException( 'Stream is not open' );
+               }
+       }
+
+       public function __destruct() {
+               $this->close();
+       }
+
+       public function __toString() {
+               try {
+                       $this->seek( 0 );
+                       return $this->getContents();
+               } catch ( Exception $ex ) {
+                       // Not allowed to throw
+                       return '';
+               } catch ( Throwable $ex ) {
+                       // Not allowed to throw
+                       return '';
+               }
+       }
+
+       public function close() {
+               if ( $this->fp ) {
+                       // Spec doesn't care about close errors.
+                       AtEase::quietCall( 'fclose', $this->fp );
+                       $this->fp = null;
+               }
+       }
+
+       public function detach() {
+               $ret = $this->fp;
+               $this->fp = null;
+               return $ret;
+       }
+
+       public function getSize() {
+               if ( $this->size === false ) {
+                       $this->size = null;
+
+                       if ( $this->fp ) {
+                               // Spec doesn't care about errors here.
+                               $stat = AtEase::quietCall( 'fstat', $this->fp );
+                               $this->size = $stat['size'] ?? null;
+                       }
+               }
+
+               return $this->size;
+       }
+
+       public function tell() {
+               $this->checkOpen();
+               return self::quietCall( 'ftell', [ $this->fp ], -1, 'Cannot determine stream position' );
+       }
+
+       public function eof() {
+               // Spec doesn't care about errors here.
+               return !$this->fp || AtEase::quietCall( 'feof', $this->fp );
+       }
+
+       public function isSeekable() {
+               return (bool)$this->fp;
+       }
+
+       public function seek( $offset, $whence = SEEK_SET ) {
+               $this->checkOpen();
+               self::quietCall( 'fseek', [ $this->fp, $offset, $whence ], -1, 'Seek failed' );
+       }
+
+       public function rewind() {
+               $this->seek( 0 );
+       }
+
+       public function isWritable() {
+               return false;
+       }
+
+       public function write( $string ) {
+               $this->checkOpen();
+               throw new RuntimeException( 'Stream is read-only' );
+       }
+
+       public function isReadable() {
+               return (bool)$this->fp;
+       }
+
+       public function read( $length ) {
+               $this->checkOpen();
+               return self::quietCall( 'fread', [ $this->fp, $length ], false, 'Read failed' );
+       }
+
+       public function getContents() {
+               $this->checkOpen();
+               return self::quietCall( 'stream_get_contents', [ $this->fp ], false, 'Read failed' );
+       }
+
+       public function getMetadata( $key = null ) {
+               $this->checkOpen();
+               $ret = self::quietCall( 'stream_get_meta_data', [ $this->fp ], false, 'Metadata fetch failed' );
+               if ( $key !== null ) {
+                       $ret = $ret[$key] ?? null;
+               }
+               return $ret;
+       }
+
+}
diff --git a/includes/libs/ParamValidator/ValidationException.php b/includes/libs/ParamValidator/ValidationException.php
new file mode 100644 (file)
index 0000000..c8d995e
--- /dev/null
@@ -0,0 +1,128 @@
+<?php
+
+namespace Wikimedia\ParamValidator;
+
+use Exception;
+use Throwable;
+use UnexpectedValueException;
+
+/**
+ * Error reporting for ParamValidator
+ *
+ * @since 1.34
+ */
+class ValidationException extends UnexpectedValueException {
+
+       /** @var string */
+       protected $paramName;
+
+       /** @var mixed */
+       protected $paramValue;
+
+       /** @var array */
+       protected $settings;
+
+       /** @var string */
+       protected $failureCode;
+
+       /** @var (string|int|string[])[] */
+       protected $failureData;
+
+       /**
+        * @param string $name Parameter name being validated
+        * @param mixed $value Value of the parameter
+        * @param array $settings Settings array being used for validation
+        * @param string $code Failure code. See getFailureCode() for requirements.
+        * @param (string|int|string[])[] $data Data for the failure code.
+        *  See getFailureData() for requirements.
+        * @param Throwable|Exception|null $previous Previous exception causing this failure
+        */
+       public function __construct( $name, $value, $settings, $code, $data, $previous = null ) {
+               parent::__construct( self::formatMessage( $name, $code, $data ), 0, $previous );
+
+               $this->paramName = $name;
+               $this->paramValue = $value;
+               $this->settings = $settings;
+               $this->failureCode = $code;
+               $this->failureData = $data;
+       }
+
+       /**
+        * Make a simple English message for the exception
+        * @param string $name
+        * @param string $code
+        * @param array $data
+        * @return string
+        */
+       private static function formatMessage( $name, $code, $data ) {
+               $ret = "Validation of `$name` failed: $code";
+               foreach ( $data as $k => $v ) {
+                       if ( is_array( $v ) ) {
+                               $v = implode( ', ', $v );
+                       }
+                       $ret .= "; $k => $v";
+               }
+               return $ret;
+       }
+
+       /**
+        * Fetch the parameter name that failed validation
+        * @return string
+        */
+       public function getParamName() {
+               return $this->paramName;
+       }
+
+       /**
+        * Fetch the parameter value that failed validation
+        * @return mixed
+        */
+       public function getParamValue() {
+               return $this->paramValue;
+       }
+
+       /**
+        * Fetch the settings array that failed validation
+        * @return array
+        */
+       public function getSettings() {
+               return $this->settings;
+       }
+
+       /**
+        * Fetch the validation failure code
+        *
+        * A validation failure code is a reasonably short string matching the regex
+        * `/^[a-z][a-z0-9-]*$/`.
+        *
+        * Users are encouraged to use this with a suitable i18n mechanism rather
+        * than relying on the limited English text returned by getMessage().
+        *
+        * @return string
+        */
+       public function getFailureCode() {
+               return $this->failureCode;
+       }
+
+       /**
+        * Fetch the validation failure data
+        *
+        * This returns additional data relevant to the particular failure code.
+        *
+        * Keys in the array are short ASCII strings. Values are strings or
+        * integers, or arrays of strings intended to be displayed as a
+        * comma-separated list. For any particular code the same keys are always
+        * returned in the same order, making it safe to use array_values() and
+        * access them positionally if that is desired.
+        *
+        * For example, the data for a hypothetical "integer-out-of-range" code
+        * might have data `[ 'min' => 0, 'max' => 100 ]` indicating the range of
+        * allowed values.
+        *
+        * @return (string|int|string[])[]
+        */
+       public function getFailureData() {
+               return $this->failureData;
+       }
+
+}
index d65d87b..9e80cf4 100644 (file)
@@ -1697,6 +1697,7 @@ class WikiPage implements Page, IDBAccessObject {
                        MediaWikiServices::getInstance()->getDBLoadBalancerFactory()
                );
 
+               $derivedDataUpdater->setLogger( LoggerFactory::getInstance( 'SaveParse' ) );
                $derivedDataUpdater->setRcWatchCategoryMembership( $wgRCWatchCategoryMembership );
                $derivedDataUpdater->setArticleCountMethod( $wgArticleCountMethod );
 
index 59f2db4..4808caf 100644 (file)
@@ -2775,7 +2775,7 @@ class Parser {
                                        # The vary-revision flag must be set, because the magic word
                                        # will have a different value once the page is saved.
                                        $this->mOutput->setFlag( 'vary-revision' );
-                                       wfDebug( __METHOD__ . ": {{PAGEID}} used in a new page, setting vary-revision...\n" );
+                                       wfDebug( __METHOD__ . ": {{PAGEID}} used in a new page, setting vary-revision" );
                                }
                                $value = $pageid ?: null;
                                break;
@@ -2792,13 +2792,14 @@ class Parser {
                                                $value = '-';
                                        } else {
                                                $this->mOutput->setFlag( 'vary-revision-exists' );
+                                               wfDebug( __METHOD__ . ": {{REVISIONID}} used, setting vary-revision-exists" );
                                                $value = '';
                                        }
                                } else {
                                        # Inform the edit saving system that getting the canonical output after
                                        # revision insertion requires another parse using the actual revision ID
                                        $this->mOutput->setFlag( 'vary-revision-id' );
-                                       wfDebug( __METHOD__ . ": {{REVISIONID}} used, setting vary-revision-id...\n" );
+                                       wfDebug( __METHOD__ . ": {{REVISIONID}} used, setting vary-revision-id" );
                                        $value = $this->getRevisionId();
                                        if ( $value === 0 ) {
                                                $rev = $this->getRevisionObject();
@@ -2828,17 +2829,13 @@ class Parser {
                                $value = $this->getRevisionTimestampSubstring( 0, 4, self::MAX_TTS, $index );
                                break;
                        case 'revisiontimestamp':
-                               # Let the edit saving system know we should parse the page
-                               # *after* a revision ID has been assigned. This is for null edits.
-                               $this->mOutput->setFlag( 'vary-revision' );
-                               wfDebug( __METHOD__ . ": {{REVISIONTIMESTAMP}} used, setting vary-revision...\n" );
-                               $value = $this->getRevisionTimestamp();
+                               $value = $this->getRevisionTimestampSubstring( 0, 14, self::MAX_TTS, $index );
                                break;
                        case 'revisionuser':
-                               # Let the edit saving system know we should parse the page
-                               # *after* a revision ID has been assigned for null edits.
+                               # Inform the edit saving system that getting the canonical output after
+                               # revision insertion requires a parse that used the actual user ID
                                $this->mOutput->setFlag( 'vary-user' );
-                               wfDebug( __METHOD__ . ": {{REVISIONUSER}} used, setting vary-user...\n" );
+                               wfDebug( __METHOD__ . ": {{REVISIONUSER}} used, setting vary-user" );
                                $value = $this->getRevisionUser();
                                break;
                        case 'revisionsize':
@@ -2986,7 +2983,7 @@ class Parser {
        /**
         * @param int $start
         * @param int $len
-        * @param int $mtts Max time-till-save; sets vary-revision if result might change by then
+        * @param int $mtts Max time-till-save; sets vary-revision-timestamp if result changes by then
         * @param string $variable Parser variable name
         * @return string
         */
@@ -2995,7 +2992,10 @@ class Parser {
                $resNow = substr( $this->getRevisionTimestamp(), $start, $len );
                # Possibly set vary-revision if there is not yet an associated revision
                if ( !$this->getRevisionObject() ) {
-                       # Get the timezone-adjusted timestamp $mtts seconds in the future
+                       # Get the timezone-adjusted timestamp $mtts seconds in the future.
+                       # This future is relative to the current time and not that of the
+                       # parser options. The rendered timestamp can be compared to that
+                       # of the timestamp specified by the parser options.
                        $resThen = substr(
                                $this->contLang->userAdjust( wfTimestamp( TS_MW, time() + $mtts ), '' ),
                                $start,
@@ -3003,10 +3003,10 @@ class Parser {
                        );
 
                        if ( $resNow !== $resThen ) {
-                               # Let the edit saving system know we should parse the page
-                               # *after* a revision ID has been assigned. This is for null edits.
-                               $this->mOutput->setFlag( 'vary-revision' );
-                               wfDebug( __METHOD__ . ": $variable used, setting vary-revision...\n" );
+                               # Inform the edit saving system that getting the canonical output after
+                               # revision insertion requires a parse that used an actual revision timestamp
+                               $this->mOutput->setFlag( 'vary-revision-timestamp' );
+                               wfDebug( __METHOD__ . ": $variable used, setting vary-revision-timestamp" );
                        }
                }
 
@@ -3728,6 +3728,7 @@ class Parser {
                                        // If we transclude ourselves, the final result
                                        // will change based on the new version of the page
                                        $this->mOutput->setFlag( 'vary-revision' );
+                                       wfDebug( __METHOD__ . ": self transclusion, setting vary-revision" );
                                }
                        }
                }
@@ -5892,7 +5893,7 @@ class Parser {
         *
         * The return value will be either:
         *   - a) Positive, indicating a specific revision ID (current or old)
-        *   - b) Zero, meaning the revision ID specified by getCurrentRevisionCallback()
+        *   - b) Zero, meaning the revision ID is specified by getCurrentRevisionCallback()
         *   - c) Null, meaning the parse is for preview mode and there is no revision
         *
         * @return int|null
@@ -5947,20 +5948,25 @@ class Parser {
        /**
         * Get the timestamp associated with the current revision, adjusted for
         * the default server-local timestamp
-        * @return string
+        * @return string TS_MW timestamp
         */
        public function getRevisionTimestamp() {
-               if ( is_null( $this->mRevisionTimestamp ) ) {
-                       $revObject = $this->getRevisionObject();
-                       $timestamp = $revObject ? $revObject->getTimestamp() : wfTimestampNow();
-
-                       # The cryptic '' timezone parameter tells to use the site-default
-                       # timezone offset instead of the user settings.
-                       # Since this value will be saved into the parser cache, served
-                       # to other users, and potentially even used inside links and such,
-                       # it needs to be consistent for all visitors.
-                       $this->mRevisionTimestamp = $this->contLang->userAdjust( $timestamp, '' );
+               if ( $this->mRevisionTimestamp !== null ) {
+                       return $this->mRevisionTimestamp;
                }
+
+               # Use specified revision timestamp, falling back to the current timestamp
+               $revObject = $this->getRevisionObject();
+               $timestamp = $revObject ? $revObject->getTimestamp() : $this->mOptions->getTimestamp();
+               $this->mOutput->setRevisionTimestampUsed( $timestamp ); // unadjusted time zone
+
+               # The cryptic '' timezone parameter tells to use the site-default
+               # timezone offset instead of the user settings.
+               # Since this value will be saved into the parser cache, served
+               # to other users, and potentially even used inside links and such,
+               # it needs to be consistent for all visitors.
+               $this->mRevisionTimestamp = $this->contLang->userAdjust( $timestamp, '' );
+
                return $this->mRevisionTimestamp;
        }
 
index afd6b2d..709f159 100644 (file)
@@ -895,7 +895,7 @@ class ParserOptions {
 
        /**
         * Timestamp used for {{CURRENTDAY}} etc.
-        * @return string
+        * @return string TS_MW timestamp
         */
        public function getTimestamp() {
                if ( !isset( $this->mTimestamp ) ) {
index 282d6ce..c8113f3 100644 (file)
@@ -213,6 +213,9 @@ class ParserOutput extends CacheTime {
        /** @var int|null Assumed rev ID for {{REVISIONID}} if no revision is set */
        private $mSpeculativeRevId;
 
+       /** @var int|null Assumed rev timestamp for {{REVISIONTIMESTAMP}} if no revision is set */
+       private $revisionTimestampUsed;
+
        /** string CSS classes to use for the wrapping div, stored in the array keys.
         * If no class is given, no wrapper is added.
         */
@@ -445,6 +448,22 @@ class ParserOutput extends CacheTime {
                return $this->mSpeculativeRevId;
        }
 
+       /**
+        * @param string $timestamp TS_MW timestamp
+        * @since 1.34
+        */
+       public function setRevisionTimestampUsed( $timestamp ) {
+               $this->revisionTimestampUsed = $timestamp;
+       }
+
+       /**
+        * @return string|null TS_MW timestamp or null if not used
+        * @since 1.34
+        */
+       public function getRevisionTimestampUsed() {
+               return $this->revisionTimestampUsed;
+       }
+
        public function &getLanguageLinks() {
                return $this->mLanguageLinks;
        }
index f45596f..05b6297 100644 (file)
@@ -389,9 +389,8 @@ abstract class Skin extends ContextSource {
 
        /**
         * Outputs the HTML generated by other functions.
-        * @param OutputPage|null $out
         */
-       abstract function outputPage( OutputPage $out = null );
+       abstract function outputPage();
 
        /**
         * @param array $data
index a7b7569..8b46ee9 100644 (file)
@@ -207,21 +207,10 @@ class SkinTemplate extends Skin {
        }
 
        /**
-        * initialize various variables and generate the template
-        *
-        * @param OutputPage|null $out
+        * Initialize various variables and generate the template
         */
-       function outputPage( OutputPage $out = null ) {
+       function outputPage() {
                Profiler::instance()->setTemplated( true );
-
-               $oldContext = null;
-               if ( $out !== null ) {
-                       // Deprecated since 1.20, note added in 1.25
-                       wfDeprecated( __METHOD__, '1.25' );
-                       $oldContext = $this->getContext();
-                       $this->setContext( $out->getContext() );
-               }
-
                $out = $this->getOutput();
 
                $this->initPage( $out );
@@ -231,10 +220,6 @@ class SkinTemplate extends Skin {
 
                // result may be an error
                $this->printOrError( $res );
-
-               if ( $oldContext ) {
-                       $this->setContext( $oldContext );
-               }
        }
 
        /**
index 126f07c..189c3a2 100644 (file)
        "history": "تاريخ الصفحة",
        "history_short": "التاريخ",
        "history_small": "تاريخ",
-       "updatedmarker": "عÙ\8fدÙ\84ت Ù\85Ù\86Ø° Ø²Ù\8aارتÙ\8a الأخيرة",
+       "updatedmarker": "عÙ\8fدÙ\90Ù\91Ù\84ت Ù\85Ù\86Ø° Ø²Ù\8aارتÙ\83 الأخيرة",
        "printableversion": "نسخة للطباعة",
        "permalink": "وصلة دائمة",
        "print": "اطبع",
index db8b3ef..0a3d39e 100644 (file)
        "pager-older-n": "{{PLURAL:$1|পুৰণতৰ ১|পুৰণতৰ $1}}",
        "suppress": "অমনোযোগ",
        "querypage-disabled": "কাৰ্য্যগত কাৰণত এই বিশেষ পৃষ্ঠাটো নিষ্ক্ৰিয় কৰা হৈছে।",
+       "apihelp-no-such-module": "\"$1\" মডিউল পোৱা নগ'ল।",
        "apisandbox-results": "ফলাফল",
        "apisandbox-continue": "অব্যাহত ৰাখক",
        "booksources": "গ্ৰন্থৰ উৎস সমূহ",
index e6122fc..23fc89c 100644 (file)
        "perfcached": "Aşağıdakı məlumatlar keş yaddaşdan götürülmüşdür və bu səbəbdən aktual olmaya bilər. A maximum of {{PLURAL:$1|one result is|$1 results are}} available in the cache.",
        "perfcachedts": "Aşağıdakı məlumatlar keş yaddaşdan götürülmüşdür və sonuncu dəfə $1 tarixində yenilənmişdir. A maximum of {{PLURAL:$4|one result is|$4 results are}} available in the cache.",
        "querypage-no-updates": "Bu an üçün güncəlləmələr sıradan çıxdı. Buradakı məlumat dərhal yenilənməyəcək.",
-       "viewsource": "Mənbə göstər",
+       "viewsource": "Kodu göstər",
        "viewsource-title": "$1 üçün mənbəyə bax",
        "actionthrottled": "Sürət məhdudiyyəti",
        "actionthrottledtext": "Spamla mübarizə məqsədilə qısa vaxt kəsiyi ərzində bu hərəkətlərin təkrarlanma sayı məhdudlaşdırılıb və siz qoyulan həddi aşmısınız.\nLütfən bir neçə dəqiqə sonra yenidən yoxlayın.",
index 4b5ef43..d47aaec 100644 (file)
        "searcharticle": "برا",
        "history": "دیمی تاریخ",
        "history_short": "دپتر",
-       "history_small": "تاریخچگ",
+       "history_small": "وھدگ",
        "updatedmarker": "په روچ بیتگین چه منی اهری  اهری  چارگ",
        "printableversion": "چاپی بھر",
        "permalink": "دایمی لینک",
        "difference-multipage": "(پرک مان تاک ان)",
        "lineno": "خط$1:",
        "compareselectedversions": "مقایسه انتخاب بوتگین نسخه یان",
-       "showhideselectedversions": "نمایش/پنهان کتن نسخ انتخابی",
+       "showhideselectedversions": "سۏج/جوان کنگ اے ورژنئی",
        "editundo": "خنثی کتن",
        "diff-empty": "(بئ پرک)",
        "diff-multi-sameuser": "({{PLURAL:$1|یک میانجیگین نسخگ|$1 میانجیگین نسخگ}} گون همجندیء کاربر که پیش دارگ نه بوتگ انت)",
        "action-editmyprivateinfo": "وتی پرایویت اینفارمیشنء ادیت بکن",
        "nchanges": "$1 {{PLURAL:$1|تغییر|تغییرات}}",
        "enhancedrc-since-last-visit": "$1 {{PLURAL:$1|چه آهریگین چارگ}}",
-       "enhancedrc-history": "تاریخچگ",
+       "enhancedrc-history": "وھدگ",
        "recentchanges": "نوکین تغییرات",
        "recentchanges-legend": "گزینه ی نوکین تغییرات",
        "recentchanges-summary": "رندگر نوکترین تغییرات ته ویکی تی ای صفحه.",
        "rc-enhanced-hide": "پناه کتن جزییات",
        "rc-old-title": "اڈ بیتگ گون «$1»",
        "recentchangeslinked": "مربوطین تغییرات",
-       "recentchangeslinked-feed": "مربوطین تغییرات",
-       "recentchangeslinked-toolbox": "مربوطین تغییرات",
+       "recentchangeslinked-feed": "امبندݔں ٹگلاں",
+       "recentchangeslinked-toolbox": "امبندݔں ٹگلاں",
        "recentchangeslinked-title": "تغییراتی مربوط په \"$1\"",
        "recentchangeslinked-summary": "شی یک لیستی چه تغییراتی هستنت که نوکی اعمال بوتگنت په صفحاتی که چه یک صفحه خاصی لینک بوته( یا په اعضای یک خاصین دسته).\nصفحات ته [[Special:Watchlist| شمی لیست چارگ]] '''' پررنگنت''''",
        "recentchangeslinked-page": "تاکدیمِ نام:",
        "filehist-datetime": "تاریح/زمان",
        "filehist-thumb": "بند انگشت",
        "filehist-thumbtext": "بندانگشتی از نسخهٔ مورخ $1",
-       "filehist-nothumb": "فاقد بندانگشتی",
+       "filehist-nothumb": "بندلنکُتکی نے",
        "filehist-user": "کاربر",
        "filehist-dimensions": "جنبه یان",
        "filehist-filesize": "اندازه فایل",
        "watchnologin": "وارد نه بی تگیت",
        "addedwatchtext": "صفحه  \"[[:$1]]\"  په شمی [[Special:Watchlist|watchlist]] هور بیت.\nدیمگی تغییرات په ای صفحه و آیاء صفحه گپ ادان لیست بنت، و صفحه پررنگ جاه کیت ته [[Special:RecentChanges|لیست نوکیت تغییرات]] په راحتر کتن شی که آی زورگ بیت.",
        "removedwatchtext": "صفحه\"[[:$1]]\"  چه [[Special:Watchlist|شمی لیست چارگ]]. دربیت.",
-       "watch": "به چار",
+       "watch": "چار",
        "watchthispage": "ای تاکدیما بگیند",
        "unwatch": "نه چارگ",
        "unwatchthispage": "چارگ بند کن",
        "watchlistedit-raw-done": "شمی لیست چارگ په روچ بیتگت",
        "watchlistedit-raw-added": "{{PLURAL:$1|1 عنوان انت|$1 عناوین ات}} اضافه بوت:",
        "watchlistedit-raw-removed": "{{PLURAL:$1|1 عنوان|$1 عناوین}} دور بوت:",
-       "watchlisttools-view": "مربوطین تغییرات بچار",
-       "watchlisttools-edit": "به چار و اصلاح کن لیست چارگ آ",
-       "watchlisttools-raw": "Ù\87اÙ\85Û\8cÙ\86 Ù\84Û\8cست Ú\86ارگ Ø¢ Ø§ØµÙ\84اح Ú©ن",
+       "watchlisttools-view": "امبندݔں ٹگلاں چار",
+       "watchlisttools-edit": "چارگءِ لیست‌ئا چار ءُ ٹگلݔنی",
+       "watchlisttools-raw": "Ù\84Û\8cست Ú\86ارگâ\80\8cئا Ù¹Ú¯Ù\84Ý\94ن",
        "iranian-calendar-m1": "فروردین",
        "iranian-calendar-m2": "اردیبهشت",
        "iranian-calendar-m3": "خرداد",
index 9ceaa6c..c347ae2 100644 (file)
        "history": "Гісторыя старонкі",
        "history_short": "Гісторыя",
        "history_small": "гісторыя",
-       "updatedmarker": "абноÑ\9eлена Ð· Ñ\87аÑ\81Ñ\83 Ð¼Ð°Ð¹Ð³Ð¾ апошняга наведваньня",
+       "updatedmarker": "абноÑ\9eлена Ð· Ñ\87аÑ\81Ñ\83 Ð²Ð°Ñ\88ага апошняга наведваньня",
        "printableversion": "Вэрсія для друку",
        "permalink": "Сталая спасылка",
        "print": "Друкаваць",
        "enotif_subject_deleted": "Старонка {{GRAMMAR:родны|{{SITENAME}}}} «$1» была выдаленая {{GENDER:$2|ўдзельнікам|ўдзельніцай}} $2",
        "enotif_subject_created": "Старонка {{GRAMMAR:родны|{{SITENAME}}}} «$1» была створаная {{GENDER:$2|ўдзельнікам|ўдзельніцай}} $2",
        "enotif_subject_moved": "Старонка {{GRAMMAR:родны|{{SITENAME}}}} «$1» была перанесеная {{GENDER:$2|ўдзельнікам|ўдзельніцай}} $2",
-       "enotif_subject_restored": "СÑ\82аÑ\80онка {{GRAMMAR:Ñ\80однÑ\8b|{{SITENAME}}}} Â«$1» Ð±Ñ\8bла Ð°Ð´Ð½Ð¾Ñ\9eленаÑ\8f {{GENDER:$2|Ñ\83дзелÑ\8cнÑ\96кам|Ñ\83дзельніцай}} $2",
-       "enotif_subject_changed": "СÑ\82аÑ\80онка {{GRAMMAR:Ñ\80однÑ\8b|{{SITENAME}}}} Â«$1» Ð±Ñ\8bла Ð·Ñ\8cмененаÑ\8f {{GENDER:$2|Ñ\83дзелÑ\8cнÑ\96кам|Ñ\83дзельніцай}} $2",
+       "enotif_subject_restored": "СÑ\82аÑ\80онка {{GRAMMAR:Ñ\80однÑ\8b|{{SITENAME}}}} Â«$1» Ð±Ñ\8bла Ð°Ð´Ð½Ð¾Ñ\9eленаÑ\8f {{GENDER:$2|Ñ\9eдзелÑ\8cнÑ\96кам|Ñ\9eдзельніцай}} $2",
+       "enotif_subject_changed": "СÑ\82аÑ\80онка {{GRAMMAR:Ñ\80однÑ\8b|{{SITENAME}}}} Â«$1» Ð±Ñ\8bла Ð·Ñ\8cмененаÑ\8f {{GENDER:$2|Ñ\9eдзелÑ\8cнÑ\96кам|Ñ\9eдзельніцай}} $2",
        "enotif_body_intro_deleted": "Старонка {{GRAMMAR:родны|{{SITENAME}}}} «$1» была выдаленая $PAGEEDITDATE {{GENDER:$2|удзельнікам|удзельніцай}} $2, глядзіце $3.",
        "enotif_body_intro_created": "Старонка {{GRAMMAR:родны|{{SITENAME}}}} «$1» была створаная $PAGEEDITDATE {{GENDER:$2|удзельнікам|удзельніцай}} $2, па цяперашнюю вэрсію глядзіце $3.",
        "enotif_body_intro_moved": "Старонка {{GRAMMAR:родны|{{SITENAME}}}} «$1» была перанесеная $PAGEEDITDATE {{GENDER:$2|удзельнікам|удзельніцай}} $2, па цяперашнюю вэрсію глядзіце $3.",
index d1906f5..99edfcb 100644 (file)
        "badretype": "تێپەڕوشەکان لەیەک ناچن.",
        "usernameinprogress": "دروستکردنی ھەژمارێک بۆ ئەم ناوی بەکارھێنەرە لە پڕۆسەی بەرھەمھێناندایە. تکایە چاوەڕوان بە.",
        "userexists": "ئەو ناوەی تۆ داوتە پێشتر بەکارھێنراوە.\nناوێکی دیکە ھەڵبژێرە.",
+       "createacct-normalization": "بەھۆی بەستنەوە تەکنیکییەکان ناوە بەکارھێنەرییەکەت دەگۆڕدرێت بۆ \"$2\".",
        "loginerror": "ھەڵەی چوونەژوورەوە",
        "createacct-error": "ھەڵە لە دروستکردنی ھەژمار",
        "createaccounterror": "ناتوانیت هەژماری بەکارهێنەر دروست بکەیت: $1",
        "tooltip-t-contributions": "پێڕستی بەشدارییەکانی {{GENDER:$1|ئەم بەکارھێنەرە}}",
        "tooltip-t-emailuser": "ئیمەیڵێک بنێرە بۆ {{GENDER:$1|ئەم بەکارھێنەرە}}",
        "tooltip-t-info": "زانیاری زیاتر لەبارەی ئەم پەڕەیەوە",
-       "tooltip-t-upload": "پەڕگە بار بکە",
+       "tooltip-t-upload": "پەڕگەکان بار بکە",
        "tooltip-t-specialpages": "پێڕستی ھەموو پەڕە تایبەتەکان",
        "tooltip-t-print": "وەشانی چاپی ئەم پەڕەیە",
        "tooltip-t-permalink": "گرێدەری ھەمیشەیی بۆ ئەم وەشانەی ئەم پەڕەیە",
index 946502e..f28fa42 100644 (file)
        "history": "Tarixê perrer",
        "history_short": "Veror",
        "history_small": "tarix",
-       "updatedmarker": "cı kewtena mına peyêne ra dıme biyo rocane",
+       "updatedmarker": "ziyaretê peyêni dıma biyo rocane",
        "printableversion": "Versiyonê çapkerdışi",
        "permalink": "Gıreyo daimi",
        "print": "Bınuşne",
        "redirectedfrom": "($1 ra kırışı yê)",
        "redirectpagesub": "Perra kırıştışi",
        "redirectto": "Kırışêno:",
-       "lastmodifiedat": "Ena perre roca $1 de, saete $2 de vırriye.",
+       "lastmodifiedat": "Ena pela roca $1 de, sehate $2 de vıriyaya",
        "viewcount": "Ena pele {{PLURAL:$1|rae|$1 rey}} vêniya.",
        "protectedpage": "Pera pawıyayi",
        "jumpto": "Şo be:",
        "mycustomjsprotected": "Desturê şıma çıniyo ke na pela JavaScripti bıvurnê.",
        "myprivateinfoprotected": "Ğısusi malumatana ğo timar kerdışire icazeta şıma çıniya.",
        "mypreferencesprotected": "Terciha timar kerdışire icazeta şıam çıniya.",
-       "ns-specialprotected": "Pelê xısusiyi nêşenê bıvurriyê.",
+       "ns-specialprotected": "Pelanê bağseya şıma nêşenê bıvurnê.",
        "titleprotected": "No sername terefê [[User:$1|$1]] ra, afernayene ra şevekiyayo.\nSebebê cı <em>$2</em> de deya yo.",
        "filereadonlyerror": "Dosyay vurnayışê \"$1\" nê abêno lakin depoy dosya da \"$2\" mod dê  salt wendi de yo.\n\nXızmetkarê  kılit kerdışi wa bewniro enay wa çım ra ravyarn o: \"$3\".",
        "invalidtitle": "Sernuşteyo nêravêrde",
        "viewpagelogs": "Qeydanê na pele bımocne",
        "nohistory": "Verorê vurnayışanê na perer çıni yo.",
        "currentrev": "Çımraviyarnayışo rocane",
-       "currentrev-asof": "Çımraviyarnayışê $1iyo peyên",
+       "currentrev-asof": "$1 ra tepiya weziyeta pela",
        "revisionasof": "Çımraviyarnayışê $1",
        "revision-info": "Vurnayışo ke $1 de terefê {{GENDER:$6|$2}}$7 ra biyo",
        "previousrevision": "← Çımraviyarnayışo kıhanêr",
        "difference-title": "Pela \"$1\" ferqê çım ra viyarnayışan",
        "difference-title-multipage": "Ferkê pelan dê \"$1\" u \"$2\"",
        "difference-multipage": "(Ferqê pelan)",
-       "lineno": "Xeta $1:",
+       "lineno": "Satır $1:",
        "compareselectedversions": "Rewizyonanê weçineyan pêver ke",
        "showhideselectedversions": "weçinaye revizyona bımotne/bınımne",
        "editundo": "peyser bıgê",
        "right-reupload-own": "Dosyeyê ke to bar kerdi, inan sero bınuse",
        "right-reupload-shared": "Dosyeyê ke ambarê medyao barekerde de, inan mehelli wedare",
        "right-upload_by_url": "Yew URL ra dosyeyan bar ke",
-       "right-purge": "Virê sita seba yew pele bêdestur bestere.",
+       "right-purge": "Qandê yew pela vervirê site bıesterne",
        "right-autoconfirmed": "Perê ke nême kılit biyê, inan bıvurne",
        "right-bot": "Zey yew karê otomatiki kar bıvêne",
        "right-nominornewtalk": "Pelanê werênayışan rê vurnayışê qıckeki çıniyê, qutiya mesacanê newiyan bıgurene",
        "right-sendemail": "Karberanê binî ra e-mail bişirav",
        "right-managechangetags": "[[Special:Tags|Etiketi]] vıraz u aktiv (me)ke",
        "right-applychangetags": "[[Special:Tags|Etiketa]]  vurnayışana piya dezge fi.",
+       "right-deletechangetags": "Database ra [[Special:Tags|etiketa]] bıesternê",
        "grant-generic": "\"$1\" paketa heqan",
        "grant-group-page-interaction": "Peran na tesiri",
        "grant-group-file-interaction": "Medya na tesiri",
        "action-applychangetags": "Vurnayışana piya etiket kerdışi zi dezge fi",
        "action-deletechangetags": "etitikan danegeh ra bestere",
        "action-purge": "Ane perer newe ke",
+       "action-editprotected": "\"{{int:protect-level-sysop}}\" şeveknaye pêlan de vırnayış bıkerê",
+       "action-editsemiprotected": "\"{{int:protect-level-autoconfirmed}}\" deyne şeveknaye pelan dê vurnayış bıkerê",
        "action-editinterface": "miyanriyê karberi bıvurne",
        "action-editusercss": "dosyeyanê CSSyê karberanê binan bıvurne",
        "action-edituserjson": "dosyeyanê JSONiyê karberanê binan bıvurne",
        "action-editmyusercss": "dosyeyanê CSSyê karberiya xo bıvurne",
        "action-editmyuserjson": "dosyeyanê JSONiyê karberiya xo bıvurne",
        "action-editmyuserjs": "dosyeyanê JavaScriptiyê karberiya xo bıvurne",
+       "action-viewsuppressed": "Karberan ra nımneyayen revizyona bıvênê",
+       "action-hideuser": "Yew nameyê karberi şari ra miyanki bloke bıkerê",
+       "action-ipblock-exempt": "Blokanê IPi, oto-blokan u blokanê menzıli ra ravêre",
+       "action-unblockself": "Blpqey ho wedarne",
        "nchanges": "$1 {{PLURAL:$1|vurnayış|vurnayışi}}",
        "enhancedrc-since-last-visit": "$1 {{PLURAL:$1|ziyaretê peyêni ra nata}}",
        "enhancedrc-history": "tarix",
        "rcfilters-hours-title": "Seatê peyêni",
        "rcfilters-days-show-days": "($1 {{PLURAL:$1|roce|roci}})",
        "rcfilters-days-show-hours": "($1 {{PLURAL:$1|saete|saeti}})",
+       "rcfilters-highlighted-filters-list": "Wesıbneyayeni:$1",
        "rcfilters-quickfilters": "Parzûnê qeydbiyayeyi",
        "rcfilters-quickfilters-placeholder-title": "Qet yew parzûn qeyd nêbiyo",
        "rcfilters-quickfilters-placeholder-description": "Eyaranê parzûni qeydkerdış u bahdo zi seba gurenayışi rê, cêr de simgeyanê cayanê parzûnanê aktifan bıtıknê.",
        "rcfilters-empty-filter": "Parzûnê aktifi çıniyê. İştırakê cı pêro mocniyenê.",
        "rcfilters-filterlist-title": "Parzûni",
        "rcfilters-filterlist-whatsthis": "Nê çıtewri guriyenê?",
+       "rcfilters-highlightbutton-title": "Neticeyê wesıbneyayeni",
        "rcfilters-highlightmenu-title": "Yew reng weçine",
        "rcfilters-filterlist-noresults": "Parzûni nêvêniyayi",
        "rcfilters-filtergroup-authorship": "Wayiriya iştırakan",
        "linkstoimage-redirect": "$1 (Dosya raçarnayış) $2",
        "duplicatesoffile": "a {{PLURAL:$1|dosya|$1 dosya}}, kopyayê na dosyayi ([[Special:FileDuplicateSearch/$2|teferruati]]):",
        "sharedupload": "Ena dosya $1 ra u belki projeyê binan dı hewitiyeno.",
-       "sharedupload-desc-there": "Na dosya depoyê $1 de esta u terefê proceyanê binan ra gureniyena. \nCêr dê [şınasiya dosyay pela $2] mocniyeno.",
-       "sharedupload-desc-here": "Na dosya depoyê $1 de esta u terefê proceyanê binan ra gureniyena. \nCêr dê [şınasiya dosyay pela $2] mocniyeno.",
+       "sharedupload-desc-there": "Na dosya depoyê $1 de esta u terefê proceyanê binan ra gureniyena. \nCêr dê [$2 şınasiya dosyay pela] mocniyeno.",
+       "sharedupload-desc-here": "Na dosya depoyê $1 de esta u terefê proceyanê binan ra gureniyena. \nCêr dê [$2 şınasiya dosyay pela] mocniyeno.",
        "sharedupload-desc-edit": "Na dosya $1 proceyan dê binandı ke şeno bıgurweyno.\nŞıma qayılê ke malumatê cı bıvurnê se şıre [pela da $2 ].",
        "sharedupload-desc-create": "Na dosya $1 proceyan dê binandı ke şeno bıgurweyno.\nŞıma qayılê ke malumatê cı bıvurnê se şıre [pela da $2 ].",
        "filepage-nofile": "Ena name de dosya çin o.",
        "delete-warning-toobig": "no pel wayirê tarixê vurnayiş ê derg o, $1 {{PLURAL:$1|revizyonê|revizyonê}} seri de.\nhewn a kerdışê ıney {{SITENAME}} şuxul bıne gırano;\nbı diqqet dewam kerê.",
        "deleteprotected": "Şıma nêşenê ena perer esternê,  çıkı per starya ya.",
        "rollback": "vurnayişan tepiya bıger",
+       "rollback-confirmation-confirm": "Araşt Kerê :",
        "rollback-confirmation-yes": "Peyser biya",
        "rollback-confirmation-no": "Bıtexelne",
        "rollbacklink": "ageyrayış",
        "mycontris": "İştıraki",
        "anoncontribs": "İştıraki",
        "contribsub2": "Qandê {{GENDER:$3|$1}} ($2)",
+       "contributions-subtitle": "Qandê {{GENDER:$3|$1}}",
        "contributions-userdoesnotexist": "Hesabê karberi \"$1\" qeyd nêbiyo.",
        "nocontribs": "Ena kriteriya de vurnayîş çini yo.",
        "uctop": "weziyet",
        "sp-contributions-newbies-sub": "Qe hesebê newe",
        "sp-contributions-newbies-title": "Hesabanê neweyan rê iştırakê karberi",
        "sp-contributions-blocklog": "qeydê kılitkerdışi",
+       "sp-contributions-suppresslog": "İştirakê {{GENDER:$1|karberiyê}} degusneyayey",
        "sp-contributions-deleted": "iştırakê {{GENDER:$1|karberi}} esterdi",
        "sp-contributions-uploads": "Barkerdışi",
        "sp-contributions-logs": "qeydi",
        "version": "Versiyon",
        "version-extensions": "Ekstensiyonî ke ronaye",
        "version-skins": "Bar kerde bejni",
-       "version-specialpages": "Pelê xısusiyi",
+       "version-specialpages": "Pelê bağsey",
        "version-parserhooks": "Çengelê Parserî",
        "version-variables": "Vurnayeyî",
        "version-editors": "Vurnayoği",
        "fileduplicatesearch-result-1": "Dosyayê ''$1î'' de hem-kopya çini yo.",
        "fileduplicatesearch-result-n": "Dosyayê ''$1î'' de {{PLURAL:$2|1 hem-kopya|$2 hem-kopyayî'}} esto.",
        "fileduplicatesearch-noresults": "Ebe namey \"$1\" ra dosya nêdiyayê.",
-       "specialpages": "Pelê xısusiyi",
+       "specialpages": "Pelê bağsey",
        "specialpages-note-top": "Kıtabek",
        "specialpages-note-restricted": "* Pelê xasê normali.\n* <span class=\"mw-specialpagerestricted\">Pelê xasê nımıtey.</span>",
-       "specialpages-group-maintenance": "Rapora pawıtışi",
-       "specialpages-group-other": "Pelê xısusiyê bini",
-       "specialpages-group-login": "Cı kewe / hesab vıraze",
-       "specialpages-group-changes": "Vurnayışê peyêni û qeydi",
-       "specialpages-group-media": "Raporê medya û barkerdışi",
-       "specialpages-group-users": "Karberi u heqê inan",
-       "specialpages-group-highuse": "Pelê ke zêdêr gureniyenê",
-       "specialpages-group-pages": "Listeyê pelan",
+       "specialpages-group-maintenance": "Raporê weynayışi",
+       "specialpages-group-other": "Pelê bağseyê bini",
+       "specialpages-group-login": "Ronıştış akerê / hesab vıraze",
+       "specialpages-group-changes": "Vurnayışê peyêni û Roceki",
+       "specialpages-group-media": "Raporê medyay u barkerdışi",
+       "specialpages-group-users": "Karberi u Heqi",
+       "specialpages-group-highuse": "Pelê zaf karnıyayey",
+       "specialpages-group-pages": "Listey peleyan",
        "specialpages-group-pagetools": "Haletê pelan",
        "specialpages-group-wiki": "Melumat u haceti",
-       "specialpages-group-redirects": "Pelê serşıkıtışiyê xısusiyi",
+       "specialpages-group-redirects": "Pelê bağseyê serşıkıtışini",
        "specialpages-group-spam": "haletê spami",
        "specialpages-group-developer": "Xacetanê raverberdoğî",
        "blankpage": "Pela venge",
        "htmlform-datetime-placeholder": "SSSS-AA-RR SS:DD:SS",
        "logentry-delete-delete": "$1 perra $3 {{GENDER:$2|esterıte}}",
        "logentry-delete-restore": "$1 pela $3 ($4) {{GENDER:$2|peyser arde}}",
+       "logentry-delete-restore-nocount": "$1, pela $3 {{GENDER:$2|timar kerd }}",
        "restore-count-revisions": "{{PLURAL:$1|1 çımraviyarnayış|$1 çımraviyarnayışi}}",
        "restore-count-files": "{{PLURAL:$1|1 dosya|$1 dosyeyi}}",
        "logentry-delete-event": "$1 $3: $4 de asayışê {{PLURAL:$5|cıkerdışi|cıkerdışan}} {{GENDER:$2|vurna}}",
        "revdelete-uname-unhid": "nameyê karberi nênımıteyo",
        "revdelete-restricted": "vergırewtışê ke xızmekaran rê biye",
        "revdelete-unrestricted": "vergırewtışê ke xızmekaran rê dariyê we",
+       "logentry-block-block": "$1, karber {{GENDER:$4|$3}} $5 demi rê {{GENDER:$2|kerd men}} $6",
+       "logentry-block-unblock": "$1, {{GENDER:$4|$3}} {{GENDER:$2|men kerdış wedarna}}",
        "logentry-partialblock-block-page": "{{PLURAL:$1|pele|peli}} $2",
        "logentry-partialblock-block-ns": "{{PLURAL:$1|cayê nameyi|cayê nameyan}} $2",
        "logentry-move-move": "$1, pela $3 ra {{GENDER:$2|kırışt}} pela $4",
        "mw-widgets-titlesmultiselect-placeholder": "Tayêna cı ke...",
        "date-range-from": "Nê tarixi ra:",
        "date-range-to": "Heta nê tarixi:",
+       "sessionprovider-generic": "Ronıştışê $1",
        "randomrootpage": "Pela raştameya rıçıkıne",
        "log-action-filter-block": "Tewrê kılitkerdışi:",
        "log-action-filter-contentmodel": "Tewrê vurnayışê modelê zerreki:",
        "log-action-filter-delete-revision": "Esterıtışê çımraviyarnayışi",
        "log-action-filter-import-interwiki": "Zerrenayışê Transwikiyi",
        "log-action-filter-import-upload": "Ebe barkerdışê XMLi ra zerre ke",
+       "log-action-filter-managetags-create": "Etiket vıraştış",
+       "log-action-filter-managetags-delete": "Etiket esternayış",
+       "log-action-filter-managetags-activate": "Etiket raştkerdış",
+       "log-action-filter-managetags-deactivate": "Etiket hewadayış",
+       "log-action-filter-newusers-autocreate": "Otomatik vıraştış",
+       "log-action-filter-patrol-patrol": "Dewriyeyo menuel",
+       "log-action-filter-patrol-autopatrol": "Dewriyeyo otomatik",
        "log-action-filter-protect-protect": "Şeveknayış",
        "log-action-filter-protect-modify": "Vurnayışê şeveknayışi",
        "log-action-filter-protect-unprotect": "Şeveknayışi wedare",
index 59d12ba..ffcdf09 100644 (file)
        "cachedspecial-refresh-now": "Προβολή τελευταίας.",
        "categories": "Κατηγορίες",
        "categories-submit": "Εμφάνιση",
-       "categoriespagetext": "{{PLURAL:$1|Η ακόλουθη κατηγορία υπάρχει|Οι ακόλουθες κατηγορίες υπάρχουν}} σε αυτό το wiki, και μπορεί ή μπορεί να μην είναι {{PLURAL:$1|αχρησιμοποίητη|αχρησιμοποίητες}}.\nΔείτε τις ενεργές Κατηγορίες στο [[:Κατηγορία:Βικιλεξικό|'''Βικιλεξικό''']]. Δείτε επίσης τις [[Special:WantedCategories|ζητούμενες κατηγορίες]].",
+       "categoriespagetext": "{{PLURAL:$1|Η ακόλουθη κατηγορία υπάρχει|Οι ακόλουθες κατηγορίες υπάρχουν}} σε αυτό το wiki, και μπορεί ή μπορεί να μην είναι {{PLURAL:$1|αχρησιμοποίητη|αχρησιμοποίητες}}. Δείτε επίσης τις [[Special:WantedCategories|ζητούμενες κατηγορίες]].",
        "categoriesfrom": "Εμφάνιση κατηγοριών που αρχίζουν από:",
        "deletedcontributions": "Διαγεγραμμένες συνεισφορές χρήστη",
        "deletedcontributions-title": "Διαγεγραμμένες συνεισφορές χρήστη",
index 760e8b8..597dca2 100644 (file)
        "tag-mw-new-redirect-description": "Redaktoj kiuj kreas novajn alidirektigilojn aŭ ŝanĝas paĝojn al alidirektigiloj",
        "tag-mw-removed-redirect": "Forigis alidirektilon",
        "tag-mw-removed-redirect-description": "Redaktoj kiuj ŝanĝas ekzistintan alidirektigilon al ne-alidirektigilon",
-       "tag-mw-changed-redirect-target": "Ŝanĝis celon de alidirektilon",
+       "tag-mw-changed-redirect-target": "Ŝanĝis celon de alidirektilo",
        "tag-mw-changed-redirect-target-description": "Redaktoj kiuj ŝanĝas la celon de alidirektigilo",
        "tag-mw-blank": "Vakigo",
        "tag-mw-blank-description": "Redaktoj kiuj vakigis paĝon",
index 41ff061..2a07679 100644 (file)
@@ -8,7 +8,8 @@
                        "Liuxinyu970226",
                        "PhiLiP",
                        "Qiyue2001",
-                       "Xiaomingyan"
+                       "Xiaomingyan",
+                       "神樂坂秀吉"
                ]
        },
        "exif-imagewidth": "宽度",
        "exif-copyrighted-false": "版权状态未设定",
        "exif-photometricinterpretation-0": "黑白(白为0)",
        "exif-photometricinterpretation-1": "黑白(黑为0)",
+       "exif-photometricinterpretation-3": "主色调",
        "exif-photometricinterpretation-4": "透明遮罩",
        "exif-photometricinterpretation-5": "分隔(可能是CMYK)",
+       "exif-photometricinterpretation-8": "CIE L*a*b*",
        "exif-photometricinterpretation-9": "CIE L*a*b*(ICC编码)",
        "exif-photometricinterpretation-10": "CIE L*a*b*(ITU编码)",
        "exif-photometricinterpretation-32803": "色彩滤镜矩阵",
index 80b83ae..58edc36 100644 (file)
        "title-invalid-leading-colon": "عنوان صفحهٔ درخواستی دارای دونقطهٔ نامجاز در ابتدایش است.",
        "perfcached": "داده‌های زیر از حافظهٔ نهانی فراخوانی شده‌اند و ممکن است کاملاً به‌روز نباشند. حداکثر {{PLURAL:$1|یک نتیجه| $1 نتیجه}} در حافظهٔ نهانی قابل دسترس است.",
        "perfcachedts": "داده‌های زیر از حافظهٔ نهانی فراخوانی شده‌اند و آخرین بار در $1 به‌روزرسانی شدند. حداکثر {{PLURAL:$4|یک نتیجه|$4 نتیجه}} در حافظهٔ نهانی قابل دسترس است.",
-       "querypage-no-updates": "اÙ\85کاÙ\86 Ø¨Ù\87â\80\8cرÙ\88زرساÙ\86Û\8c Ø§Û\8cÙ\86 ØµÙ\81Ø­Ù\87 Ù\81عÙ\84اÙ\8b ØºÛ\8cرÙ\81عاÙ\84 Ø´Ø¯Ù\87â\80\8cاست.\nاطÙ\84اعات Ø§Û\8cÙ\86 ØµÙ\81Ø­Ù\87 Ù\85Ù\85Ú©Ù\86 Ø§Ø³Øª Ø¨Ù\87â\80\8cرÙ\88ز Ù\86باشد.",
+       "querypage-no-updates": "رÙ\88زآÙ\85دسازÛ\8c Ø§Û\8cÙ\86 ØµÙ\81Ø­Ù\87 Ù\87Ù\85â\80\8cاکÙ\86Ù\88Ù\86 ØºÛ\8cر Ù\81عاÙ\84 Ø§Ø³Øª.\nدادÙ\87â\80\8cÙ\87اÛ\8c Ø§Û\8cÙ\86 ØµÙ\81Ø­Ù\87 Ø¯Ø± Ø­Ø§Ù\84 Ø­Ø§Ø¶Ø±Ø\8c Ø¨Ø§Ø²Ø¢Ù\88رÛ\8c Ù\86Ù\85Û\8câ\80\8cØ´Ù\88د.",
        "viewsource": "نمایش مبدأ",
        "viewsource-title": "نمایش مبدأ برای $1",
        "actionthrottled": "جلوی عمل شما گرفته شد",
        "botpasswords-created-title": "گذرواژه ربات ایجاد شد",
        "botpasswords-created-body": "گذرواژهٔ رباتی برای ربات «$1» و {{GENDER:$2|کاربر}} «$2» ایجاد شد.",
        "botpasswords-updated-title": "گذرواژه ربات روزآمد شد",
-       "botpasswords-updated-body": "گذرواژهٔ رباتی برای ربات «$1» و {{GENDER:$2|کاربر}} «$2» به‌روز شد.",
+       "botpasswords-updated-body": "گذرواژهٔ رباتی برای ربات «$1» {{GENDER:$2|کاربر}} «$2» روزآمد شد.",
        "botpasswords-deleted-title": "گذرواژه ربات حذف شد",
        "botpasswords-deleted-body": "گذرواژهٔ رباتی برای ربات «$1» و {{GENDER:$2|کاربر}} «$2» حذف شد.",
        "botpasswords-newpassword": "<strong>$2</strong> گذرواژهٔ جدید برای ورود با حساب <strong>$1</strong> است. <em>لطفاً آن را برای ارجاع در آینده ذخیره کنید.</em> <br> (برای ربات‌های قدیمی که نیاز به نام کاربری مطابق با حساب کاربری‌شان دارد، شما می‌توانید از <strong>$3</strong> به عنوان نام کاربری و از <strong>$4</strong> به عنوان گذرواژه استفاده کنید.)",
        "revdelete-unsuppress": "حذف محدودیت‌ها در بازبینی‌های ترمیم‌شده",
        "revdelete-log": "دلیل:",
        "revdelete-submit": "اعمال بر {{PLURAL:$1|نسخهٔ|نسخه‌های}} انتخاب شده",
-       "revdelete-success": "'''پیدایی نسخه به روز شد.'''",
+       "revdelete-success": "پیدایی بازنگری، روزآمد شد.",
        "revdelete-failure": "'''پیدایی نسخه‌ها قابل به روز کردن نیست:'''\n$1",
        "logdelete-success": "تغییر پیدایی مورد انجام شد.",
        "logdelete-failure": "'''پیدایی سیاهه‌ها قابل تنظیم نیست:'''\n$1",
        "pageswithprop-prophidden-binary": "جزییات مقدار مخفی باینری ($1)",
        "doubleredirects": "تغییرمسیرهای دوتایی",
        "doubleredirectstext": "این صفحه فهرستی از صفحه‌های تغییرمسیری را ارائه می‌کند که به صفحهٔ تغییرمسیر دیگری اشاره می‌کنند.\nهر سطر دربردارندهٔ پیوندهایی به تغییرمسیر اول و دوم و همچنین مقصد تغییرمسیر دوم است، که معمولاً صفحهٔ مقصد واقعی است و نخستین تغییرمسیر باید به آن اشاره کند.\nموارد <del>خط خورده</del> درست شده‌اند.",
-       "double-redirect-fixed-move": "[[$1]] انتقال داده شده‌است.\n\nبه صورت خودکار به‌روز شده‌است و  تغییرمسیری به [[$2]] داده شد.",
+       "double-redirect-fixed-move": "[[$1]] انتقال داده شده است.\nبه‌صورت خودکار روزآمد شده و هم‌اکنون به [[$2]] تغییر مسیر داده شده است.",
        "double-redirect-fixed-maintenance": "رفع خودکار تغییرمسیر دوتایی از [[$1]] به [[$2]] در روند نگهداری",
        "double-redirect-fixer": "تعمیرکار تغییرمسیرها",
        "brokenredirects": "تغییرمسیرهای خراب",
        "watchlistedit-raw-explain": "عنوان‌های موجود در فهرست پی‌گیری‌های شما در زیر نشان داده شده‌اند، و شما می‌توانید مواردی را حذف یا اضافه کنید؛ هر مورد در یک سطر جداگانه باید قرار بگیرد.\nدر پایان، دکمهٔ «{{int:Watchlistedit-raw-submit}}» را بفشارید.\nتوجه کنید که شما می‌توانید از [[Special:EditWatchlist|ویرایشگر استاندارد فهرست پی‌گیری‌ها]] هم استفاده کنید.",
        "watchlistedit-raw-titles": "عنوان‌ها:",
        "watchlistedit-raw-submit": "روزآمدسازی پی‌گیری‌ها",
-       "watchlistedit-raw-done": "Ù\81Ù\87رست Ù¾Û\8câ\80\8cÚ¯Û\8cرÛ\8câ\80\8cÙ\87اÛ\8c Ø´Ù\85ا Ø¨Ù\87 Ø±Ù\88ز شد.",
+       "watchlistedit-raw-done": "Ù\81Ù\87رست Ù¾Û\8câ\80\8cÚ¯Û\8cرÛ\8câ\80\8cÙ\87اÛ\8c Ø´Ù\85ا Ø±Ù\88زآÙ\85د شد.",
        "watchlistedit-raw-added": "$1 عنوان به فهرست پی‌گیری‌ها اضافه {{PLURAL:$1|شد|شدند}}:",
        "watchlistedit-raw-removed": "$1 عنوان حذف {{PLURAL:$1|شد|شدند}}:",
        "watchlistedit-clear-title": "پاک کردن فهرست پی‌گیری‌ها",
index cd3def4..f96d3bc 100644 (file)
        "protectedpagetext": "Dizze side is befeilige. Bewurkjen is net mooglik.",
        "viewsourcetext": "Jo kinne de boarnetekst fan dizze side besjen en kopiearje:",
        "protectedinterface": "Dizze side jout systeemteksten fan 'e software en is befeilige tsjin misbrûk. Asto oersettingen foar alle wiki's tafoegje of bewurkje wolst, kinsto [https://translatewiki.net/ translatewiki.net] brûke.",
-       "editinginterface": "<strong>Warskôging:</strong> Jo bewurkje in side dy't brûkt wurdt foar systeemteksten foar de software.\nBewurkings op dizze side beynfloedzje de meidoggersynterface fan elkenien.",
+       "editinginterface": "<strong>Warskôging:</strong> Jo bewurkje in side dy't brûkt wurdt foar systeemteksten fan de programmatuer.\nFeroarings oan dizze side beynfloedzje it oansjoch fan it meidoggersoerflak fan oaren op dizze wiki.",
        "cascadeprotected": "Dizze side is skoattele tsjin wizigjen, om't der in ûnderdiel útmakket fan de neikommende {{PLURAL:$1|side|siden}}, dy't skoattele {{PLURAL:$1|is|binne}} mei de \"ûnderlizzende siden\" opsje ynskeakele: $2",
        "namespaceprotected": "Jo hawwe gjin rjochten om siden yn'e nammeromte '''$1''' te bewurkjen.",
        "ns-specialprotected": "Siden yn'e nammerûmte {{ns:special}} kinne net bewurke wurde.",
        "editingsection": "Bewurkje $1 (seksje)",
        "editingcomment": "Bewurkjen fan $1 (nij mêd)",
        "editconflict": "Tagelyk bewurke: \"$1\"",
-       "explainconflict": "In oar hat de side feroare sûnt jo begûn binne mei it bewurkjen.\nIt earste bewurkingsfjild is hoe't de tekst wilens wurden is.\nJo feroarings stean yn it twadde fjild.\nDy wurde allinnich tapast safier as jo se yn it earste fjild ynpasse.\n'''Allinnich''' de tekst út it earste fjild kin fêstlein wurde.",
+       "explainconflict": "Immen oars hat dizze side feroare, nei't jo mei bewurkjen derfan begûn binne.\nIt bewurkingsfjild boppe befettet de sidetekst sa as it no is.\nJo wizigings wurde werjûn yn it tekstfjild ûnder.\nJo sille jo wizigings gearfoegje moatte mei de besteande tekst.\n<strong>Allinnich</strong> de tekst yn it bewurkingsfjild boppe wurdt bewarre at jo op \"$1\" drukke.",
        "yourtext": "Jo tekst",
        "storedversion": "Fêstleine ferzje",
        "editingold": "<strong>Warskôging: Jo binne dwaande mei in âldere ferzje fan dizze side.</strong>\nSoene jo dy fêstlizze, dan is alles wei wat sûnt dy tiid feroare is.",
        "rollbacklinkcount": "$1 {{PLURAL:$1|bewurking|bewurkings}} weromdraaie",
        "rollbacklinkcount-morethan": "mear as $1 {{PLURAL:$1|bewurking|bewurkings}} weromdraaie",
        "rollbackfailed": "Weromdraaien fan wizigings net slagge.",
-       "cantrollback": "Dizze feroaring kin net werom setten wurde, om't der mar ien skriuwer is.",
+       "cantrollback": "Kin de wiziging net ûngedien meitsje;\nde lêste bydrager is de iennichste bewurker fan dizze side.",
        "alreadyrolled": "Kin de wiziging fan [[:$1]] troch [[User:$2|$2]] ([[User talk:$2|oerlis]]{{int:pipe-separator}}[[Special:Contributions/$2|{{int:contribslink}}]]) net weromdraaie;\nin oar hat de wiziging weromdraaid, of oars wat oan de side feroare.\n\nDe lêste wiziging wie fan [[User:$3|$3]] ([[User talk:$3|oerlis]]{{int:pipe-separator}}[[Special:Contributions/$3|{{int:contribslink}}]]).",
        "editcomment": "De gearfetting wie: <em>$1</em>.",
        "revertpage": "Bewurkings fan [[Special:Contributions/$2|$2]] ([[User talk:$2|oerlis]]) weromset ta de lêste ferzje fan [[User:$1|$1]]",
        "whatlinkshere-hidetrans": "$1 transklúzjes",
        "whatlinkshere-hidelinks": "$1 keppelings",
        "whatlinkshere-filters": "Filters",
-       "blockip": "Slút {{GENDER:$1|meidogger}} út",
+       "blockip": "{{GENDER:$1|Meidogger|Meidochster}} útslute",
        "blockiptext": "Brûk dizze fjilden om in beskaat IP-adres of meidochnamme fan skriuwtagong út te sluten.\nDat soe allinnich dien wurde moatte fanwegen fandalisme of oar ûnakseptabel hâlden en dragen, sa't de\n[[{{MediaWiki:Policy-url}}|útslút-rie]] it oanjout.\nMeld de krekte reden! Neam bygelyks de siden dy't oantaaste waarden.\nJo kinne IP-adresrigen útslute mei de syntaksis fan [https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing CIDR]; de grutst tastiene rige is /$1 foar IPv4 en /$2 foar IPv6.",
        "ipaddressorusername": "IP-adres of meidochnamme:",
        "ipbreason": "Reden:",
index d7eb11f..a6d9c48 100644 (file)
        "virus-badscanner": "Loša konfiguracija: nepoznati skener za viruse: ''$1''",
        "virus-scanfailed": "skeniranje neuspješno (kod $1)",
        "virus-unknownscanner": "nepoznati antivirus:",
-       "logouttext": "'''Odjavili ste se.'''\n\nNeke se stranice mogu prikazivati kao da ste još uvijek prijavljeni, sve dok ne očistite međuspremnik svog preglednika.",
+       "logouttext": "<strong>Odjavljeni ste.</strong>\n\nNeke se stranice mogu prikazivati kao da ste još uvijek prijavljeni, sve dok ne očistite međuspremnik svog preglednika.",
        "logging-out-notify": "Odjavljujemo Vas, molimo pričekajte.",
        "cannotlogoutnow-title": "Odjava trenutno nije moguća",
        "cannotlogoutnow-text": "Odjava nije moguća tijekom uporabe $1.",
index dd290a3..f4017f4 100644 (file)
        "userlogin-createanother": "Másik felhasználói fiók létrehozása",
        "createacct-emailrequired": "E-mail-cím",
        "createacct-emailoptional": "E-mail-cím (opcionális)",
-       "createacct-email-ph": "Add meg e-mail-címed",
+       "createacct-email-ph": "Add meg az e-mail-címed",
        "createacct-another-email-ph": "Add meg az e-mail-címet",
        "createaccountmail": "Átmeneti, véletlenszerű jelszó beállítása és kiküldése a megadott e-mail-címre",
        "createaccountmail-help": "A jelszó megismerése nélkül készíthető valaki másnak fiók.",
index 41e4c54..a965592 100644 (file)
        "nolinkstoimage": "Nula pagino ligesas ad ica pagino.",
        "morelinkstoimage": "Videz [[Special:WhatLinksHere/$1|plusa ligili]] ad ica arkivo.",
        "linkstoimage-redirect": "$1 (arkivo ridirektita) $2",
-       "sharedupload": "Ca arkivo esas de $1 e posible esas uzata da altra projekti.",
+       "sharedupload": "Ca arkivo originis de $1 e posible esas uzata da altra projeti.",
        "sharedupload-desc-here": "Ca arkivo jacas en $1, e povas uzesar en altra projeti.\nLa deskriptado en lua [$2 pagino di deskriptado] montresas adinfre.",
        "sharedupload-desc-edit": "Ca arkivo venas de $1 e povas uzesar en altra projeti.\nPosible vu deziros redaktar ibe lua deskripto en [$2 lua deskripto-pagino].",
        "sharedupload-desc-create": "Ca arkivo venas de $1 e povas uzesar en altra projeti.\nPosible vu deziros redaktar ibe lua deskripto en [$2 lua deskripto-pagino].",
index 5e3bc65..4ec70e0 100644 (file)
        "createaccountblock": "registrazione bloccata",
        "emailblock": "e-mail bloccate",
        "blocklist-nousertalk": "non può modificare la propria pagina di discussione",
+       "blocklist-editing": "modifica",
+       "blocklist-editing-sitewide": "modifica (sito intero)",
        "blocklist-editing-page": "pagine",
        "blocklist-editing-ns": "namespace",
        "ipblocklist-empty": "L'elenco dei blocchi è vuoto.",
index 1a85840..ae0377a 100644 (file)
        "confirm-unwatch-top": "이 문서를 주시문서 목록에서 뺄까요?",
        "confirm-rollback-button": "확인",
        "confirm-rollback-top": "이 문서의 편집을 되돌리시겠습니까?",
-       "confirm-rollback-bottom": "ì\9d´ ì\9e\91ì\97\85ì\9d\80 ì\84 í\83\9dë\90\9c ë³\80ê²½ ì\82¬í\95­ì\9d\84 ì¦\89ì\8b\9c ë¡¤ë°±í\95©ë\8b\88ë\8b¤",
+       "confirm-rollback-bottom": "ì\9d´ ì\9e\91ì\97\85ì\9d\80 ì\9d´ ë¬¸ì\84\9cì\9d\98 ì\84 í\83\9dë\90\9c ë³\80ê²½ ì\82¬í\95­ì\9d\84 ì¦\89ì\8b\9c ë\90\98ë\8f\8c립ë\8b\88ë\8b¤.",
        "confirm-mcrrestore-title": "판 복구",
        "confirm-mcrundo-title": "변경사항 취소",
        "mcrundofailed": "실행 취소를 실패했습니다",
index 4f97e29..0ae2c67 100644 (file)
        "history": "Historique vun der Säit",
        "history_short": "Versiounen",
        "history_small": "Versiounen",
-       "updatedmarker": "geännert zanter ech d'Säit fir d'lescht gekuckt hunn",
+       "updatedmarker": "geännert zanter Ärem leschte Besuch",
        "printableversion": "Drockversioun",
        "permalink": "Zitéierfäege Link",
        "print": "Drécken",
index a93a0cb..dee85ef 100644 (file)
@@ -36,7 +36,7 @@
        "tog-enotifwatchlistpages": "ٱر یاٛ بٱلگٱ یا جانؽا د ساٛلٛ بٱرگ ماْ آلشت بۊئٱ ماْ ناْ ڤا ٱنجومانامٱ خڤٱر کو",
        "tog-enotifusertalkpages": "ڤٱختؽ کاْ بٱلگٱ سالفٱ کاریاریم آلشت کاری بی ماْ ناْ ڤا ٱنجومانامٱ خڤٱر کو",
        "tog-enotifminoredits": "ڤٱختؽ کاْ ڤیرایشؽا کوچکؽ د بٱلگٱیایا جانؽایا ٱنجوم بۊئٱ ماْ ناْ ڤارٱسیاری کو",
-       "tog-enotifrevealaddr": "تیر نشوݩ ٱنجومانامٱ ماْ ناْ د ٱنجومانامٱ دؽارکو دؽاری کو",
+       "tog-enotifrevealaddr": "تیرنشوݩ ٱنجومانامٱ ماْ ناْ د ٱنجومانامٱ دؽارکو دؽاری کو",
        "tog-shownumberswatching": "ٱندازٱ کاریارؽایی کاْ د هال ۉ بال دیئن هؽسن دؽاری کو",
        "tog-oldsig": "اْمزا ایسنی شما:",
        "tog-fancysig": "ڤا اْمزا چی یاٛ ڤیکی نیسسٱ رٱفتار کو",
        "filecopyerror": "نمۊئٱ جانؽا $1 د $2 ڤرداشتٱ بۊئٱ",
        "filerenameerror": "نمۊئٱ نوم جانؽا $1 د $2 آلشت کاری بۊئٱ.",
        "filedeleteerror": "نمۊئٱ جانؽا $1 پاکسا بۊئٱ.",
-       "directorycreateerror": "نمۊئٱ تیرنشونگٱاٛ$1 دۏرس بۊئٱ.",
+       "directorycreateerror": "نمۊئٱ تیرنشونگٱ$1 دۏرس بۊئٱ.",
        "directoryreadonlyerror": "فقٱت مۊئٱ تیرنشونگٱ \"$1\" ناْ بونی.",
        "directorynotreadableerror": "تیرنشونگٱ \"$1\" ڤٱننی نؽ.",
        "filenotfound": "نمؽ تونؽت جانؽا $1 ناْ بٱجۊرؽت.",
        "createaccount": "هساو دۏرس بٱکؽت",
        "userlogin-resetpassword-link": "رازینٱ گوئارسن تو د ڤیرتو رٱتٱ؟",
        "userlogin-helplink2": "هومیاری کردن د تٱریق ڤامؽن اوماین",
-       "userlogin-loggedin": "شما ایساْ چی یاٛ {{GENDER:$1|$1}} اومایتٱ ڤامؽن.نوم بٱلگٱ هاری ناْ سی ڤامؽن اوماین چی یاٛ کاریار هنی بٱلگٱ هاری سی ڤا مؽن اومابن چی یاٛ کاریار هنی ڤ کار باٛیرؽت.",
+       "userlogin-loggedin": "شما ایساْ چی یاٛ {{GENDER:$1|$1}} اومایتٱ ڤامؽن.نوم بٱلگٱ هاری ناْ سی ڤامؽن اوماین چی یاٛ کاریار هنی بٱلگٱ هاری سی ڤا مؽن اوماین چی یاٛ کاریار هنی ڤ کار باٛیرؽت.",
        "userlogin-createanother": "یاٛ هساو هنی دۏرس بٱکؽت",
        "createacct-emailrequired": "تیرنشوݩ ٱنجومانامٱ",
        "createacct-emailoptional": "تیرنشوݩ ٱنجومانامٱ",
        "search-relatedarticle": "مرتوط",
        "searchrelated": "مرتوط",
        "searchall": "همٱ",
-       "showingresults": "نمائشت بیشترونه {{PLURAL:$1|'''۱''' نتیجه|'''$1''' نتیجه}} د هار، شرو د شماره'''$2'''.",
-       "showingresultsinrange": "نمائشت بیشترونه {{PLURAL:$1|'''۱''' نتیجه|'''$1''' نتیجه}} د هار، شرو د شماره'''$2''' تا شماره '''$3'''.",
+       "showingresults": "نمایش بؽشترونٱ {{PLURAL:$1|'''۱''' نتیجٱ|'''$1''' نتیجٱ}} د هار، شرۊ د شمارٱ'''$2'''.",
+       "showingresultsinrange": "نمایش بؽشترونٱ {{PLURAL:$1|'''۱''' نتیجٱ|'''$1''' نتیجٱ}} د هار، شرۊ د شمارٱ'''$2''' تا شمارٱ '''$3'''.",
        "search-showingresults": "{{PLURAL:$4|نٱتیجٱیا<strong>$1</strong> د <strong>$3</strong>|نٱتیجٱیا<strong>$1 - $2</strong د <strong>$3</strong>}}",
        "search-nonefound": "هیچ نتیجاٛیؽ ڤا پاٛجۊری تو یٱکؽ نؽ.",
        "powersearch-legend": "پی جوری پیشکرده",
        "prefs-registration-date-time": "$1",
        "yourrealname": "نوم راستكی:",
        "yourlanguage": "زوٙن:",
-       "yourvariant": "Ù\85Û\8cÙ\86Ù\88Ù\86Ù\87 Ø¢Ù\84شتگر Ø²Ù\88Ù\86:",
-       "prefs-help-variant": "Ù\82سÙ\87 Ù\88رÛ\8c Ø§Ù\86تخاÙ\88Û\8c Ø´Ù\85ا Ø³Û\8c Ù\86Ù\85ائشت Ù\85Û\8cÙ\86Ù\88Ù\86Ù\87 Ø¨Ù\84Ú¯Ù\87 Û\8cا Ø¯ Ø§Û\8c Ù\88یکی.",
+       "yourvariant": "Ù\85Û\8cÙ\86Ù\88Ù\86Ù± Ø¢Ù\84شتگٱر Ø²Ú¤Ù\88Ý©:",
+       "prefs-help-variant": "Ù\82سٱ Ú¤Ø±Û\8c Ø§Ù\92Ù\86تخاÙ\88Û\8cÛ\8c Ø´Ù\85ا Ø³Û\8c Ù\86Ù\85اÛ\8cØ´ Ù\85Û\8cÙ\86Ù\88Ù\86Ù± Ø¨Ù±Ù\84Ú¯Ù±Û\8cا Ø¯ Ø§Ø½ Ú¤یکی.",
        "yournick": "امضا تازه:",
        "prefs-help-signature": "ویر و باوریا نیسسه بیه د بلگه چک چنه باید وا«<nowiki>~~~~</nowiki>» امضا بان؛ ای نشون وه شکل خودانجومی وه امضا شما و مؤر ویرگار تبدیل بوئه.",
        "badsig": "ئمضا خوم بی ئتئڤار.\nسأردیسیا ئچ تی ئم ئل نە ڤارئسی بأکیت.",
        "right-createtalk": "بلگه یا چک چنه نه راس بکید",
        "right-createaccount": "یه گل حساو کاروری تازه راس بکیت",
        "right-minoredit": "نشودار کردن همه ویرایشتیا چی حیرده",
-       "right-move": "بÙ\84Ú¯Ù\87 Û\8cا Ø¬Ø§ Ù\88Ù\87 جا کو",
-       "right-move-subpages": "بÙ\84Ú¯Ù\87 Û\8cا Ù\88 Ø²Û\8cر Ø¨Ù\84Ú¯Ù\87 Û\8cا Ø´Ù\88Ù\86Ù\87 Ø¬Ø§ Ù\88Ù\87 جا کو",
-       "right-move-rootuserpages": "بÙ\84Ú¯Ù\87 Û\8cا Ø±Û\8cØ´Ù\87 Ø§Û\8c Ú©Ø§Ø±Ù\88ر Ù\86Ù\87 Ø¬Ø§ Ù\88Ù\87 جا کو",
+       "right-move": "بٱÙ\84Ú¯Ù±Û\8cا Ù\86اÙ\92 Ø¬Ø§ Ú¤ جا کو",
+       "right-move-subpages": "بٱÙ\84Ú¯Ù±Û\8cا Û\89 Ø²Ø½Ø± Ø¨Ù±Ù\84Ú¯Ù±Û\8cا Ø´Ù\88Ù\86اÙ\92 Ø¬Ø§ Ú¤ جا کو",
+       "right-move-rootuserpages": "بٱÙ\84Ú¯Ù±Û\8cا Ø±Û\8cشاÙ\9bÛ\8cÛ\8c Ú©Ø§Ø±Û\8cار Ù\86اÙ\92 Ø¬Ø§ Ú¤ جا کو",
        "right-move-categorypages": "دسه بلگه یا نه جا وه جا بکیت",
-       "right-movefile": "جانیایا نه جا وه جا کو",
+       "right-movefile": "جانؽایا ناْ جا ڤ جا کو",
        "right-suppressredirect": "اوسه که بلگه یا د بین رئتنه هیچ واگردونی سی بلگه یا سرچشمه دروس نبیه",
        "right-upload": "سوار کردن جانیایا",
        "right-reupload": "سوارکرد هنی جانیایی که دماتر بئیشه",
        "action-createaccount": "هساو اؽ کاریار ناْ دۏرس بٱکؽت",
        "action-history": "ویرگار ای بلگه نه بوینیت",
        "action-minoredit": "ای ویرایشت نه چی یه حیرده ویرایشت نشو بیئت",
-       "action-move": "لی بلگه جا وه جا کو",
+       "action-move": "اؽ بٱلگٱ ناْ جا ڤ جا کو",
        "action-move-subpages": "ای بلگه و زیر بلگه یاشه جا وه جا بکید",
        "action-move-rootuserpages": "بلگه یا ریشه ای کاریار نه جا وه جا بکید",
        "action-move-categorypages": "جا وه جا کردن دسه بلگه یا",
        "upload-preferred": "جوٙرا حاستئنی جانیا {{PLURAL:$2|جوٙر|جوٙرا}}:$1 .",
        "upload-prohibited": "جورا جانیا صلادار:$1{{PLURAL:$2|.}}",
        "uploadlogpage": "سڤارکرد",
-       "uploadlogpagetext": "Ù\86Ù\88Ù\85Ú¯Ù\87 Ù\87ارÛ\8c Û\8cÙ\87 Ú¯Ù\84 Ù\86Ù\88Ù\85Ú¯Ù\87 Ø¯ Ø¢Ø®Ø±Û\8c Ø³Ù\88ارکرد Ø¬Ø§Ù\86Û\8cاÛ\8cا Ù\87ئ.\nسÛ\8c Ø¯ Ù\86Ù\88 Ø³Û\8cÙ\84 Ú©Ø±Ø¯Ù\86[[Special:NewFiles|عسگدÙ\88Ù\86Û\8c Ø¬Ø§Ù\86Û\8cاÛ\8cا ØªØ§Ø²Ù\87 Ù\86Ù\87]] Ø¨Ù\87 Ù\88Ù\86Û\8cت.",
+       "uploadlogpagetext": "Ù\86Ù\88Ù\85Ú¯Ù± Ù\87ارÛ\8c Û\8cاÙ\9b Ù\86Ù\88Ù\85Ú¯Ù± Ø¯ Ø¢Ø®Ø±Û\8c Ø³Ú¤Ø§Ø±Ú©Ø±Ø¯ Ø¬Ø§Ù\86ؽاÛ\8cا Ù\87ؽ.\nسÛ\8c Ø¯ Ù\86Û\8a Ø³Ø§Ù\9bÙ\84Ù\9b Ú©Ø±Ø¯Ù\86[[Special:NewFiles|عٱسگدÙ\88Ù\86Û\8c Ø¬Ø§Ù\86ؽاÛ\8cا ØªØ§Ø²Ù± Ù\86اÙ\92]] Ø¨Ú¤Ù±Ù\86ؽت.",
        "filename": "نوم جانیا",
        "filedesc": "چکسٱ",
        "fileuploadsummary": "چکسه",
        "filehist-comment": "ڤیر ۉ باڤٱر",
        "imagelinks": "ڤ کار گرتن جانؽا",
        "linkstoimage": "دۏنبال بيٱ {{PLURAL:$1|ديس ڤنؽا بٱلگٱ|$1 ديس ڤنؽا بٱلگٱيا}} د اؽ فایلٛ:",
-       "linkstoimage-more": "بؽشتر Ø¯ $1 Ø¨Ù±Ù\84Ú¯Ù± Ø¯ Ø§Ø½ Ø¬Ø§Ù\86ؽا Ù\87Ù\88Ù\85 Ù¾Ø§Ù\9bÚ¤Ù±Ù\86 {{PLURAL:$1|بٱ|بÛ\8cÙ\86Ù±}}.\nÙ\86Ù\88Ù\85Ú¯Ù± Ù\87ارÛ\8c ØªÙ±Ù\86ڳؽا{{PLURAL:$1|Ù±Ú¤Ù\84Û\8c Ù\87Ù\88Ù\85 Ù¾Ø§Ù\9bÚ¤Ù±Ù\86|Ù±Ú¤Ù\84Û\8c $1 Ù\87Ù\88Ù\85 Ù¾Ø§Ù\9bÚ¤Ù±Ù\86}} Ø¯ Ø½ Ø¨Ù±Ù\84Ú¯Ù± Ù\86اÙ\92 Ù\86Ø´Ù\88Ý© Ù\85ؽ یٱ.\n[[Special:WhatLinksHere/$2|نومگٱ کامل]] ٱم هؽسش.",
+       "linkstoimage-more": "بؽشتر Ø¯ $1 Ø¨Ù±Ù\84Ú¯Ù± Ø¯ Ø§Ø½ Ø¬Ø§Ù\86ؽا Ù\87Ù\88Ù\85 Ù¾Ø§Ù\9bÚ¤Ù±Ù\86 {{PLURAL:$1|بٱ|بÛ\8cÙ\86Ù±}}.\nÙ\86Ù\88Ù\85Ú¯Ù± Ù\87ارÛ\8c ØªÙ±Ù\86ڳؽا{{PLURAL:$1|Ù±Ú¤Ù\84Û\8c Ù\87Ù\88Ù\85 Ù¾Ø§Ù\9bÚ¤Ù±Ù\86|Ù±Ú¤Ù\84Û\8c $1 Ù\87Ù\88Ù\85 Ù¾Ø§Ù\9bÚ¤Ù±Ù\86}} Ø¯ Ø½ Ø¨Ù±Ù\84Ú¯Ù± Ù\86اÙ\92 Ù\86Ø´Ù\88Ý© Ù\85اÙ\9bیٱ.\n[[Special:WhatLinksHere/$2|نومگٱ کامل]] ٱم هؽسش.",
        "nolinkstoimage": "ایچاْ هیچ بٱلگاٛیی سی هوم پیاٛڤٱن بیئن ڤا اؽ جانؽا نؽ",
        "morelinkstoimage": " [[ویجه:چه هوم پیوندی ها ایچه/$1|هوم پیوندیا هنی]]سی ای جانیا نه بونیت.",
        "linkstoimage-redirect": "$1 (ڤاگٱردونی جانؽا) $2",
        "brokenredirectstext": "واگردونیا نهاتر د بلگه یایی که وجود نارن هوم پیوند بینه.",
        "brokenredirects-edit": "ڤیرایئشت",
        "brokenredirects-delete": "پاكسا كردن",
-       "withoutinterwiki": "بÙ\84Ú¯Ù\87 Û\8cاÛ\8cÛ\8c Ú©Ù\87 Ù\87Ù\88Ù\85 Ù¾Û\8cÙ\88Ù\86د Ø²Ù\88Ù\86 Ù\86ارÙ\86",
-       "withoutinterwiki-summary": "بÙ\84Ú¯Ù\87 Û\8cا Ù\87ارÛ\8c Ù\88Ù\87 Ø²Ù\88Ù\86 Ù\86سÙ\82Ù\87 Û\8cا Ø²Ù\88Ù\86ا ØªØ± Ù\87Ù\88Ù\85 Ù¾Û\8cÙ\88Ù\86د Ù\86بÛ\8cÙ\87.",
+       "withoutinterwiki": "بٱÙ\84Ú¯Ù±Û\8cاÛ\8cؽ Ú©Ø§Ù\92 Ù\87Ù\88Ù\85 Ù¾Ø§Ù\9bÚ¤Ù±Ù\86 Ø²Ú¤Ù\88Ý© Ù\86ارٱÙ\86",
+       "withoutinterwiki-summary": "بٱÙ\84Ú¯Ù±Û\8cا Ù\87ارÛ\8c Ú¤ Ø²Ú¤Ù\88Ý© Ù\86Û\8fسخٱÛ\8cا Ø²Ú¤Ù\88Ù\86ؽا ØªØ± Ù\87Ù\88Ù\85 Ù¾Ø§Ù\9bÚ¤Ù±Ù\86 Ù\86اÙ\9bئÛ\8cÙ\86Ù±.",
        "withoutinterwiki-legend": "پیشون",
        "withoutinterwiki-submit": "نشون دائن",
        "fewestrevisions": "بلگه یایی که کمتری وانئری نه دارن",
        "ntransclusions": "$1 {{PLURAL:$1|بلگه|بلگيا}} استفاده بیه",
        "specialpage-empty": "نتیجه ای د ای گزارشت نئ.",
        "lonelypages": "بلگه یا تک منه",
-       "lonelypagestext": "د Ø¨Ù\84Ú¯Ù\87 Û\8cا Ù\87ارÛ\8c Ù\87Û\8cÚ\86 Ø¨Ù\84Ú¯Ù\87 Ù\87Ù\86Û\8c Ø¯ {{SITENAME}} Ù\87Ù\88Ù\85 Ù¾Û\8cÙ\88Ù\86د Ù\86بÛ\8cÙ\87 Ù\88 Ø¯ Ù\87Û\8cÚ\86 Ø¨Ù\84Ú¯Ù\87 Ù\87Ù\86Û\8c Ù\85Û\8cÙ\86 Ú\86Û\8cÙ\86 Ù\86بÛ\8cÙ\87.",
+       "lonelypagestext": "د Ø¨Ù±Ù\84Ú¯Ù±Û\8cا Ù\87ارÛ\8c Ù\87Û\8cÚ\98 Ø¨Ù±Ù\84گاÙ\9b Ù\87Ù\86Û\8c Ø¯ {{SITENAME}} Ù\87Ù\88Ù\85 Ù¾Ø§Ù\9bÚ¤Ù±Ù\86 Ù\86اÙ\9bئÛ\8cÙ±Û\89 Ø¯ Ù\87Û\8cÚ\98 Ø¨Ù±Ù\84گاÙ\9b Ù\87Ù\86Û\8c Ù\85ؽÙ\86 Ú\86Û\8cÙ\86 Ù\86اÙ\9bئÛ\8cÙ±.",
        "uncategorizedpages": "بلگه یا دسه بنی نبیه",
        "uncategorizedcategories": "دسه یا دسه بنی نبیه",
        "uncategorizedimages": "فایلیا دسه بنی نبیه",
        "shortpages": "بلگه یا کؤچک",
        "longpages": "بلگه یا گپ",
        "deadendpages": "بلگه یا نابود بیئنی",
-       "deadendpagestext": "بÙ\84Ú¯Ù\87 Û\8cا Ù\87ارÛ\8c Ù\88Ù\87 Ù\87Û\8cÚ\86 Ø¨Ù\84Ú¯Ù\87 Ù\87Ù\86Û\8c Ø¯ {{SITENAME}} Ù\87Ù\88Ù\85 Ù¾Û\8cÙ\88Ù\86د Ù\86بÛ\8cÙ\86Ù\87.",
+       "deadendpagestext": "بٱÙ\84Ú¯Ù±Û\8cا Ù\87ارÛ\8c Ú¤ Ù\87Û\8cÚ\98 Ø¨Ù±Ù\84گاÙ\9b Ù\87Ù\86Û\8c Ø¯ {{SITENAME}} Ù\87Ù\88Ù\85 Ù¾Ø§Ù\9bÚ¤Ù±Ù\86 Ù\86اÙ\9bئÛ\8cÙ\86Ù±.",
        "protectedpages": "بلگه یا حفاظت بيه",
        "protectedpages-indef": "فقط پر و پیم بیین یا بی زمون",
        "protectedpages-summary": "د ای بلگه نومگه بلگه یایی هیئن که د ایسنی پر و پیم بینه. سی نومگه سرونیا که نبوئه دروس بان، سیل[[{{#special:ProtectedTitles}}|{{int:protectedtitles}}]]  بکیت.",
        "undeleterevisions": "$1 نسقه مال دیاری{{PLURAL:$1|بیه|بینه}}",
        "undeletehistory": "ار ای بلگه نه د نو زنه بکیت، همه نسقه یا وه د ویرگارچه ش د نو زنه بوئن.\nار بلگه تازه یی وا نوم هومبراوری د گات پاکسا بیین دروس بیه با، نسقه یا د نو زنه بیه د ویرگارچه ره وندیاری می کن.",
        "undeleterevdel": "ناپاکسا کردن بلگه یا د حال و باری که باعث پاکسا بیین بهرجایی د آخری نسقه بلگه یا جانیا با امکانش نئ.\nد ای حال و بار شما واس تازه تری نسقه پاکساگری بینه ئم د نو زنه بکیت.",
-       "undeletehistorynoadmin": "ای بلگه پاکسا بیه.\nدلیل پاکسا بیین ای بلگه واگرد مشخصات کاریاریایی که دما د پاکسا کردن ای بلگه نه ویرایشت دئنه ها د چکسته هاری.\nنیسسه راستیکی ای ویرایشت پاکسا بیه و فقط ها د دسرس دیوونداریا.",
+       "undeletehistorynoadmin": "اؽ بٱلگٱ پاکسا بیٱ.\nدلٛیلٛ پاکسا بیئن اؽ بٱلگٱ ڤاگرد موشٱخٱسؽا کاریارؽایؽ کاْ دما د پاکسا کردن اؽ بٱلگٱ ناْ ڤیرایش کردنٱ ها د چکسٱ هاری.\nنیسسٱ راسٱکی اؽ ڤیرایش پاکسا بیٱ ۉ فقٱت ها د دٱسرس دیڤوندارؽا.",
        "undelete-revision": "نسقه پاکسا بیه $1 (د ویرگار$4 ساعت $5) وه دس $3:",
        "undeleterevision-missing": "وانئری یا گم بیه یا نامعتوره.\nشایت هوم پیوند شما دروس نبوئه یا یه که ای وانئری د اماییه جا پاکسا بیه یا بازجست بیه.",
        "undelete-nodiff": "وانئری دماتری پیدا نبیه.",
        "lockfilenotwritable": "نبوئه قلف رسینه جا نه بنیسیت. سی یه بتونیت رسینه جا قلف بکیت یا قلفش وا بکیت، واس ای جانیا نیسسه یی بوئه.",
        "databasenotlocked": "رسینه گا وازه.",
        "lockedbyandtime": "(وا{{GENDER:$1|$1}} د $2 د$3)",
-       "move-page": "$1 جا وه جا کو",
-       "move-page-legend": "بÙ\84Ú¯Ù\87 Ù\86Ù\87 Ø¬Ø§ Ù\88Ù\87 جا کو",
+       "move-page": "$1 جا ڤ جا کو",
+       "move-page-legend": "بٱÙ\84Ú¯Ù± Ù\86اÙ\92 Ø¬Ø§ Ú¤ جا کو",
        "movepagetext": "وا وه کار گرتن نوم بلگه های نوم بلگه آلشت موئه، و همه ویرگارچه وه روئه وه نوم تازه ش.\nشما می تونیت آلشتکاری مسیریایی که وه داسون اصلی خوشو اشاره می کن نه وه هنگوم سازی بکیت.\nهوم پیوندیایی که چی بلگه دماترین، آلشتکاری نموئن؛ حتمن آلشت کاری مسیریا [[Special:DoubleRedirects|دوتایی]] یا [[Special:BrokenRedirects|خروا]] نه وارسی بکیت.\n'''شما''' مسئول یه دل بیین ده یه نیت که هوم پیوندیا هنی هان د هموچه که قراره روئن.\n\nد ویر داشوئیت که ار د دما یه گل بلگه د داسون تازه با بلگه\nجا وه جا '''نبوئه'''،\nمر یه آخری ویرایشت آلشتکاری مسیر با و د ویرگارچه ویرایشتی نبوئه.\nوه یئنی که ار اشتوا کردیته می تونیت بلگه نه د هموچه که جا وه جا بیه ورگردونیت و یه که نمی تونیت ری بلگه یا ایسنی بنیسیت. \n\n'''هشدار!'''\nجاوه جا کاری بلگه د نوم تازه شایت یه گل آلشتکاری پایه یی و ناحاستنی سی بلگه یا حاستنی با؛\nلطف بکیت یه دل بوئیت که دما د جا وه جا کاری بلگه، عاقوت ای کار نه دونیت.",
        "movepagetext-noredirectfixer": "وا وه کار گرتن نوم بلگه های نوم بلگه آلشت موئه، و همه ویرگارچه وه روئه وه نوم تازه ش.\nشما می تونیت آلشتکاری مسیریایی که وه داسون اصلی خوشو اشاره می کن نه وه هنگوم سازی بکیت.\nهوم پیوندیایی که چی بلگه دماترین، آلشتکاری نموئن؛ حتمن آلشت کاری مسیریا [[Special:DoubleRedirects|دوتایی]] یا [[Special:BrokenRedirects|خروا]] نه وارسی بکیت.\n'''شما''' مسئول یه دل بیین ده یه نیت که هوم پیوندیا هنی هان د هموچه که قراره روئن.\n\nد ویر داشوئیت که ار د دما یه گل بلگه د داسون تازه با بلگه\nجا وه جا '''نبوئه'''،\nمر یه آخری ویرایشت آلشتکاری مسیر با و د ویرگارچه ویرایشتی نبوئه.\nوه یئنی که ار اشتوا کردیته می تونیت بلگه نه د هموچه که جا وه جا بیه ورگردونیت و یه که نمی تونیت ری بلگه یا ایسنی بنیسیت. \n\n'''هشدار!'''\nجاوه جا کاری بلگه د نوم تازه شایت یه گل آلشتکاری پایه یی و ناحاستنی سی بلگه یا حاستنی با؛\nلطف بکیت یه دل بوئیت که دما د جا وه جا کاری بلگه، عاقوت ای کار نه دونیت.",
        "movepagetalktext": "بلگه چک چنه مربوطه، ار با، وه حال و بار خودانجوم واگرد گوتار اصلی جا وه جا کاری بوئه<strong>مر یه که:</strong>\n* شما د حال و بار جا وه جاکاری بلگه د ای نوم جا وه یه گل نوم جا هنی بوئیت.\n* یه گل بلگه چک چنه حال نبیه نه وا ای نوم با، یا \n* جعوه هاری نه نشودار نکردیته.\n\nد ای حال و باریا، واس بلگه نه دسی جا وه جاکاری بکیت یا مینونه یا دو بلگه نه وا ویرایشت یکی بکیت.",
        "cant-move-to-category-page": "شما صلا ینه که یه بلگه نه بوریت وه بلگه دسه ناریت.",
        "newtitle": "سی سرون هنی:",
        "move-watch": "دیئن بلگه سرچشمه و بلگه حاستنی",
-       "movepagebtn": "بÙ\84Ú¯Ù\87 Ø¬Ø§ Ù\88Ù\87 جا کو",
+       "movepagebtn": "بٱÙ\84Ú¯Ù± Ø¬Ø§ Ú¤ جا کو",
        "pagemovedsub": "د خوئی جا وه جا بیه",
        "movepage-moved": "<strong>\"$1\" جا وه جا بیه سی \"$2\"</strong>",
        "movepage-moved-redirect": "یه گل واگردونی دروس بیه.",
index ac5d598..565a91d 100644 (file)
@@ -36,7 +36,7 @@
                ]
        },
        "tog-underline": "കണ്ണികൾക്ക് അടിവരയിടുക:",
-       "tog-hideminor": "à´ªàµ\81തിയ à´®à´¾à´±àµ\8dà´±à´\99àµ\8dà´\99à´³àµ\81à´\9fàµ\86 à´ªà´\9fàµ\8dà´\9fà´¿à´\95യിൽ à´\9aàµ\86റിയ തിരുത്തുകൾ മറയ്ക്കുക",
+       "tog-hideminor": "സമàµ\80à´ªà´\95ാല à´®à´¾à´±àµ\8dà´±à´\99àµ\8dà´\99à´³àµ\81à´\9fàµ\86 à´ªà´\9fàµ\8dà´\9fà´¿à´\95യിൽ à´\9aàµ\86à´±àµ\81തിരുത്തുകൾ മറയ്ക്കുക",
        "tog-hidepatrolled": "റോന്തുചുറ്റിയ തിരുത്തുകൾ പുതിയമാറ്റങ്ങളിൽ മറയ്ക്കുക",
        "tog-newpageshidepatrolled": "റോന്തുചുറ്റപ്പെട്ട താളുകൾ പുതിയതാളുകളുടെ പട്ടികയിൽ മറയ്ക്കുക",
        "tog-hidecategorization": "താളുകളുടെ വർഗ്ഗീകരണം മറയ്ക്കുക",
        "history": "നാൾവഴി",
        "history_short": "നാൾവഴി",
        "history_small": "നാൾവഴി",
-       "updatedmarker": "à´\95à´´à´¿à´\9eàµ\8dà´\9e à´¸à´¨àµ\8dദർശനതàµ\8dതിനàµ\8d à´¶àµ\87à´·à´\82 à´®à´¾à´±àµ\8dà´±à´\82 à´µà´¨àµ\8dà´¨ത്",
+       "updatedmarker": "à´\95à´´à´¿à´\9eàµ\8dà´\9e à´¸à´¨àµ\8dദർശനതàµ\8dതിനàµ\8d à´¶àµ\87à´·à´\82 à´ªàµ\81à´¤àµ\81à´\95àµ\8dà´\95à´ªàµ\8dà´ªàµ\86à´\9fàµ\8dà´\9fത്",
        "printableversion": "അച്ചടിരൂപം",
        "permalink": "സ്ഥിരംകണ്ണി",
        "print": "അച്ചടിയ്ക്കുക",
        "title-invalid-magic-tilde": "ആവശ്യപ്പെട്ട താൾ തലക്കെട്ടിൽ അസാധുവായ മാന്ത്രിക ടിൽഡേ പരമ്പര ഉൾപ്പെടുന്നു (<nowiki>~~~</nowiki>).",
        "title-invalid-too-long": "ഈ തലക്കെട്ടിന്റെ നീളം കൂടുതലാണു്. UTF-8 എൻകോഡിങ്ങിൽ തലക്കെട്ടുകൾക്ക് $1 {{PLURAL:$1|ബൈറ്റിലധികം|ബൈറ്റുകളിലധികം}} നീളമുണ്ടാകാൻ പാടില്ല.",
        "title-invalid-leading-colon": "ആവശ്യപ്പെട്ട താൾ തലക്കെട്ടിന്റെയാദ്യം അസാധുവായ അപൂർണ്ണവിരാമം ഉൾപ്പെടുന്നു.",
-       "perfcached": "താഴെ കൊടുത്തിരിക്കുന്ന വിവരം ശേഖരിച്ചു വെച്ചിരിക്കുന്നതാണ്, അതുകൊണ്ട് ചിലപ്പോൾ പുതിയതായിരിക്കണമെന്നില്ല. ശേഖരിച്ചുവെച്ചിരിക്കുന്നവയിൽ പരമാവധി {{PLURAL:$4|ഒരു ഫലം|$4 ഫലങ്ങൾ}} ആണ് ഉണ്ടാവുക.",
+       "perfcached": "താഴെ കൊടുത്തിരിക്കുന്ന വിവരം ശേഖരിച്ചു വെച്ചിരിക്കുന്നതാണ്, അതുകൊണ്ട് ചിലപ്പോൾ പുതിയതായിരിക്കണമെന്നില്ല. ശേഖരിച്ചുവെച്ചിരിക്കുന്നവയിൽ പരമാവധി {{PLURAL:$1|ഒരു ഫലം|$1 ഫലങ്ങൾ}} ആണ് ഉണ്ടാവുക.",
        "perfcachedts": "താഴെയുള്ള വിവരങ്ങൾ ശേഖരിച്ചുവെച്ചവയിൽ പെടുന്നു, അവസാനം പുതുക്കിയത് $1-നു ആണ്‌. ശേഖരിച്ചുവെച്ചിരിക്കുന്നവയിൽ പരമാവധി {{PLURAL:$4|ഒരു ഫലം|$4 ഫലങ്ങൾ}} ആണ് ഉണ്ടാവുക.",
        "querypage-no-updates": "ഈ താളിന്റെ പുതുക്കൽ തൽക്കാലം നടക്കുന്നില്ല. ഇവിടുള്ള വിവരങ്ങൾ ഏറ്റവും പുതിയതാവണമെന്നില്ല.",
        "viewsource": "മൂലരൂപം കാണുക",
        "passwordpolicies-policyflag-forcechange": "ലോഗിൻ മാറ്റിയിരിക്കണം",
        "passwordpolicies-policyflag-suggestchangeonlogin": "ലോഗിൻ മാറ്റാൻ നിർദ്ദേശിക്കുന്നു",
        "unprotected-js": "സുരക്ഷാകാരണങ്ങളാൽ സംരക്ഷണമില്ലാത്ത താളുകളിൽ നിന്നും ജാവാസ്ക്രിപ്റ്റ് എടുത്തുപയോഗിക്കാൻ കഴിയില്ല. ജാവാസ്ക്രിപ്റ്റ് താളുകൾ മീഡിയവിക്കി: നാമമേഖലയിലോ ഉപയോക്തൃ ഉപതാളായോ മാത്രം സൃഷ്ടിക്കുക",
-       "userlogout-continue": "താà´\99àµ\8dà´\95ൾ à´ªàµ\81റതàµ\8dà´¤àµ\8d à´\95à´\9fà´\95àµ\8dà´\95ാൻ à´\86à´\97àµ\8dരഹിà´\95àµ\8dà´\95àµ\81à´¨àµ\8dà´¨àµ\81à´µàµ\86à´\99àµ\8dà´\95ിൽ [$1 à´²àµ\8bà´\97àµ\8d à´\94à´\9fàµ\8dà´\9fàµ\8d à´¤à´¾à´³à´¿à´²àµ\87à´\95àµ\8dà´\95àµ\8d à´¤àµ\81à´\9fà´°àµ\81à´\95]."
+       "userlogout-continue": "à´ªàµ\81റതàµ\8dà´¤àµ\81à´\95à´\9fà´\95àµ\8dà´\95à´£àµ\8b?"
 }
index f5cb6ff..2878062 100644 (file)
        "history": "စာမျက်နှာ ရာဇဝင်",
        "history_short": "ရာဇဝင်",
        "history_small": "ရာဇဝင်",
-       "updatedmarker": "နောက်ဆုံးကြည့်ပြီးသည့်နောက်ပိုင်း တည်းဖြတ်ထားသည်",
+       "updatedmarker": "နောက်ဆုံးကြည့်ပြီးသည့်နောက်ပိုင်း တည်းဖြတ်ထားသည်",
        "printableversion": "ပရင့်ထုတ်နိုင်သော ဗားရှင်း",
        "permalink": "ပုံ​သေ​လိပ်​စာ​",
        "print": "ပရင့်ထုတ်",
        "filerenameerror": "ဖိုင် \"$1\" ကို \"$2\" သို့ အမည်ပြောင်းမရပါ။",
        "filedeleteerror": "ဖိုင် \"$1\" ကို ဖျက်မရပါ။",
        "directorycreateerror": "လမ်းညွှန် \"$1\" ကို ဖန်တီးမရနိုင်ပါ။",
+       "directoryreadonlyerror": "လမ်းညွှန် \"$1\" သည် ဖတ်ရှုရန်သာဖြစ်သည်။",
+       "directorynotreadableerror": "လမ်းညွှန် \"$1\" သည် ဖတ်ရှု၍မရနိုင်ပါ။",
        "filenotfound": "ဖိုင် \"$1\" ကို ရှာမတွေ့ပါ။",
+       "unexpected": "မမျော်လင့်ထားသောတန်ဖိုး: \"$1\"=\"$2\"",
        "formerror": "အမှား - ဖောင်သွင်းနိုင်ခြင်းမရှိပါ",
        "badarticleerror": "ဤလုပ်ဆောင်မှုအား ဤစာမျက်နှာတွင် လုပ်ဆောင်၍ မရနိုင်ပါ။",
        "cannotdelete": "\"$1\" စာမျက်နှာ သို့မဟုတ် ဖိုင်ကို ဖျက်၍ မရပါ။\nတစ်စုံတစ်ဦးမှ ဖျက်နှင့်ပြီး ဖြစ်နိုင်ပါသည်။",
        "cannotdelete-title": "\"$1\" စာမျက်နှာကို ဖျက်၍ မရပါ",
+       "delete-scheduled": "စာမျက်နှာ \"$1\" ကို ဖျက်ပစ်ရန် ရက်သတ်မှတ်ထားသည်။ ကျေးဇူးပြု၍ စိတ်ရှည်ပါ။",
        "delete-hook-aborted": "ရှင်းလင်းပြချက် မပေးထားပါ။",
        "badtitle": "ညံ့ဖျင်းသော ခေါင်းစဉ်",
        "badtitletext": "တောင်းဆိုထားသော စာမျက်နှာ ခေါင်းစဉ်သည် တရားမဝင်ပါ (သို့) ဗလာဖြစ်နေသည် (သို့) အခြားဘာသာများ(inter-language or inter-wiki title)သို့ မှားယွင်းစွာ လင့်ချိတ်ထားသည်။",
        "grant-blockusers": "အသုံးပြုသူများအား ပိတ်ပင်ခြင်းနှင့် ပိတ်ပင်မှု ဖယ်ရှားခြင်း",
        "grant-createaccount": "အကောင့်များ ဖန်တီးရန်",
        "grant-createeditmovepage": "စာမျက်နှာများကို ဖန်တီး၊ တည်းဖြတ်၊ ရွေ့ပြောင်းရန်",
-       "grant-editmyoptions": "á\80\9eá\80\84á\80ºá\81\8fá\80¡á\80\9eá\80¯á\80¶á\80¸á\80\95á\80¼á\80¯á\80\9eá\80° á\80¡á\80\95á\80¼á\80\84á\80ºá\80¡á\80\86á\80\84á\80ºá\80\99á\80»á\80¬á\80¸ကို ပြင်ရန်",
+       "grant-editmyoptions": "á\80\9eá\80\84á\80ºá\81\8fá\80¡á\80\9eá\80¯á\80¶á\80¸á\80\95á\80¼á\80¯á\80\9eá\80° á\80\9bá\80½á\80±á\80¸á\80\81á\80»á\80\9aá\80ºá\80\85á\80\9bá\80¬á\80\99á\80»á\80¬á\80¸á\80\94á\80¾á\80\84á\80·á\80º JSON á\80¡á\80\95á\80¼á\80\84á\80ºá\80¡á\80\86á\80\84á\80ºကို ပြင်ရန်",
        "grant-editmywatchlist": "သင့် စောင့်ကြည့်စာရင်းကို တည်းဖြတ်ရန်",
        "grant-editpage": "ရှိပြီးသား စာမျက်နှာများကို တည်းဖြတ်ရန်",
        "grant-editprotected": "ကာကွယ်ထားသော စာမျက်နှာများကို တည်းဖြတ်ရန်",
        "delete-confirm": "\"$1\"ကို ဖျက်ပါ",
        "delete-legend": "ဖျက်",
        "historywarning": "<strong>သတိပေးချက်။</strong> သင်ဖျက်ပစ်တော့မည့် စာမျက်နှာတွင် {{PLURAL:$1|တည်းဖြတ်မူ|တည်းဖြတ်မူများ}} $1 ခု ရှိနေသည်-",
-       "historyaction-submit": "ပြသရန်",
+       "historyaction-submit": "á\80\95á\80¼á\80\94á\80ºá\80\9cá\80\8aá\80ºá\80\95á\80¼á\80\84á\80ºá\80\86á\80\84á\80ºá\80\99á\80¾á\80¯á\80\99á\80»á\80¬á\80¸á\80\80á\80­á\80¯ á\80\95á\80¼á\80\9eá\80\9bá\80\94á\80º",
        "confirmdeletetext": "သင်သည် စာမျက်နှာတစ်ခုကို ယင်း၏ မှတ်တမ်းများနှင့်တကွ ဖျက်ပစ်တော့မည် ဖြစ်သည်။\nဤသို့ ဖျက်ပစ်ရန် သင် အမှန်တကယ် ရည်ရွယ်လျက်  နောက်ဆက်တွဲ အကျိုးဆက်များကို သိရှိနားလည်ပြီး [[{{MediaWiki:Policy-url}}|မူဝါဒ]] အတိုင်းလုပ်ဆောင်နေခြင်းဖြစ်ကြောင်းကို အတည်ပြုပေးပါ။",
        "actioncomplete": "လုပ်ဆောင်ချက် ပြီးပြီ",
        "actionfailed": "ဆောင်ရွက်မှုမအောင်မြင်ပါ",
        "blocklist-editing-page": "စာမျက်နှာများ",
        "blocklist-editing-ns": "အမည်ညွှန်းများ",
        "ipblocklist-empty": "ပိတ်ပင်ထားမှုစာရင်းသည် ဗလာဖြစ်နေသည်။",
-       "ipblocklist-no-results": "á\80\90á\80±á\80¬á\80\84á\80ºá\80¸á\80\86á\80­á\80¯á\80\9cá\80­á\80¯á\80\80á\80ºá\80\9eá\80±á\80¬ á\80¡á\80­á\80¯á\80\84á\80ºá\80\95á\80®á\80\9cá\80­á\80\95á\80ºá\80\85á\80¬ á\80\9eá\80­á\80¯á\80·á\80\99á\80\9fá\80¯á\80\90á\80º á\80¡á\80\9eá\80¯á\80¶á\80¸á\80\95á\80¼á\80¯á\80\9eá\80°á\80¡á\80\99á\80\8aá\80ºá\80\80á\80­á\80¯ á\80\99á\80\95á\80­á\80\90á\80ºá\80\95á\80\84á\80ºá\80\91á\80¬á\80¸ပါ။",
+       "ipblocklist-no-results": "á\80\90á\80±á\80¬á\80\84á\80ºá\80¸á\80\86á\80­á\80¯á\80\9cá\80­á\80¯á\80\80á\80ºá\80\9eá\80±á\80¬ á\80¡á\80­á\80¯á\80\84á\80ºá\80\95á\80®á\80\9cá\80­á\80\95á\80ºá\80\85á\80¬ á\80\9eá\80­á\80¯á\80·á\80\99á\80\9fá\80¯á\80\90á\80º á\80¡á\80\9eá\80¯á\80¶á\80¸á\80\95á\80¼á\80¯á\80\9eá\80°á\80¡á\80\99á\80\8aá\80ºá\80\90á\80½á\80\84á\80º á\80\80á\80­á\80¯á\80\80á\80ºá\80\8aá\80®á\80\9eá\80±á\80¬á\80\95á\80­á\80\90á\80ºá\80\95á\80\84á\80ºá\80\91á\80¬á\80¸á\80\86á\80®á\80¸á\80\99á\80¾á\80¯á\80\80á\80­á\80¯ á\80\99á\80\90á\80½á\80±á\80·á\80\9bá\80¾á\80­ပါ။",
        "blocklink": "ပိတ်ပင်",
        "unblocklink": "မပိတ်ပင်တော့ရန်",
        "change-blocklink": "စာကြောင်းအမည် ပြောင်းရန်",
        "protectedpagemovewarning": "<strong>သတိပေးချက်။</strong> ဤစာမျက်နှာအား စီမံခန့်ခွဲသူအဆင့်ရှိသူများသာ ရွှေ့ပြောင်းနိုင်ရန် ကာကွယ်ထားသည်။\nနောက်ဆုံးမှတ်တမ်းအား ကိုးကားနိုင်ရန် အောက်တွင် ဖော်ပြထားသည်။",
        "semiprotectedpagemovewarning": "<strong>မှတ်ချက်။</strong> ဤစာမျက်နှာအား အလိုအလျောက် အတည်ပြုထားသော အသုံးပြုသူအဆင့်ရှိသူများသာ ရွှေ့ပြောင်းနိုင်ရန် ကာကွယ်ထားသည်။\nနောက်ဆုံးမှတ်တမ်းအား ကိုးကားနိုင်ရန် အောက်တွင် ဖော်ပြထားသည်။",
        "export": "စာမျက်နှာများကို တင်ပို့ရန်",
+       "exportall": "စာမျက်နှာများအားလုံးကို တင်ပို့ရန်",
        "export-submit": "တင်ပို့ရန်",
        "export-addcattext": "ကဏ္ဍမှ စာမျက်နှာများကို ပေါင်းထည့်ရန် -",
        "export-addcat": "ပေါင်းထည့်ရန်",
        "export-addnstext": "အမည်ညွှန်းမှ စာမျက်နှာများကို ပေါင်းထည့်ရန်",
        "export-addns": "ပေါင်းထည့်ရန်",
        "export-download": "ဖိုင်အဖြစ် သိမ်းရန်",
+       "export-templates": "တမ်းပလိတ်များ ပါဝင်မည်",
        "allmessages": "စနစ်၏ သတင်းများ",
        "allmessagesname": "အမည်",
        "allmessagesdefault": "ပုံမှန် အသိပေးချက် စာသား",
        "importinterwiki": "အခြားဝီကီမှ တင်သွင်းရန်",
        "import-interwiki-sourcewiki": "ရင်းမြစ် ဝီကီ:",
        "import-interwiki-sourcepage": "ရင်းမြစ် စာမျက်နှာ:",
+       "import-interwiki-templates": "တမ်းပလိတ်များအားလုံး ပါဝင်မည်",
        "import-interwiki-submit": "တင်သွင်းရန်",
        "import-upload-filename": "ဖိုင်အမည် -",
        "import-comment": "မှတ်ချက် -",
        "import-token-mismatch": "session data ဆုံးရှုံးမှု ဖြစ်ပါသည်။\n\nသင်သည် အကောင့်မှ ထွက်လိုက်တာဖြစ်နိုင်သည်။  <strong>အကောင့်ထဲသို့ ဝင်ထားနေခြင်းဖြစ်အောင် အတည်ပြုပြီး ထပ်မံကြိုးစားကြည့်ပါ</strong>။\nအကယ်၍ အလုပ်မဖြစ်သေးပါက [[Special:UserLogout|အကောင့်မှထွက်]]ပြီးနောက် ထပ်မံလော့ဂ်အင်ဝင်ရောက်ပါ။ သင်၏ဘရောက်ဆာက ဤဝဘ်ဆိုဒ်မှ cookie ကို ခွင့်ပြုထားကြောင့် စစ်ဆေးပေးပါ။",
        "importlogpage": "ထည့်သွင်းသည့် မှတ်တမ်း",
        "importlogpagetext": "အခြားဝီကီများမှ အက်ဒမင်ဆိုင်ရာ တည်းဖြတ်မှုရာဇဝင်နှင့် စာမျက်နှာ တင်သွင်းမှုများ",
+       "javascripttest-pagetext-unknownaction": "အမည်မသိ လုပ်ဆောင်ချက် \"$1\"။",
+       "javascripttest-qunit-intro": "[$1 စမ်းသပ်မှုစာရွက်စာတမ်း] ကို mediawiki.org ပေါ်တွင်ကြည့်ပါ။",
        "tooltip-pt-userpage": "{{GENDER:|သင်၏ အသုံးပြုသူ}} စာမျက်နှာ",
        "tooltip-pt-mytalk": "{{GENDER:|သင်၏}} ဆွေးနွေးချက်စာမျက်နှာ",
        "tooltip-pt-anontalk": "ဤအိုင်ပီလိပ်စာမှ တည်းဖြတ်မှုများအကြောင်း ဆွေးနွေးချက်",
        "logentry-block-block": "$1 က {{GENDER:$4|$3}} ကို သက်တမ်းကုန်လွန်ချိန် $5 $6 ဖြင့် {{GENDER:$2|ပိတ်ပင်ခဲ့သည်}}",
        "logentry-block-unblock": "$1 က {{GENDER:$4|$3}} ကို {{GENDER:$2|ပိတ်ပင်မှုမှ ပြန်ဖြေခဲ့သည်}}",
        "logentry-block-reblock": "$1 က {{GENDER:$4|$3}} အတွက် ပိတ်ပင်မှုအပြင်အဆင်များကို သက်တမ်းကုန်လွန်ချိန် $5 $6 ဖြင့် {{GENDER:$2|ပြောင်းလဲခဲ့သည်}}",
+       "logentry-partialblock-block-page": "{{PLURAL:$1|စာမျက်နှာ|စာမျက်နှာများ}} $2",
        "logentry-suppress-block": "{{GENDER:$4|$3}} အား $5 ကြာအောင် $1 က {{GENDER:$2|ပိတ်ပင်ခဲ့သည်}} $6",
        "logentry-suppress-reblock": "$1 က {{GENDER:$4|$3}} အတွက် ပိတ်ပင်မှုအပြင်အဆင်များကို သက်တမ်းကုန်လွန်ချိန် $5 $6 ဖြင့် {{GENDER:$2|ပြောင်းလဲခဲ့သည်}}",
        "logentry-move-move": "$3 စာမျက်နှာကို $4 သို့ $1က {{GENDER:$2|ရွှေ့ခဲ့သည်}}",
        "feedback-cancel": "မလုပ်တော့ပါ",
        "feedback-close": "ပြီးပြီ",
        "feedback-dialog-title": "အကြံပေး ပေါင်းထည့်ရန်",
+       "feedback-error2": "အမှား- တည်းဖြတ်မှု မအောင်မြင်ပါ",
        "feedback-message": "မက်ဆေ့:",
        "feedback-subject": "အကြောင်းအရာ:",
        "feedback-submit": "ထည့်သွင်းရန်",
        "special-characters-group-telugu": "တီလူဂု",
        "special-characters-group-sinhala": "ရှင်ဟာလာ",
        "special-characters-group-gujarati": "ဂူဂျာရတီ",
+       "special-characters-group-devanagari": "ဒီဗနာဂရီ",
        "special-characters-group-thai": "ထိုင်း",
        "special-characters-group-lao": "လာအို",
        "special-characters-group-khmer": "ခမာ",
        "specialpage-securitylevel-not-allowed-title": "ခွင့်မပြုပါ",
        "cannotauth-not-allowed-title": "ခွင့်ပြုချက် ငြင်းပယ်လိုက်သည်",
        "cannotauth-not-allowed": "သင်သည် ဤစာမျက်နှာကို အသုံးပြုခွင့်မရှိပါ",
+       "credentialsform-account": "အကောင့်နာမည်-",
        "userjsispublic": "ကျေးဇူးပြု၍ မှတ်သားပါ- JavaScript စာမျက်နှာခွဲများတွင် အခြားအသုံးပြုသူများ ကြည့်ရှုနိုင်သော လျို့ဝှက်အပ်သည့်အချက်အလက် မပါဝင်သင့်ပါ။",
        "edit-error-short": "အမှား - $1",
        "edit-error-long": "အမှားများ:\n\n$1",
index 09d06dd..40e2855 100644 (file)
        "history": "Geschiedenis",
        "history_short": "Geschiedenis",
        "history_small": "geschiedenis",
-       "updatedmarker": "bewerkt sinds mijn laatste bezoek",
+       "updatedmarker": "bewerkt sinds uw laatste bezoek",
        "printableversion": "Printvriendelijke versie",
        "permalink": "Permanente koppeling",
        "print": "Afdrukken",
index bbb42b4..69b22cc 100644 (file)
        "viewsource": "ߊ߬ ߛߎ߲ ߘߐߜߍ߫",
        "viewsource-title": "ߣߌ߲߬ $1 ߛߎ߲ ߘߐߜߍ߫",
        "viewsourcetext": "ߌ ߘߌ߫ ߛߋ߫ ߞߐߜߍ ߣߌ߲߬ ߛߎ߲ ߦߋ߫ ߟߊ߫߸ ߞߵߊ߬ ߓߊߓߌ߬ߟߊ߬",
+       "customcssprotected": "CSS ߞߐߜߍ ߡߊߦߟߍ߬ߡߊ߲߬ߠߌ߲ ߠߊߘߤߊ߬ߣߍ߲߬ ߕߴߌ ߦߋ߫߸ ߓߊߏ߬ ߊ߬ ߘߐߞߍߣߍ߲߫ ߦߋ߫ ߡߐ߰ ߜߘߍ߫ ߟߊ߫ ߘߎ߲߬ߘߎ߬ߡߊ߬ ߟߊ߬ߓߍ߲߬ߢߐ߲߰ߡߊ ߟߊ߫.",
+       "customjsonprotected": "JSON ߞߐߜߍ ߡߊ߬ߦߟߍ߬ߡߊ߲߬ߠߌ߲ ߠߊߘߤߊ߬ߣߍ߲߬ ߕߴߌ ߦߋ߫߸ ߓߊߏ߬ ߊ߬ ߘߐߞߍߣߍ߲߫ ߦߋ߫ ߡߐ߰ ߜߘߍ߫ ߟߊ߫ ߘߎ߲߬ߘߎ߬ߡߊ߬ ߟߊ߬ߓߍ߲߬ߢߐ߲߰ߡߊ ߟߊ߫.",
+       "customjsprotected": "JavaScript ߞߐߜߍ ߡߊ߬ߦߟߍ߬ߡߊ߲߬ߠߌ߲ ߠߊߘߤߊ߬ߣߍ߲߬ ߕߴߌ ߦߋ߫߸ ߓߊߏ߬ ߊ߬ ߘߐߞߍߣߍ߲߫ ߦߋ߫ ߡߐ߰ ߜߘߍ߫ ߟߊ߫ ߘߎ߲߬ߘߎ߬ߡߊ߬ ߟߊ߬ߓߍ߲߬ߢߐ߲߰ߡߊ ߟߊ߫.",
+       "sitecssprotected": "CSS ߞߐߜߍ ߡߊߦߟߍ߬ߡߊ߲߬ߠߌ߲ ߠߊߘߤߊ߬ߣߍ߲߬ ߕߴߌ ߦߋ߫߸ ߓߴߊ߬ ߘߌ߫ ߛߋ߫ ߓߐߒߡߊߟߌߟߊ ߟߎ߬ ߓߍ߯ ߕߙߐ߫ ߟߊ߫.",
+       "sitejsonprotected": "JSON ߞߐߜߍ ߡߊߦߟߍ߬ߡߊ߲߬ߠߌ߲ ߠߊߘߤߊ߬ߣߍ߲߬ ߕߴߌ ߦߋ߫߸ ߓߴߊ߬ ߘߌ߫ ߛߋ߫ ߓߐߒߡߊߟߌߟߊ ߟߎ߬ ߓߍ߯ ߕߙߐ߫ ߟߊ߫.",
+       "sitejsprotected": "JavaScript ߞߐߜߍ ߣߌ߲߬ ߡߊߦߟߍ߬ߡߊ߲߬ߠߌ߲ ߠߊߘߤߊ߬ߣߍ߲߬ ߕߴߌ ߦߋ߫߸ ߓߴߊ߬ ߘߌ߫ ߛߋ߫ ߘߋ߬ߦߌ߬ ߟߊ߫ ߓߐߒߡߊߟߌߟߊ ߟߎ߬ ߓߍ߯ ߡߊ߬.",
        "mycustomcssprotected": "ߌ ߟߊߘߌ߬ߢߍ߬ ߣߍ߲߬ ߕߍ߫ ߞߊ߬ CCS ߞߐߜߍ ߡߊߦߟߍ߬ߡߊ߲߫.",
        "mycustomjsonprotected": "ߌ ߟߊߘߌ߬ߢߍ߬ ߣߍ߲߬ ߕߍ߫ ߞߊ߬ JSON ߞߐߜߍ ߡߊߦߟߍ߬ߡߊ߲߫.",
        "mycustomjsprotected": "ߌ ߟߊߘߌ߬ߢߍ߬ ߣߍ߲߬ ߕߍ߫ ߞߊ߬ JavaScript ߞߐߜߍ ߡߊߦߟߍ߬ߡߊ߲߫.",
        "titleprotected": "ߞߎ߲߬ߕߐ߮ ߣߌ߲߬ ߓߘߊ߫ ߟߊߞߊ߲ߘߊ߫ ߛߌ߲ߘߟߌ ߡߊ߬  [[User:$1|$1]] ߓߟߏ߫.\nߞߎ߲߭ ߡߍ߲ ߦߴߏ߬ ߟߊ߫߸ ߏ߬ ߦߋ߫ <em>$2</em>.",
        "filereadonlyerror": "ߞߐߕߐ߮ \"$1\" ߕߍ߫ ߛߐ߲߬ ߡߊߦߟߍ߬ߡߊ߲߬ ߠߊ߫߸ ߞߵߊ߬ ߡߊߛߐ߬ߘߐ߲߬ ߞߐߕߐ߮ ߟߊߡߙߊ߬ ߦߙߐ  \"$2\" ߦߋ߫ ߞߊ߬ߙߊ߲ ߘߐߙߐ߲߫ ߝߊ߬ߘߌ ߟߋ߬ ߘߐ߫.\n\nߞߊ߲ߞߋ ߟߊߓߊ߯ߙߟߊ ߡߍ߲ ߣߵߊ߬ ߛߐ߰ ߟߊ߫߸ ߏ߬ ߓߘߊ߫ ߘߊ߲߬ߕߍ߰ߟߌ ߘߏ߫ ߞߍ߫: \"$3\".",
        "invalidtitle": "ߞߎ߲߬ߕߐ߮ ߓߍ߲߬ߓߊߟߌ",
+       "invalidtitle-knownnamespace": "ߞߎ߲߬ߕߐ߮ ߓߍ߲߬ߓߊߟߌ ߕߐ߮ ߛߓߍ ߞߣߍ ߡߊ߬ \"$2\" ߊ߬ ߣߌ߫ ߛߓߍߟߌ  \"$3\"",
+       "invalidtitle-unknownnamespace": "ߞߎ߲߬ߕߐ߮ ߓߍ߲߬ߓߊߟߌ ߞߊ߬ ߓߍ߲߬ ߕߐ߯ߛߓߍ ߞߣߍ߫ ߡߊߟߐ߲ߓߊߟߌ ߝߙߍߕߍ ߡߊ߬ $1 ߊ߬ ߣߌ߫ ߛߓߍߟߌ  \"$2\"",
        "exception-nologin": "ߌ ߜߊ߲߬ߞߎ߲߬ߣߍ߲߬ ߕߍ߫",
+       "exception-nologin-text": "ߌ ߜߊ߲߬ߞߎ߲߫ ߖߊ߰ߣߌ߲߬߸ ߛߴߌ ߘߌ߫ ߛߋ߫ ߞߐߜߍ ߣߌ߲߬ ߡߊߛߐ߬ߘߐ߲߬ ߠߊ߫ ߥߟߊ߫ ߝߏ߲߬ߝߏ߲.",
        "virus-unknownscanner": "ߢߐߛߌߙߋ߲ߞߟߊ߬ ߡߊߟߐ߲ߓߊߟߌ",
        "logouttext": "<strong>ߌ ߜߊ߲߬ߞߎ߲߬ߓߐ߬ߣߍ߲߬ ߕߍ߫.</strong>\n\nߞߐߜߍ ߘߏ߫ ߟߎ߫ ߕߘߍ߬ ߘߌ߫ ߞߍ߫ ߓߊ߯ߙߊ߫ ߟߊ߫ ߞߵߌ ߜߊ߲߬ߞߎ߲߬ߣߍ߲ ߕߏ߫߸ ߝߏ߫ ߣߴߌ ߞߵߌ ߟߊ߫ ߛߏ߲߯ߓߊߟߊ߲ ߢߡߊߘߏ߲߰ߣߍ߲ ߠߎ߬ ߖߏ߬ߛߌ߬.",
        "logging-out-notify": "ߌ ߜߊ߲߬ߞߎ߲߬ߣߍ߲ ߓߐ ߦߴߌ ߘߐ߫߸ ߡߊ߬ߞߐ߬ߣߐ߲߬ߠߌ߲ ߞߍ߫ ߖߊ߰ߣߌ߲߬.",
        "botpasswords-updated-body": "ߓߏߕ ߕߊ߬ߡߌ߲߬ߞߊ߲ ߓߏߕ ߕߐ߮ ߦߋ߫ \"$1\" {{GENDER:$2|ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ}} ߦߋ߫ \"$2\" ߕߎ߲߬ ߓߘߊ߫ ߟߏ߲ߘߐߦߊ߫.",
        "botpasswords-deleted-title": "ߓߏߕ ߕߊ߬ߡߌ߲߬ߞߊ߲ ߓߘߊ߫ ߖߏ߬ߛߌ߬",
        "botpasswords-deleted-body": "ߓߏߕ ߕߊ߬ߡߌ߲߬ߞߊ߲ ߓߏߕ ߕߐ߮ ߦߋ߫ \"$1\" {{GENDER:$2|ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ}} ߦߋ߫ \"$2\" ߕߎ߲߬ ߓߘߊ߫ ߖߏ߬ߛߌ߬.",
+       "botpasswords-not-exist": "ߓߏߕ ߕߊ߬ߡߌ߲߬ߞߊ߲ ߕߐ߯ߟߊߣߍ߲߫ \"$2\" ߕߍ߫ ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ  \"$1\" ߓߟߏ߫",
+       "botpasswords-needs-reset": "ߓߏߕ ߕߊ߬ߡߌ߲߬ߞߊ߲  \"$1\" ߓߏߕ ߕߐ߯ \"$2\" ߦߋ߫ {{GENDER:$1|ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ}}  \"$1\" ߦߋ߫ ߡߊߦߟߍ߬ߡߊ߲߫.",
+       "botpasswords-locked": "ߌ ߕߍߣߊ߬ ߛߋߟߴߌ ߜߊ߲߬ߞߎ߲߬ ߠߊ߫ ߓߏߕ ߕߊ߬ߡߌ߲߬ߞߊ߲ ߘߌ߫ ߓߊ ߌ ߟߊ߫ ߖߊ߬ߕߋ߬ߘߊ ߛߐ߰ߣߍ߲߫ ߠߋ߫.",
        "resetpass_forbidden": "ߕߊ߬ߡߌ߲߬ߞߊ߲ ߕߴߛߋ߫ ߡߊߝߊ߬ߘߋ߲߬ ߠߊ߫.",
        "resetpass_forbidden-reason": "ߕߊ߬ߡߌ߲߬ߞߊ߲ ߕߴߛߋ߫ ߡߊߝߊ߬ߟߋ߲߬ ߠߊ߫: $1",
        "resetpass-no-info": "ߌ ߦߴߌ ߜߊ߲߬ߞߎ߲߬ ߡߎߣߎ߲߬ ߞߣߊ߬ ߕߏ߫ ߞߐߜߍ ߣߌ߲߬ ߡߊߛߐ߬ߘߐ߲߬ ߠߊ߫.",
        "template-protected": "(ߊ߬ ߡߊߞߊ߲ߞߊ߲ߣߍ߲߫ ߠߋ߬)",
        "template-semiprotected": "(ߟߊ߬ߞߊ߲߬ߘߊ߬ߟߌ-ߝߊ߲߬ߞߋ߬ߟߋ߲߬ߡߊ)",
        "hiddencategories": "ߞߐߜߍ ߣߌ߲߬ ߦߋ߫ ߢߌ߲߬ ߠߎ߫ ߛߌ߲߬ߝߏ߲ ߠߋ߬ ߘߌ߫{{PLURAL:$1|}}",
+       "sectioneditnotsupported-text": "ߛߌ߰ߘߊ ߡߊߦߟߍ߬ߡߊ߲߬ߠߌ߲ ߠߊߘߤߊ߬ߣߍ߲߬ ߕߍ߫ ߞߐߜߍ ߣߌ߲߬ ߠߊ߫ ߕߊ߲߬.",
        "permissionserrors": "ߝߌ߬ߟߌ߫ ߘߌ߬ߢߍ߬ߒߧߋ",
+       "permissionserrorstext": "ߌ ߟߊߘߌ߬ߢߍ߬ߣߍ߲߬ ߕߍ߫ ߞߵߏ߬ ߞߍ߫߸ ߣߌ߲߬ ߠߊ߫ {{PLURAL:$1|ߛߊߓߎ|ߛߊߓߎ ߟߎ߬}}:",
        "permissionserrorstext-withaction": "ߟߊ߬ߘߌ߬ߢߍ߬ߟߌ߬ ߛߌ߫ ߕߴߌ ߦߋ߫ ߞߊ߬ $2߸ {{PLURAL:$1|ߞߏߛߐ߲߬|ߟߎ߬ ߞߏߛߐ߲߬}}",
+       "contentmodelediterror": "ߌ ߕߍߣߊ߬ ߛߋ߫ ߟߊ߫ ߛߌ߰ߘߊ ߣߌ߲߬ ߡߊߦߟߍ߬ߡߊ߲߬ ߠߊ߫߸ ߓߊߏ߬ ߞߣߐߘߐ ߛߎ߯ߦߊ ߦߋ߫ <code>$1</code> ߟߋ߬ ߘߌ߫߸ ߡߍ߲ ߦߋ߫ ߕߋ߲߬ߕߋ߲߬ ߞߣߐߘߐ ߛߎ߯ߦߊ ߝߘߏ߬ ߟߊ߫ ߞߐߜߍ <code>$2</code> ߘߐ߫.",
        "recreate-moveddeleted-warn": "<strong>ߌ ߖߊ߲߬ߕߏ߫: ߌ ߦߋ߫ ߞߐߜߍ ߘߏ߫ ߟߋ߬ ߟߊߘߊ߲߫ ߞߏ ߘߐ߫ ߣߌ߲߬߸ ߡߍ߲ ߖߏ߬ߛߌ߬ߣߍ߲߬ ߡߎߣߎ߲߬.</strong> \nߌ ߓߛߌ߬ߞߌ߬ ߕߐ߫ ߟߋ߬ ߛߍ߲߸ ߣߴߌ ߘߌ߫ ߛߋ߫ ߞߐߜߍ ߣߌ߲߬ ߡߊߦߟߍ߬ߡߊ߲ ߘߊߓߊ߲߫ ߠߊ߫. \nߞߐߜߍ ߣߌ߲߬ ߦߟߌߣߐ ߖߏ߬ߛߌ߬ߣߍ߲ ߣߴߊ߬ ߛߋ߲߬ߓߐ߬ߣߍ߲ ߠߎ߬ ߡߊߘߊ߲ߣߍ߲߫ ߦߊ߲߬ ߠߋ ߟߊ߬ߣߐ߰ߦߊ߬ߟߌ ߘߌ߫:",
        "moveddeleted-notice": "ߞߐߜߍ ߣߌ߲߬ ߓߘߊ߫ ߖߏ߬ߛߌ߬.\nߖߏ߬ߛߌ߬ߟߌ߸ ߟߊ߬ߞߊ߲߬ߘߊ߬ߟߌ߸ ߊ߬ ߣߌ߫ ߞߐߜߍ ߛߓߍߟߌ ߟߎ߬ ߛߋ߲߬ߓߐ߸ ߏ߬ ߟߎ߫ ߓߍ߯ ߡߊߛߐߣߍ߲߫ ߦߋ߫ ߘߎ߰ߟߊ ߘߐ߫.",
        "log-fulllog": "ߘߎ߲ߛߓߍ ߘߝߊߣߍ߲ ߦߋ߫",
        "postedit-confirmation-saved": "ߌ ߟߊ߫ ߡߊ߬ߦߟߍ߬ߡߊ߲߬ߠߌ߲ ߓߘߊ߫ ߟߊߞߎ߲߬ߘߎ߬.",
        "postedit-confirmation-published": "ߌ ߟߊ߫ ߡߊ߬ߦߟߍ߬ߡߊ߲߬ߠߌ߲ ߓߘߊ߫ ߟߊߥߊ߲߬ߞߊ߫.",
        "edit-already-exists": "ߌ ߕߴߛߋ߫ ߞߐߜߍ߫ ߞߎߘߊ߫ ߛߌ߲ߘߌ߫ ߟߊ߫.\nߊ߬ ߦߋ߫ ߦߋ߲߬ ߞߘߐ߬ߡߊ߲߬.",
+       "defaultmessagetext": "ߓߐߛߎ߲ ߗߋߛߓߍ ߛߓߍߟߌ",
        "invalid-content-data": "ߞߣߐߘߐ ߓߟߏߡߟߊ ߓߍ߲߬ߓߊߟߌ",
        "content-not-allowed-here": "\"$1\" ߞߣߐߘߐ ߟߊߘߤߊ߬ߣߍ߲߬ ߕߍ߫ ߞߐߜߍ ߘߐ߫ [[:$2]] ߛߍ߲ߞߍߘߊ ߘߐ߫  \"$3\"",
        "editwarning-warning": "ߣߴߌ ߓߐ߫ ߘߊ߫ ߞߐߜߍ ߣߌ߲߬ ߞߊ߲߬߸ ߌ ߘߌ߫ ߓߣߐ߬ ߌ ߟߊ߫ ߡߊ߬ߝߊ߬ߟߋ߲߬ߠߌ߲߬ ߞߍߣߍ߲ ߠߎ߬ ߓߍ߯ ߘߐ߫.\nߣߴߌ ߘߏ߲߬ ߜߊ߲߬ߞߎ߲߬ߣߍ߲߬ ߞߍ߫ ߘߊ߫߸ ߌ ߘߌ߫ ߛߋ߫ ߖߊ߬ߛߙߋ߬ߡߊ߬ߟߊ ߣߌ߲߬ ߓߐ߫ ߟߴߊ߬ ߟߊ߫  \"{{int:prefs-editing}}\" ߘߐ߫߸ ߌ ߟߊ߫ ߟߊ߬ߝߌ߬ߛߦߊ߬ߟߌ ߥߟߊ߬ߘߊ ߘߐ߫.",
        "saveusergroups": "{{GENDER:$1|ߟߊ߬ߓߊ߰ߙߊ߬ߟߌ߬}} ߞߙߎ ߟߊߞߎ߲߬ߘߎ߬",
        "userrights-groupsmember": "ߛߌ߲߬ߝߏ߲ ߠߎ߬:",
        "userrights-reason": "ߊ߬ ߛߊߓߎ:",
+       "userrights-nodatabase": "ߓߟߏߡߟߊ ߝߊ߲ $1 ߕߴߦߋ߲߬ ߥߟߴߊ߬ ߕߍ߫ ߕߌ߲߬ߞߎ߬ߘߎ߲߬ߡߊ߬ ߘߌ߫.",
        "userrights-changeable-col": "ߌ ߘߌ߫ ߛߋ߫ ߞߙߎ ߡߍ߲ ߠߎ߬ ߡߊߦߟߍ߬ߡߊ߲߬ ߠߊ߫",
        "userrights-unchangeable-col": "ߌ ߕߴߛߋ߫ ߞߙߎ ߡߍ߲ ߠߎ߬ ߡߊߦߟߍ߬ߡߊ߲߬ ߠߊ߫",
        "userrights-expiry-current": "ߊ߬ ߛߕߊ ߓߘߊ߫ ߝߊ߫ $1",
        "group-autoconfirmed": "ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ߬ ߞߍߒߖߘߍߦߋ߫ ߟߊߛߙߋߦߊߣߍ߲",
        "group-bot": "ߓߏߕ",
        "group-sysop": "ߞߎ߲߬ߠߊ߬ߛߌ߰ߟߊ",
+       "group-bureaucrat": "ߛߓߍߘߟߊߡߐ߮",
        "group-all": "(ߊ߬ ߓߍ߯)",
        "group-user-member": "{{GENDER:$1|ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ}}",
+       "group-autoconfirmed-member": "{{GENDER:$1|ߞߍߒߖߘߍߦߋ߫ ߟߊߛߙߋߦߊߟߌ ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ}}",
+       "group-bot-member": "{{GENDER:$1|ߓߏߕ}}",
+       "group-bureaucrat-member": "{{GENDER:$1|ߛߓߍߘߟߊߡߐ߮}}",
        "grouppage-user": "{{ns:project}}: ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ",
        "grouppage-bot": "{{ns:project}}:ߓߏߕ",
        "grouppage-sysop": "{{ns:project}}:ߡߊ߬ߡߙߊ߬ߟߌ߬ߟߊ",
        "right-createpage": "ߞߐߜߍ ߘߏ߫ ߛߌ߲ߘߌ߫ (ߡߍ߲ ߕߍ߫ ߓߊ߬ߘߏ߬ߓߊ߬ߘߌ߬ߦߊ߬ ߞߐߜߍ ߝߋ߲߫ ߘߌ߫)",
        "right-createtalk": "ߓߊ߬ߘߏ߬ߓߊ߬ߘߌ߬ߦߊ߬ ߞߐߜߍ ߛߌ߲ߘߌ߫",
        "right-createaccount": "ߖߊ߬ߕߋ߬ߘߊ߬ ߟߊߓߊ߯ߙߕߊ߫ ߞߎߘߊ߫ ߛߌ߲ߘߌ߫",
+       "right-minoredit": "ߡߊ߬ߦߟߍ߬ߡߊ߲߬ߠߌ߲ ߣߐ߬ߣߐ߬ ߡߌ߬ߛߍ߬ߡߊ߲ ߘߌ߫",
        "right-move": "ߞߐߜߍ ߟߎ߬ ߛߋ߲߬ߓߐ߫",
        "right-move-subpages": "ߞߐߜߍ ߛߋ߲߬ߓߐ߫ ߊ߬ߟߎ߬ ߟߊ߫ ߞߐߜߍߙߋ߲ ߠߎ߬ ߘߐ߫",
        "right-move-categorypages": "ߦߌߟߡߊ߫ ߞߐߜߍ ߟߎ߬ ߛߋ߲߬ߓߐ߫",
        "right-movefile": "ߞߐߕߐ߮ ߟߎ߬ ߛߋ߲߬ߓߐ߫",
        "right-upload": "ߞߐߕߐ߮ ߟߎ߬ ߟߊߦߟߍ߬",
        "right-writeapi": "ߛߓߍߟߌ API ߟߊߓߊ߯ߙߊ߫",
+       "right-delete": "ߞߐߜߍ ߟߎ߬ ߖߏ߰ߛߌ߬",
+       "right-bigdelete": "ߞߐߜߍ߫ ߘߝߐ߬ ߓߟߋ߬ߓߟߋ߬ߡߊ ߟߎ߬ ߖߏ߰ߛߌ߬",
+       "right-browsearchive": "ߞߐߜߍ߫ ߖߏ߰ߛߌ߬ߣߍ߲ ߠߎ߬ ߢߌߣߌ߲߫",
+       "right-undelete": "ߞߐߜߍ ߖߏ߰ߛߌ߬ߣߍ߲ ߓߐ߫",
+       "right-suppressionlog": "ߘߎ߲߬ߘߎ߬ߡߊ߬ ߘߎ߲ߛߓߍ ߟߎ߬ ߦߋ߫",
+       "right-block": "ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ ߘߏ ߟߎ߬ ߓߊ߬ߟߌ߬ ߡߊ߬ߦߟߍ߬ߡߊ߲߬ߠߌ߲ ߡߊ߬",
+       "right-blockemail": "ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ ߓߊ߬ߟߌ߬ ߢߎߡߍߙߋ߲ ߗߋߟߌ ߡߊ߬",
+       "right-hideuser": "ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ ߓߊ߬ߟߌ߬߸ ߊ߬ ߢߡߊߘߏ߲߰ ߖߊ߬ߡߊ ߡߊ߬.",
+       "right-unblockself": "ߴ ߖߍ߬ߘߍ ߓߊ߬ߟߌ߬ߣߍ߲ ߓߐ߫",
+       "right-editcontentmodel": "ߞߐߜߍ ߣߌ߲߬ ߞߣߐߘߐ ߛߎ߮ߦߊ ߡߊߝߊ߬ߟߋ߲߬",
        "right-editusercss": "CSS ߞߐߕߐ߮ ߘߏ ߟߎ߬ ߡߊߦߟߍ߬ߡߊ߲߫",
        "right-edituserjson": "ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ ߘߏ ߟߎ߬ ߟߊ߫ CSS ߞߐߕߐ߮ ߟߎ߬ ߡߊߦߟߍ߬ߡߊ߲߫",
        "right-edituserjs": "ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ ߘߏ ߟߎ߬ ߟߊ߫ JavaScript ߞߐߕߐ߮ ߟߎ߬ ߡߊߦߟߍ߬ߡߊ߲߫",
        "right-editsitejs": "ߞߍߦߙߐ ߞߣߍ JavaScript ߡߊߦߟߍ߬ߡߊ߲߫",
        "right-editmyusercss": "ߌ ߖߘߍ߬ߞߊ߬ߣߌ߲߬ CSS ߟߊ߬ߓߊ߰ߙߊ߬ߟߌ߬ ߞߐߕߐ߮ ߡߊߦߟߍ߬ߡߊ߲߫",
        "right-editmyuserjson": "ߌ ߖߍ߬ߘߍ ߟߊ߫ ߟߊ߬ߓߊ߰ߙߊ߬ߟߌ߬ JSON ߞߐߕߐ߮ ߟߎ߬ ߡߊߦߟߍ߬ߡߊ߲߫",
+       "right-editmyuserjs": "ߌ ߖߘߍ߬ߞߊ߬ߣߌ߲߬ JavaScript ߞߐߕߐ߮ ߟߎ߬ ߡߊߦߟߍ߬ߡߊ߲߫",
+       "right-viewmywatchlist": "ߌ ߖߘߍ߬ߞߊ߬ߣߌ߲߬ ߜߋ߬ߟߎ߲߬ߠߌ߲߬ ߛߙߍߘߍ ߦߋ߫",
+       "grant-group-email": "ߢߎߡߍߙߋ߲ ߗߋ߫",
+       "grant-createaccount": "ߖߊ߬ߕߋ߬ߘߊ ߘߏ߫ ߛߌ߲ߘߌ߫",
+       "grant-createeditmovepage": "ߞߐߜߍ ߛߌ߲ߘߌ߫߸ ߡߊߦߟߍ߬ߡߊ߲߫߸ ߊ߬ ߣߌ߫ ߞߵߊ߬ ߛߋ߲߬ߓߐ߫",
+       "grant-editinterface": "MediaWiki ߕߐ߯ߛߓߍ ߞߣߍ ߡߊߦߟߍ߬ߡߊ߲߫ ߊ߬ ߣߌ߫ ߞߍߦߙߐ ߞߣߍ/ ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ JSON",
+       "grant-editmycssjs": "ߌ ߟߊ߫ ߟߊ߬ߓߊ߰ߙߊ߬ߟߌ߬ CSS/JSON/JavaScript ߡߊߦߟߍ߬ߡߊ߲߫",
+       "grant-editmyoptions": "ߌ ߟߊ߫ ߟߊ߬ߝߌ߬ߛߦߊ߬ߟߌ ߟߊ߬ߓߊ߰ߙߊ߬ߟߌ ߣߌ߫ JSON ߛߏ߯ߙߏߟߌ ߡߊߦߟߍ߬ߡߊ߲߫",
+       "grant-editmywatchlist": "ߌ ߟߊ߫ ߜߋ߬ߟߎ߬ߠߌ߲߬ ߛߙߍߘߍ ߡߊߦߟߍ߬ߡߊ߲߫",
+       "grant-editsiteconfig": "ߞߍߦߙߐ ߞߣߍ ߟߊ߬ߓߊ߰ߙߊ߬ߟߌ߬ CSS/JS ߡߊߦߟߍ߬ߡߊ߲߫",
+       "grant-editpage": "ߞߐߜߍ߫ ߓߍߓߊ߮ ߡߊߦߟߍ߬ߡߊ߲߫",
+       "grant-editprotected": "ߞߐߜߍ߫ ߟߊߞߊ߲ߘߊߣߍ߲ ߡߊߦߟߍ߬ߡߊ߲߫",
+       "grant-highvolume": "ߢߊ߲ߞߊ߲-ߛߊ߲ߘߐߕߊ ߡߊߦߟߍߡߊ߲ ߦߴߌ ߘߐ߫",
+       "grant-privateinfo": "ߘߎ߲߬ߘߎ߬ߡߊ߬ ߞߌߓߊߙߏߦߊ ߟߊߛߐ߬ߘߐ߲߬",
+       "grant-protect": "ߞߐߜߍ ߟߎ߬ ߟߊߞߊ߲ߘߊ߫ ߊ߬ ߣߌ߫ ߞߵߊ߬ߟߎ߬ ߟߊߞߊ߲ߘߊߣߍ߲ ߓߐ߫",
+       "grant-sendemail": "ߢߎߡߍߙߋ߲ ߗߋ߫ ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ ߘߏ ߟߎ߬ ߡߊ߬",
+       "grant-uploadeditmovefile": "ߞߐߕߐ߮ ߟߊߦߟߍ߬߸ ߣߐ߬ߘߐߓߌ߬ߟߊ߬߸ ߊ߬ ߣߌ߫ ߞߵߊ߬ ߛߋ߲߬ߓߐ߫",
+       "grant-uploadfile": "ߞߐߕߐ߮ ߞߎߘߊ߫ ߟߊߦߟߍ߬",
+       "grant-basic": "ߤߊߞߍ ߓߊߖߎߟߞߊ",
+       "grant-viewdeleted": "ߞߐߜߍ ߣߌ߫ ߞߐߕߐ߮ ߖߏ߰ߛߌ߬ߣߍ߲ ߠߎ߬ ߦߋ߫",
+       "grant-viewmywatchlist": "ߌ ߟߊ߫ ߜߋ߬ߟߎ߬ߠߌ߲߬ ߛߙߍߘߍ ߦߋ߫",
        "newuserlogpage": "ߖߊ߬ߕߋ߬ߘߊ߬ ߓߘߊ߫ ߟߊߞߊ߬ ߌ ߜߊ߲߬ߞߎ߲߬",
+       "newuserlogpagetext": "ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ ߟߊ߫ ߘߎ߲ߛߓߍ߫ ߛߌ߲ߘߌߣߍ߲ ߘߏ߫ ߟߋ߬ ߦߋ߫ ߣߌ߲߬.",
        "rightslog": "ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ ߜߊ߲߬ߞߎ߲߬ ߢߊ߬ ߓߘߍ",
+       "action-read": "ߞߐߜߍ ߣߌ߲߬ ߘߐߞߊ߬ߙߊ߲߬",
        "action-edit": "ߞߐߜߍ ߣߌ߲߬ ߡߊߦߟߍ߬ߡߊ߲߬",
+       "action-createpage": "ߞߐߜߍ ߣߌ߲߬ ߛߌ߲ߘߌ߫",
+       "action-createtalk": "ߘߊߘߐߖߊߥߏ߫ ߞߐߜߍ ߣߌ߲߬ ߛߌ߲ߘߌ߫",
        "action-createaccount": "ߖߊ߬ߕߋ߬ߘߊ߬ ߟߊߓߊ߯ߙߕߊ ߣߌ߲߬ ߠߊߘߊ߲߫",
+       "action-autocreateaccount": "ߞߐߞߊ߲ߝߊ߲ ߟߊ߬ߓߊ߰ߙߊ߬ߟߌ߬ ߖߊߕߋߘߊ ߣߌ߲߬ ߛߌ߲ߘߌ߫ ߞߍߒߖߘߍߦߋ߫ ߓߟߏߡߊ߬",
+       "action-history": "ߞߐߜߍ ߣߌ߲߬ ߠߊ߫ ߘߐ߬ߝߐ ߦߋ߫",
+       "action-minoredit": "ߡߊ߬ߦߟߍ߬ߡߊ߲߬ߠߌ߲ ߣߌ߲߬ ߣߐ߬ߣߐ߬ ߢߟߋߢߟߋ ߘߌ߫",
+       "action-move": "ߞߐߜߍ ߣߌ߲߬ ߛߋ߲߬ߓߐ߫",
+       "action-move-subpages": "ߞߐߜߍ ߣߌ߲߬ ߛߋ߲߬ߓߐ߫߸ ߊ߬ ߣߴߊ߬ ߞߐߜߍߙߋ߲ ߠߎ߬",
+       "action-move-categorypages": "ߦߌߟߡߊ߫ ߞߐߜߍ ߟߎ߬ ߛߋ߲߬ߓߐ߫",
+       "action-movefile": "ߞߐߕߐ߮ ߣߌ߲߬ ߛߋ߲߬ߓߐ߫",
+       "action-upload": "ߞߐߕߐ߮ ߣߌ߲߬ ߠߊߦߟߍ߬",
+       "action-reupload": "ߞߐߕߐ߯ ߓߍߓߊ߮ ߣߌ߲߬ ߥߦߊ߬",
+       "action-upload_by_url": "ߞߐߕߐ߮ ߣߌ߲߬ ߠߊߦߟߍ߬ ߞߊ߬ ߓߐ߫ URL ߘߐ߫",
+       "action-writeapi": "ߛߓߍߟߌ API ߟߊߓߊ߯ߙߊ߫",
+       "action-delete": "ߞߐߜߍ ߣߌ߲߬ ߖߏ߰ߛߌ߬",
+       "action-deleterevision": "ߟߢߊ߬ߟߌ ߟߎ߬ ߖߏ߬ߛߌ߬",
+       "action-deletedhistory": "ߞߐߜߍ ߟߎ߬ ߖߏ߰ߛߌ߬ߟߌ ߘߐ߬ߝߐ ߦߋ߫",
+       "action-browsearchive": "ߞߐߜߍ߬ ߖߏ߰ߛߌ߬ߣߍ߲ ߠߎ߬ ߢߌߣߌ߲߫",
+       "action-undelete": "ߞߐߜߍ ߖߏ߰ߛߌ߬ߓߊߟߌ ߟߎ߬",
+       "action-suppressionlog": "ߘߎ߲߬ߘߎ߬ߡߊ߬ ߘߎ߲ߛߓߍ ߣߌ߲߬ ߦߋ߫",
+       "action-block": "ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ ߣߌ߲߬ ߓߊ߬ߟߌ߬ ߡߊ߬ߦߟߍ߬ߡߊ߲߬ߠߌ߲ ߡߊ߬",
+       "action-protect": "ߞߐߜߍ ߣߌ߲߬ ߟߊ߬ߞߊ߲߬ߘߊ߬ߟߌ߬ ߞߛߊߞߊ ߡߊߝߊ߬ߟߋ߲߬",
+       "action-import": "ߞߐߜߍ ߟߎ߬ ߟߊߛߣߍ߫ ߞߊ߬ ߓߐ߫ ߥߞߌ ߕߐ߭ ߟߎ߬ ߘߐ߫",
+       "action-importupload": "ߞߐߜߍ ߟߎ߬ ߟߊߛߣߍ߫ ߞߊ߬ ߓߐ߫ ߞߐߕߐ߯ ߟߊߦߟߍ߬ߣߍ߲ ߠߎ߬ ߘߐ߫",
+       "action-unwatchedpages": "ߞߐߜߍ߫ ߜߋ߬ߟߎ߲߬ߓߊߟߌ ߟߎ߬ ߛߙߍߘߍ ߦߋ߫",
+       "action-mergehistory": "ߞߐߜߍ ߣߌ߲߬ ߠߊ߫ ߘߐ߬ߝߐ ߟߎ߬ ߞߍߢߐ߲߮ߞߊ߲߬",
+       "action-userrights": "ߟߊ߬ߓߊ߰ߙߊ߬ߟߌ߬ ߤߊߞߍ ߓߍ߯ ߡߊߦߟߍ߬ߡߊ߲߫",
+       "action-userrights-interwiki": "ߥߞߌ ߘߏ ߟߎ߬ ߟߊ߬ߓߊ߰ߙߊ߬ߟߊ ߟߎ߬ ߟߊ߬ߓߊ߰ߙߊ߬ߟߌ߬ ߤߊߞߍ ߡߊߦߟߍ߬ߡߊ߲߫",
+       "action-siteadmin": "ߓߟߏߡߟߊ ߝߊ߲ ߣߍ߰ ߥߟߊ߫ ߞߵߊ߬ ߣߍ߰ߣߍ߲ ߓߐ߫",
+       "action-sendemail": "ߢߎߡߍߙߋ߲ ߗߋ߫",
+       "action-editmyoptions": "ߌ ߟߊ߫ ߟߊ߬ߝߌ߬ߛߦߊ߬ߟߌ ߡߊߦߟߍ߬ߡߊ߲߫",
+       "action-editmywatchlist": "ߌ ߟߊ߫ ߜߋ߬ߟߎ߬ߠߌ߲߬ ߛߙߍߘߍ ߡߊߦߟߍ߬ߡߊ߲߫",
+       "action-viewmywatchlist": "ߌ ߟߊ߫ ߜߋ߬ߟߎ߬ߠߌ߲߬ ߛߙߍߘߍ ߦߋ߫",
+       "action-viewmyprivateinfo": "ߌ ߘߎ߲߬ߘߎ߬ߡߊ߬ ߞߌߓߊߙߏߦߊ ߟߎ߬ ߦߋ߫",
+       "action-editmyprivateinfo": "ߌ ߘߎ߲߬ߘߎ߬ߡߊ߬ ߞߌߓߊߙߏߦߊ ߡߊߦߟߍ߬ߡߊ߲߫",
+       "action-editcontentmodel": "ߞߐߜߍ ߣߌ߲߬ ߞߣߐߘߐ ߛߎ߮ߦߊ ߡߊߦߟߍ߬ߡߊ߲߫",
        "enhancedrc-history": "ߕߊ߬ߡߌ߲߬ߣߍ߲",
        "recentchanges": "ߡߊ߬ߦߟߍ߬ߡߊ߲߬ߠߌ߲߬ ߞߎߘߊ ߟߎ߬",
        "recentchanges-legend": "ߡߊ߬ߦߟߍ߬ߡߊ߲߬ߠߌ߲߬ ߞߎߘߊ ߟߎ߫ ߟߊ߬ߓߍ߲߬ߢߐ߰ߡߦߊ߬ߘߊ",
        "recentchanges-label-plusminus": "ߞߐߜߍ ߢߊ߲ߞߊ߲ ߓߘߊ߫ ߡߊߦߟߍ߬ߡߊ߲߫ ߞߵߊ߬ ߝߌ߬ߘߊ߲ ߦߙߌߞߊ ߣߌ߲߬ ߘߌ߫",
        "recentchanges-legend-heading": "<strong>ߡߊ߬ߛߙߋ:</strong>",
        "recentchanges-legend-newpage": "{{int:recentchanges-label-newpage}} (ߣߌ߲߬ ߝߣߊ߫ ߦߋ߫ \n[[Special:NewPages|list of new pages]])",
+       "recentchanges-submit": "ߊ߬ ߦߌ߬ߘߊ߬",
+       "rcfilters-tag-remove": "$1 ߛߋ߲߬ߓߐ߫",
+       "rcfilters-legend-heading": "<strong>ߟߊ߬ߘߛߏ߬ߟߌ ߛߙߍߘߍ</strong>",
+       "rcfilters-other-review-tools": "ߡߊ߬ߛߊ߬ߦߌ߲߬ߠߌ߲߬ ߖߐ߯ߙߊ߲ ߘߏ ߟߎ߬",
+       "rcfilters-group-results-by-page": "ߞߙߎ ߞߐߝߟߌ ߞߐߜߍ ߡߊ߬",
+       "rcfilters-activefilters-hide": "ߊ߬ ߢߡߊߘߏ߲߰",
+       "rcfilters-activefilters-show": "ߊ߬ ߦߌ߬ߘߊ߬",
+       "rcfilters-limit-title": "ߞߐߝߟߌ ߡߍ߲ ߠߎ߬ ߦߌ߬ߘߊ߬ߕߊ ߦߋ߫",
+       "rcfilters-limit-and-date-label": "$1{{PLURAL:$1|ߡߊ߬ߦߟߍ߬ߡߊ߲߬ߠߌ߲|ߡߊ߬ߦߟߍ߬ߡߊ߲߬ߠߌ߲ ߠߎ߬}}߸ $2",
+       "rcfilters-date-popup-title": "ߕߎ߬ߡߊ ߣߌ߫ ߥߎ߬ߛߎ ߡߍ߲ ߠߎ߬ ߢߌߣߌ߲ߕߊ ߦߋ߫",
+       "rcfilters-days-title": "ߟߏ߲ ߕߊ߬ߡߌ߲߬ߣߍ߲ ߠߎ߬",
+       "rcfilters-hours-title": "ߕߎ߬ߡߊ߬ߙߋ߲߫ ߕߊ߬ߡߌ߲߬ߣߍ߲ ߠߎ߬",
+       "rcfilters-days-show-days": "$1 {{PLURAL:$1|ߟߏ߲|ߟߏ߲ ߠߎ߬}}",
+       "rcfilters-days-show-hours": "$1 {{PLURAL:$1|ߕߎ߬ߡߊ߬ߙߋ߲|ߕߎ߬ߡߊ߬ߙߋ߲ ߠߎ߬}}",
+       "rcfilters-highlighted-filters-list": "ߡߊߦߋߙߋ߲ߣߍ߲:$1",
+       "rcfilters-quickfilters": "ߞߎ߲߬ߕߐ߰ ߟߊߞߎ߲߬ߘߎ߬ߣߍ߲ ߠߎ߬",
+       "rcfilters-quickfilters-placeholder-title": "ߛߌ߲ߘߌߣߍ߲ ߟߊߞߎ߲߬ߘߎ߬ߣߍ߲߬ ߕߍ߫ ߡߎߣߎ߲߬",
+       "rcfilters-savedqueries-defaultlabel": "ߞߎ߲߬ߕߐ߰ ߟߊߞߎ߲߬ߘߎ߬ߣߍ߲ ߠߎ߬",
        "rcnotefrom": "ߘߎ߰ߟߊ ߘߐ߫ {{PLURAL:$5|is the change|are the changes}} ߞߊ߬ߦߌ߯ <strong>$3, $4</strong> (up to <strong>$1</strong> shown).",
        "rclistfrom": "ߡߊ߬ߦߟߍ߬ߡߊ߲߬ߠߌ߲߬ ߞߎߘߊ ߟߎ߫ ߦߌ߬ߘߊ ߘߊߡߌ߬ߣߊ߬ ߣߌ߲߭ ߡߊ߬ $2, $3",
        "rcshowhideminor": "$1 ߡߊ߬ߦߟߍ߬ߡߊ߲߬ߠߌ߲߬ ߘߋ߬ߣߍ߲",
index 2e9a11d..6a3e2c0 100644 (file)
        "history": "Historia strony",
        "history_short": "historia",
        "history_small": "historia",
-       "updatedmarker": "zmienione od ostatniej wizyty",
+       "updatedmarker": "zmienione od twojej ostatniej wizyty",
        "printableversion": "Wersja do druku",
        "permalink": "Link do tej wersji",
        "print": "Drukuj",
index b60577c..8b6c6d5 100644 (file)
@@ -179,6 +179,7 @@ $wgAutoloadClasses += [
 
        # tests/phpunit/includes/libs
        'GenericArrayObjectTest' => "$testDir/phpunit/includes/libs/GenericArrayObjectTest.php",
+       'Wikimedia\ParamValidator\TypeDef\TypeDefTestCase' => "$testDir/phpunit/includes/libs/ParamValidator/TypeDef/TypeDefTestCase.php",
 
        # tests/phpunit/maintenance
        'MediaWiki\Tests\Maintenance\DumpAsserter' => "$testDir/phpunit/maintenance/DumpAsserter.php",
index 6279cf6..68bb1e9 100644 (file)
@@ -6,14 +6,17 @@
  */
 class WfShellExecTest extends MediaWikiTestCase {
        public function testT69870() {
-               $command = wfIsWindows()
-                       // 333 = 331 + CRLF
-                       ? ( 'for /l %i in (1, 1, 1001) do @echo ' . str_repeat( '*', 331 ) )
-                       : 'printf "%-333333s" "*"';
+               if ( wfIsWindows() ) {
+                       // T209159: Anonymous pipe under Windows does not support asynchronous read and write,
+                       // and the default buffer is too small (~4K), it is easy to be blocked.
+                       $this->markTestSkipped(
+                               'T209159: Anonymous pipe under Windows cannot withstand such a large amount of data'
+                       );
+               }
 
                // Test several times because it involves a race condition that may randomly succeed or fail
                for ( $i = 0; $i < 10; $i++ ) {
-                       $output = wfShellExec( $command );
+                       $output = wfShellExec( 'printf "%-333333s" "*"' );
                        $this->assertEquals( 333333, strlen( $output ) );
                }
        }
diff --git a/tests/phpunit/includes/libs/ParamValidator/ParamValidatorTest.php b/tests/phpunit/includes/libs/ParamValidator/ParamValidatorTest.php
new file mode 100644 (file)
index 0000000..01b1c02
--- /dev/null
@@ -0,0 +1,506 @@
+<?php
+
+namespace Wikimedia\ParamValidator;
+
+use Psr\Container\ContainerInterface;
+use Wikimedia\ObjectFactory;
+
+/**
+ * @covers Wikimedia\ParamValidator\ParamValidator
+ */
+class ParamValidatorTest extends \PHPUnit\Framework\TestCase {
+
+       public function testTypeRegistration() {
+               $validator = new ParamValidator(
+                       new SimpleCallbacks( [] ),
+                       new ObjectFactory( $this->getMockForAbstractClass( ContainerInterface::class ) )
+               );
+               $this->assertSame( array_keys( ParamValidator::$STANDARD_TYPES ), $validator->knownTypes() );
+
+               $validator = new ParamValidator(
+                       new SimpleCallbacks( [] ),
+                       new ObjectFactory( $this->getMockForAbstractClass( ContainerInterface::class ) ),
+                       [ 'typeDefs' => [ 'foo' => [], 'bar' => [] ] ]
+               );
+               $validator->addTypeDef( 'baz', [] );
+               try {
+                       $validator->addTypeDef( 'baz', [] );
+                       $this->fail( 'Expected exception not thrown' );
+               } catch ( \InvalidArgumentException $ex ) {
+               }
+               $validator->overrideTypeDef( 'bar', null );
+               $validator->overrideTypeDef( 'baz', [] );
+               $this->assertSame( [ 'foo', 'baz' ], $validator->knownTypes() );
+
+               $this->assertTrue( $validator->hasTypeDef( 'foo' ) );
+               $this->assertFalse( $validator->hasTypeDef( 'bar' ) );
+               $this->assertTrue( $validator->hasTypeDef( 'baz' ) );
+               $this->assertFalse( $validator->hasTypeDef( 'bazz' ) );
+       }
+
+       public function testGetTypeDef() {
+               $callbacks = new SimpleCallbacks( [] );
+               $factory = $this->getMockBuilder( ObjectFactory::class )
+                       ->setConstructorArgs( [ $this->getMockForAbstractClass( ContainerInterface::class ) ] )
+                       ->setMethods( [ 'createObject' ] )
+                       ->getMock();
+               $factory->method( 'createObject' )
+                       ->willReturnCallback( function ( $spec, $options ) use ( $callbacks ) {
+                               $this->assertInternalType( 'array', $spec );
+                               $this->assertSame(
+                                       [ 'extraArgs' => [ $callbacks ], 'assertClass' => TypeDef::class ], $options
+                               );
+                               $ret = $this->getMockBuilder( TypeDef::class )
+                                       ->setConstructorArgs( [ $callbacks ] )
+                                       ->getMockForAbstractClass();
+                               $ret->spec = $spec;
+                               return $ret;
+                       } );
+               $validator = new ParamValidator( $callbacks, $factory );
+
+               $def = $validator->getTypeDef( 'boolean' );
+               $this->assertInstanceOf( TypeDef::class, $def );
+               $this->assertSame( ParamValidator::$STANDARD_TYPES['boolean'], $def->spec );
+
+               $def = $validator->getTypeDef( [] );
+               $this->assertInstanceOf( TypeDef::class, $def );
+               $this->assertSame( ParamValidator::$STANDARD_TYPES['enum'], $def->spec );
+
+               $def = $validator->getTypeDef( 'missing' );
+               $this->assertNull( $def );
+       }
+
+       public function testGetTypeDef_caching() {
+               $callbacks = new SimpleCallbacks( [] );
+
+               $mb = $this->getMockBuilder( TypeDef::class )
+                       ->setConstructorArgs( [ $callbacks ] );
+               $def1 = $mb->getMockForAbstractClass();
+               $def2 = $mb->getMockForAbstractClass();
+               $this->assertNotSame( $def1, $def2, 'sanity check' );
+
+               $factory = $this->getMockBuilder( ObjectFactory::class )
+                       ->setConstructorArgs( [ $this->getMockForAbstractClass( ContainerInterface::class ) ] )
+                       ->setMethods( [ 'createObject' ] )
+                       ->getMock();
+               $factory->expects( $this->once() )->method( 'createObject' )->willReturn( $def1 );
+
+               $validator = new ParamValidator( $callbacks, $factory, [ 'typeDefs' => [
+                       'foo' => [],
+                       'bar' => $def2,
+               ] ] );
+
+               $this->assertSame( $def1, $validator->getTypeDef( 'foo' ) );
+
+               // Second call doesn't re-call ObjectFactory
+               $this->assertSame( $def1, $validator->getTypeDef( 'foo' ) );
+
+               // When registered a TypeDef directly, doesn't call ObjectFactory
+               $this->assertSame( $def2, $validator->getTypeDef( 'bar' ) );
+       }
+
+       /**
+        * @expectedException \UnexpectedValueException
+        * @expectedExceptionMessage Expected instance of Wikimedia\ParamValidator\TypeDef, got stdClass
+        */
+       public function testGetTypeDef_error() {
+               $validator = new ParamValidator(
+                       new SimpleCallbacks( [] ),
+                       new ObjectFactory( $this->getMockForAbstractClass( ContainerInterface::class ) ),
+                       [ 'typeDefs' => [ 'foo' => [ 'class' => \stdClass::class ] ] ]
+               );
+               $validator->getTypeDef( 'foo' );
+       }
+
+       /** @dataProvider provideNormalizeSettings */
+       public function testNormalizeSettings( $input, $expect ) {
+               $callbacks = new SimpleCallbacks( [] );
+
+               $mb = $this->getMockBuilder( TypeDef::class )
+                       ->setConstructorArgs( [ $callbacks ] )
+                       ->setMethods( [ 'normalizeSettings' ] );
+               $mock1 = $mb->getMockForAbstractClass();
+               $mock1->method( 'normalizeSettings' )->willReturnCallback( function ( $s ) {
+                       $s['foo'] = 'FooBar!';
+                       return $s;
+               } );
+               $mock2 = $mb->getMockForAbstractClass();
+               $mock2->method( 'normalizeSettings' )->willReturnCallback( function ( $s ) {
+                       $s['bar'] = 'FooBar!';
+                       return $s;
+               } );
+
+               $validator = new ParamValidator(
+                       $callbacks,
+                       new ObjectFactory( $this->getMockForAbstractClass( ContainerInterface::class ) ),
+                       [ 'typeDefs' => [ 'foo' => $mock1, 'bar' => $mock2 ] ]
+               );
+
+               $this->assertSame( $expect, $validator->normalizeSettings( $input ) );
+       }
+
+       public static function provideNormalizeSettings() {
+               return [
+                       'Plain value' => [
+                               'ok?',
+                               [ ParamValidator::PARAM_DEFAULT => 'ok?', ParamValidator::PARAM_TYPE => 'string' ],
+                       ],
+                       'Simple array' => [
+                               [ 'test' => 'ok?' ],
+                               [ 'test' => 'ok?', ParamValidator::PARAM_TYPE => 'NULL' ],
+                       ],
+                       'A type with overrides' => [
+                               [ ParamValidator::PARAM_TYPE => 'foo', 'test' => 'ok?' ],
+                               [ ParamValidator::PARAM_TYPE => 'foo', 'test' => 'ok?', 'foo' => 'FooBar!' ],
+                       ],
+               ];
+       }
+
+       /** @dataProvider provideExplodeMultiValue */
+       public function testExplodeMultiValue( $value, $limit, $expect ) {
+               $this->assertSame( $expect, ParamValidator::explodeMultiValue( $value, $limit ) );
+       }
+
+       public static function provideExplodeMultiValue() {
+               return [
+                       [ 'foobar', 100, [ 'foobar' ] ],
+                       [ 'foo|bar|baz', 100, [ 'foo', 'bar', 'baz' ] ],
+                       [ "\x1Ffoo\x1Fbar\x1Fbaz", 100, [ 'foo', 'bar', 'baz' ] ],
+                       [ 'foo|bar|baz', 2, [ 'foo', 'bar|baz' ] ],
+                       [ "\x1Ffoo\x1Fbar\x1Fbaz", 2, [ 'foo', "bar\x1Fbaz" ] ],
+                       [ '|bar|baz', 100, [ '', 'bar', 'baz' ] ],
+                       [ "\x1F\x1Fbar\x1Fbaz", 100, [ '', 'bar', 'baz' ] ],
+                       [ '', 100, [] ],
+                       [ "\x1F", 100, [] ],
+               ];
+       }
+
+       /**
+        * @expectedException DomainException
+        * @expectedExceptionMessage Param foo's type is unknown - string
+        */
+       public function testGetValue_badType() {
+               $validator = new ParamValidator(
+                       new SimpleCallbacks( [] ),
+                       new ObjectFactory( $this->getMockForAbstractClass( ContainerInterface::class ) ),
+                       [ 'typeDefs' => [] ]
+               );
+               $validator->getValue( 'foo', 'default', [] );
+       }
+
+       /** @dataProvider provideGetValue */
+       public function testGetValue(
+               $settings, $parseLimit, $get, $value, $isSensitive, $isDeprecated
+       ) {
+               $callbacks = new SimpleCallbacks( $get );
+               $dummy = (object)[];
+               $options = [ $dummy ];
+
+               $settings += [
+                       ParamValidator::PARAM_TYPE => 'xyz',
+                       ParamValidator::PARAM_DEFAULT => null,
+               ];
+
+               $mockDef = $this->getMockBuilder( TypeDef::class )
+                       ->setConstructorArgs( [ $callbacks ] )
+                       ->getMockForAbstractClass();
+
+               // Mock the validateValue method so we can test only getValue
+               $validator = $this->getMockBuilder( ParamValidator::class )
+                       ->setConstructorArgs( [
+                               $callbacks,
+                               new ObjectFactory( $this->getMockForAbstractClass( ContainerInterface::class ) ),
+                               [ 'typeDefs' => [ 'xyz' => $mockDef ] ]
+                       ] )
+                       ->setMethods( [ 'validateValue' ] )
+                       ->getMock();
+               $validator->expects( $this->once() )->method( 'validateValue' )
+                       ->with(
+                               $this->identicalTo( 'foobar' ),
+                               $this->identicalTo( $value ),
+                               $this->identicalTo( $settings ),
+                               $this->identicalTo( $options )
+                       )
+                       ->willReturn( $dummy );
+
+               $this->assertSame( $dummy, $validator->getValue( 'foobar', $settings, $options ) );
+
+               $expectConditions = [];
+               if ( $isSensitive ) {
+                       $expectConditions[] = new ValidationException(
+                               'foobar', $value, $settings, 'param-sensitive', []
+                       );
+               }
+               if ( $isDeprecated ) {
+                       $expectConditions[] = new ValidationException(
+                               'foobar', $value, $settings, 'param-deprecated', []
+                       );
+               }
+               $this->assertEquals( $expectConditions, $callbacks->getRecordedConditions() );
+       }
+
+       public static function provideGetValue() {
+               $sen = [ ParamValidator::PARAM_SENSITIVE => true ];
+               $dep = [ ParamValidator::PARAM_DEPRECATED => true ];
+               $dflt = [ ParamValidator::PARAM_DEFAULT => 'DeFaUlT' ];
+               return [
+                       'Simple case' => [ [], false, [ 'foobar' => '!!!' ], '!!!', false, false ],
+                       'Not provided' => [ $sen + $dep, false, [], null, false, false ],
+                       'Not provided, default' => [ $sen + $dep + $dflt, true, [], 'DeFaUlT', false, false ],
+                       'Provided' => [ $dflt, false, [ 'foobar' => 'XYZ' ], 'XYZ', false, false ],
+                       'Provided, sensitive' => [ $sen, false, [ 'foobar' => 'XYZ' ], 'XYZ', true, false ],
+                       'Provided, deprecated' => [ $dep, false, [ 'foobar' => 'XYZ' ], 'XYZ', false, true ],
+                       'Provided array' => [ $dflt, false, [ 'foobar' => [ 'XYZ' ] ], [ 'XYZ' ], false, false ],
+               ];
+       }
+
+       /**
+        * @expectedException DomainException
+        * @expectedExceptionMessage Param foo's type is unknown - string
+        */
+       public function testValidateValue_badType() {
+               $validator = new ParamValidator(
+                       new SimpleCallbacks( [] ),
+                       new ObjectFactory( $this->getMockForAbstractClass( ContainerInterface::class ) ),
+                       [ 'typeDefs' => [] ]
+               );
+               $validator->validateValue( 'foo', null, 'default', [] );
+       }
+
+       /** @dataProvider provideValidateValue */
+       public function testValidateValue(
+               $value, $settings, $highLimits, $valuesList, $calls, $expect, $expectConditions = [],
+               $constructorOptions = []
+       ) {
+               $callbacks = new SimpleCallbacks( [] );
+               $settings += [
+                       ParamValidator::PARAM_TYPE => 'xyz',
+                       ParamValidator::PARAM_DEFAULT => null,
+               ];
+               $dummy = (object)[];
+               $options = [ $dummy, 'useHighLimits' => $highLimits ];
+               $eOptions = $options;
+               $eOptions2 = $eOptions;
+               if ( $valuesList !== null ) {
+                       $eOptions2['values-list'] = $valuesList;
+               }
+
+               $mockDef = $this->getMockBuilder( TypeDef::class )
+                       ->setConstructorArgs( [ $callbacks ] )
+                       ->setMethods( [ 'validate', 'getEnumValues' ] )
+                       ->getMockForAbstractClass();
+               $mockDef->method( 'getEnumValues' )
+                       ->with(
+                               $this->identicalTo( 'foobar' ), $this->identicalTo( $settings ), $this->identicalTo( $eOptions )
+                       )
+                       ->willReturn( [ 'a', 'b', 'c', 'd', 'e', 'f' ] );
+               $mockDef->expects( $this->exactly( count( $calls ) ) )->method( 'validate' )->willReturnCallback(
+                       function ( $n, $v, $s, $o ) use ( $settings, $eOptions2, $calls ) {
+                               $this->assertSame( 'foobar', $n );
+                               $this->assertSame( $settings, $s );
+                               $this->assertSame( $eOptions2, $o );
+
+                               if ( !array_key_exists( $v, $calls ) ) {
+                                       $this->fail( "Called with unexpected value '$v'" );
+                               }
+                               if ( $calls[$v] === null ) {
+                                       throw new ValidationException( $n, $v, $s, 'badvalue', [] );
+                               }
+                               return $calls[$v];
+                       }
+               );
+
+               $validator = new ParamValidator(
+                       $callbacks,
+                       new ObjectFactory( $this->getMockForAbstractClass( ContainerInterface::class ) ),
+                       $constructorOptions + [ 'typeDefs' => [ 'xyz' => $mockDef ] ]
+               );
+
+               if ( $expect instanceof ValidationException ) {
+                       try {
+                               $validator->validateValue( 'foobar', $value, $settings, $options );
+                               $this->fail( 'Expected exception not thrown' );
+                       } catch ( ValidationException $ex ) {
+                               $this->assertSame( $expect->getFailureCode(), $ex->getFailureCode() );
+                               $this->assertSame( $expect->getFailureData(), $ex->getFailureData() );
+                       }
+               } else {
+                       $this->assertSame(
+                               $expect, $validator->validateValue( 'foobar', $value, $settings, $options )
+                       );
+
+                       $conditions = [];
+                       foreach ( $callbacks->getRecordedConditions() as $c ) {
+                               $conditions[] = array_merge( [ $c->getFailureCode() ], $c->getFailureData() );
+                       }
+                       $this->assertSame( $expectConditions, $conditions );
+               }
+       }
+
+       public static function provideValidateValue() {
+               return [
+                       'No value' => [ null, [], false, null, [], null ],
+                       'No value, required' => [
+                               null,
+                               [ ParamValidator::PARAM_REQUIRED => true ],
+                               false,
+                               null,
+                               [],
+                               new ValidationException( 'foobar', null, [], 'missingparam', [] ),
+                       ],
+                       'Non-multi value' => [ 'abc', [], false, null, [ 'abc' => 'def' ], 'def' ],
+                       'Simple multi value' => [
+                               'a|b|c|d',
+                               [ ParamValidator::PARAM_ISMULTI => true ],
+                               false,
+                               [ 'a', 'b', 'c', 'd' ],
+                               [ 'a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => 'D' ],
+                               [ 'A', 'B', 'C', 'D' ],
+                       ],
+                       'Array multi value' => [
+                               [ 'a', 'b', 'c', 'd' ],
+                               [ ParamValidator::PARAM_ISMULTI => true ],
+                               false,
+                               [ 'a', 'b', 'c', 'd' ],
+                               [ 'a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => 'D' ],
+                               [ 'A', 'B', 'C', 'D' ],
+                       ],
+                       'Multi value with PARAM_ALL' => [
+                               '*',
+                               [ ParamValidator::PARAM_ISMULTI => true, ParamValidator::PARAM_ALL => true ],
+                               false,
+                               null,
+                               [],
+                               [ 'a', 'b', 'c', 'd', 'e', 'f' ],
+                       ],
+                       'Multi value with PARAM_ALL = "x"' => [
+                               'x',
+                               [ ParamValidator::PARAM_ISMULTI => true, ParamValidator::PARAM_ALL => "x" ],
+                               false,
+                               null,
+                               [],
+                               [ 'a', 'b', 'c', 'd', 'e', 'f' ],
+                       ],
+                       'Multi value with PARAM_ALL = "x", passing "*"' => [
+                               '*',
+                               [ ParamValidator::PARAM_ISMULTI => true, ParamValidator::PARAM_ALL => "x" ],
+                               false,
+                               [ '*' ],
+                               [ '*' => '?' ],
+                               [ '?' ],
+                       ],
+
+                       'Too many values' => [
+                               'a|b|c|d',
+                               [
+                                       ParamValidator::PARAM_ISMULTI => true,
+                                       ParamValidator::PARAM_ISMULTI_LIMIT1 => 2,
+                                       ParamValidator::PARAM_ISMULTI_LIMIT2 => 4,
+                               ],
+                               false,
+                               null,
+                               [],
+                               new ValidationException( 'foobar', 'a|b|c|d', [], 'toomanyvalues', [ 'limit' => 2 ] ),
+                       ],
+                       'Too many values as array' => [
+                               [ 'a', 'b', 'c', 'd' ],
+                               [
+                                       ParamValidator::PARAM_ISMULTI => true,
+                                       ParamValidator::PARAM_ISMULTI_LIMIT1 => 2,
+                                       ParamValidator::PARAM_ISMULTI_LIMIT2 => 4,
+                               ],
+                               false,
+                               null,
+                               [],
+                               new ValidationException(
+                                       'foobar', [ 'a', 'b', 'c', 'd' ], [], 'toomanyvalues', [ 'limit' => 2 ]
+                               ),
+                       ],
+                       'Not too many values for highlimits' => [
+                               'a|b|c|d',
+                               [
+                                       ParamValidator::PARAM_ISMULTI => true,
+                                       ParamValidator::PARAM_ISMULTI_LIMIT1 => 2,
+                                       ParamValidator::PARAM_ISMULTI_LIMIT2 => 4,
+                               ],
+                               true,
+                               [ 'a', 'b', 'c', 'd' ],
+                               [ 'a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => 'D' ],
+                               [ 'A', 'B', 'C', 'D' ],
+                       ],
+                       'Too many values for highlimits' => [
+                               'a|b|c|d|e',
+                               [
+                                       ParamValidator::PARAM_ISMULTI => true,
+                                       ParamValidator::PARAM_ISMULTI_LIMIT1 => 2,
+                                       ParamValidator::PARAM_ISMULTI_LIMIT2 => 4,
+                               ],
+                               true,
+                               null,
+                               [],
+                               new ValidationException( 'foobar', 'a|b|c|d|e', [], 'toomanyvalues', [ 'limit' => 4 ] ),
+                       ],
+
+                       'Too many values via default' => [
+                               'a|b|c|d',
+                               [
+                                       ParamValidator::PARAM_ISMULTI => true,
+                               ],
+                               false,
+                               null,
+                               [],
+                               new ValidationException( 'foobar', 'a|b|c|d', [], 'toomanyvalues', [ 'limit' => 2 ] ),
+                               [],
+                               [ 'ismultiLimits' => [ 2, 4 ] ],
+                       ],
+                       'Not too many values for highlimits via default' => [
+                               'a|b|c|d',
+                               [
+                                       ParamValidator::PARAM_ISMULTI => true,
+                               ],
+                               true,
+                               [ 'a', 'b', 'c', 'd' ],
+                               [ 'a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => 'D' ],
+                               [ 'A', 'B', 'C', 'D' ],
+                               [],
+                               [ 'ismultiLimits' => [ 2, 4 ] ],
+                       ],
+                       'Too many values for highlimits via default' => [
+                               'a|b|c|d|e',
+                               [
+                                       ParamValidator::PARAM_ISMULTI => true,
+                               ],
+                               true,
+                               null,
+                               [],
+                               new ValidationException( 'foobar', 'a|b|c|d|e', [], 'toomanyvalues', [ 'limit' => 4 ] ),
+                               [],
+                               [ 'ismultiLimits' => [ 2, 4 ] ],
+                       ],
+
+                       'Invalid values' => [
+                               'a|b|c|d',
+                               [ ParamValidator::PARAM_ISMULTI => true ],
+                               false,
+                               [ 'a', 'b', 'c', 'd' ],
+                               [ 'a' => 'A', 'b' => null ],
+                               new ValidationException( 'foobar', 'b', [], 'badvalue', [] ),
+                       ],
+                       'Ignored invalid values' => [
+                               'a|b|c|d',
+                               [
+                                       ParamValidator::PARAM_ISMULTI => true,
+                                       ParamValidator::PARAM_IGNORE_INVALID_VALUES => true,
+                               ],
+                               false,
+                               [ 'a', 'b', 'c', 'd' ],
+                               [ 'a' => 'A', 'b' => null, 'c' => null, 'd' => 'D' ],
+                               [ 'A', 'D' ],
+                               [
+                                       [ 'unrecognizedvalues', 'values' => [ 'b', 'c' ] ],
+                               ],
+                       ],
+               ];
+       }
+
+}
diff --git a/tests/phpunit/includes/libs/ParamValidator/SimpleCallbacksTest.php b/tests/phpunit/includes/libs/ParamValidator/SimpleCallbacksTest.php
new file mode 100644 (file)
index 0000000..ebe1dcc
--- /dev/null
@@ -0,0 +1,88 @@
+<?php
+
+namespace Wikimedia\ParamValidator;
+
+use Psr\Http\Message\UploadedFileInterface;
+
+/**
+ * @covers Wikimedia\ParamValidator\SimpleCallbacks
+ */
+class SimpleCallbacksTest extends \PHPUnit\Framework\TestCase {
+
+       public function testDataAccess() {
+               $callbacks = new SimpleCallbacks(
+                       [ 'foo' => 'Foo!', 'bar' => null ],
+                       [
+                               'file1' => [
+                                       'name' => 'example.txt',
+                                       'type' => 'text/plain',
+                                       'tmp_name' => '...',
+                                       'error' => UPLOAD_ERR_OK,
+                                       'size' => 123,
+                               ],
+                               'file2' => [
+                                       'name' => '',
+                                       'type' => '',
+                                       'tmp_name' => '',
+                                       'error' => UPLOAD_ERR_NO_FILE,
+                                       'size' => 0,
+                               ],
+                       ]
+               );
+
+               $this->assertTrue( $callbacks->hasParam( 'foo', [] ) );
+               $this->assertFalse( $callbacks->hasParam( 'bar', [] ) );
+               $this->assertFalse( $callbacks->hasParam( 'baz', [] ) );
+               $this->assertFalse( $callbacks->hasParam( 'file1', [] ) );
+
+               $this->assertSame( 'Foo!', $callbacks->getValue( 'foo', null, [] ) );
+               $this->assertSame( null, $callbacks->getValue( 'bar', null, [] ) );
+               $this->assertSame( 123, $callbacks->getValue( 'bar', 123, [] ) );
+               $this->assertSame( null, $callbacks->getValue( 'baz', null, [] ) );
+               $this->assertSame( null, $callbacks->getValue( 'file1', null, [] ) );
+
+               $this->assertFalse( $callbacks->hasUpload( 'foo', [] ) );
+               $this->assertFalse( $callbacks->hasUpload( 'bar', [] ) );
+               $this->assertTrue( $callbacks->hasUpload( 'file1', [] ) );
+               $this->assertTrue( $callbacks->hasUpload( 'file2', [] ) );
+               $this->assertFalse( $callbacks->hasUpload( 'baz', [] ) );
+
+               $this->assertNull( $callbacks->getUploadedFile( 'foo', [] ) );
+               $this->assertNull( $callbacks->getUploadedFile( 'bar', [] ) );
+               $this->assertInstanceOf(
+                       UploadedFileInterface::class, $callbacks->getUploadedFile( 'file1', [] )
+               );
+               $this->assertInstanceOf(
+                       UploadedFileInterface::class, $callbacks->getUploadedFile( 'file2', [] )
+               );
+               $this->assertNull( $callbacks->getUploadedFile( 'baz', [] ) );
+
+               $file = $callbacks->getUploadedFile( 'file1', [] );
+               $this->assertSame( 'example.txt', $file->getClientFilename() );
+               $file = $callbacks->getUploadedFile( 'file2', [] );
+               $this->assertSame( UPLOAD_ERR_NO_FILE, $file->getError() );
+
+               $this->assertFalse( $callbacks->useHighLimits( [] ) );
+               $this->assertFalse( $callbacks->useHighLimits( [ 'useHighLimits' => false ] ) );
+               $this->assertTrue( $callbacks->useHighLimits( [ 'useHighLimits' => true ] ) );
+       }
+
+       public function testRecording() {
+               $callbacks = new SimpleCallbacks( [] );
+
+               $this->assertSame( [], $callbacks->getRecordedConditions() );
+
+               $ex1 = new ValidationException( 'foo', 'Foo!', [], 'foo', [] );
+               $callbacks->recordCondition( $ex1, [] );
+               $ex2 = new ValidationException( 'bar', null, [], 'barbar', [ 'bAr' => 'BaR' ] );
+               $callbacks->recordCondition( $ex2, [] );
+               $callbacks->recordCondition( $ex2, [] );
+               $this->assertSame( [ $ex1, $ex2, $ex2 ], $callbacks->getRecordedConditions() );
+
+               $callbacks->clearRecordedConditions();
+               $this->assertSame( [], $callbacks->getRecordedConditions() );
+               $callbacks->recordCondition( $ex1, [] );
+               $this->assertSame( [ $ex1 ], $callbacks->getRecordedConditions() );
+       }
+
+}
diff --git a/tests/phpunit/includes/libs/ParamValidator/TypeDef/BooleanDefTest.php b/tests/phpunit/includes/libs/ParamValidator/TypeDef/BooleanDefTest.php
new file mode 100644 (file)
index 0000000..75afb33
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\ParamValidator\ValidationException;
+
+/**
+ * @covers \Wikimedia\ParamValidator\TypeDef\BooleanDef
+ */
+class BooleanDefTest extends TypeDefTestCase {
+
+       protected static $testClass = BooleanDef::class;
+
+       public function provideValidate() {
+               $ex = new ValidationException( 'test', '', [], 'badbool', [
+                       'truevals' => BooleanDef::$TRUEVALS,
+                       'falsevals' => array_merge( BooleanDef::$FALSEVALS, [ 'the empty string' ] ),
+               ] );
+
+               foreach ( [
+                       [ BooleanDef::$TRUEVALS, true ],
+                       [ BooleanDef::$FALSEVALS, false ],
+                       [ [ '' ], false ],
+                       [ [ '2', 'foobar' ], $ex ],
+               ] as list( $vals, $expect ) ) {
+                       foreach ( $vals as $v ) {
+                               yield "Value '$v'" => [ $v, $expect ];
+                               $v2 = ucfirst( $v );
+                               if ( $v2 !== $v ) {
+                                       yield "Value '$v2'" => [ $v2, $expect ];
+                               }
+                               $v3 = strtoupper( $v );
+                               if ( $v3 !== $v2 ) {
+                                       yield "Value '$v3'" => [ $v3, $expect ];
+                               }
+                       }
+               }
+       }
+
+       public function provideStringifyValue() {
+               return [
+                       [ true, 'true' ],
+                       [ false, 'false' ],
+               ];
+       }
+
+}
diff --git a/tests/phpunit/includes/libs/ParamValidator/TypeDef/EnumDefTest.php b/tests/phpunit/includes/libs/ParamValidator/TypeDef/EnumDefTest.php
new file mode 100644 (file)
index 0000000..18d0aca
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\ParamValidator\ParamValidator;
+use Wikimedia\ParamValidator\ValidationException;
+
+/**
+ * @covers Wikimedia\ParamValidator\TypeDef\EnumDef
+ */
+class EnumDefTest extends TypeDefTestCase {
+
+       protected static $testClass = EnumDef::class;
+
+       public function provideValidate() {
+               $settings = [
+                       ParamValidator::PARAM_TYPE => [ 'a', 'b', 'c', 'd' ],
+                       EnumDef::PARAM_DEPRECATED_VALUES => [
+                               'b' => [ 'not-to-be' ],
+                               'c' => true,
+                       ],
+               ];
+
+               return [
+                       'Basic' => [ 'a', 'a', $settings ],
+                       'Deprecated' => [ 'c', 'c', $settings, [], [ [ 'deprecated-value', 'flag' => true ] ] ],
+                       'Deprecated with message' => [
+                               'b', 'b', $settings, [],
+                               [ [ 'deprecated-value', 'flag' => [ 'not-to-be' ] ] ],
+                       ],
+                       'Bad value, non-multi' => [
+                               'x', new ValidationException( 'test', 'x', $settings, 'badvalue', [] ),
+                               $settings,
+                       ],
+                       'Bad value, non-multi but looks like it' => [
+                               'x|y', new ValidationException( 'test', 'x|y', $settings, 'notmulti', [] ),
+                               $settings,
+                       ],
+                       'Bad value, multi' => [
+                               'x|y', new ValidationException( 'test', 'x|y', $settings, 'badvalue', [] ),
+                               $settings + [ ParamValidator::PARAM_ISMULTI => true ],
+                               [ 'values-list' => [ 'x|y' ] ],
+                       ],
+               ];
+       }
+
+       public function provideGetEnumValues() {
+               return [
+                       'Basic test' => [
+                               [ ParamValidator::PARAM_TYPE => [ 'a', 'b', 'c', 'd' ] ],
+                               [ 'a', 'b', 'c', 'd' ],
+                       ],
+               ];
+       }
+
+       public function provideStringifyValue() {
+               return [
+                       'Basic test' => [ 123, '123' ],
+                       'Array' => [ [ 1, 2, 3 ], '1|2|3' ],
+                       'Array with pipes' => [ [ 1, 2, '3|4', 5 ], "\x1f1\x1f2\x1f3|4\x1f5" ],
+               ];
+       }
+
+}
diff --git a/tests/phpunit/includes/libs/ParamValidator/TypeDef/FloatDefTest.php b/tests/phpunit/includes/libs/ParamValidator/TypeDef/FloatDefTest.php
new file mode 100644 (file)
index 0000000..7bd053a
--- /dev/null
@@ -0,0 +1,122 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\ParamValidator\SimpleCallbacks;
+use Wikimedia\ParamValidator\ValidationException;
+
+/**
+ * @covers Wikimedia\ParamValidator\TypeDef\FloatDef
+ */
+class FloatDefTest extends TypeDefTestCase {
+
+       protected static $testClass = FloatDef::class;
+
+       public function provideValidate() {
+               return [
+                       [ '123', 123.0 ],
+                       [ '123.4', 123.4 ],
+                       [ '0.4', 0.4 ],
+                       [ '.4', 0.4 ],
+
+                       [ '+123', 123.0 ],
+                       [ '+123.4', 123.4 ],
+                       [ '+0.4', 0.4 ],
+                       [ '+.4', 0.4 ],
+
+                       [ '-123', -123.0 ],
+                       [ '-123.4', -123.4 ],
+                       [ '-.4', -0.4 ],
+                       [ '-.4', -0.4 ],
+
+                       [ '123e5', 12300000.0 ],
+                       [ '123E5', 12300000.0 ],
+                       [ '123.4e+5', 12340000.0 ],
+                       [ '123E5', 12300000.0 ],
+                       [ '-123.4e-5', -0.001234 ],
+                       [ '.4E-5', 0.000004 ],
+
+                       [ '0', 0 ],
+                       [ '000000', 0 ],
+                       [ '0000.0000', 0 ],
+                       [ '000001.0002000000', 1.0002 ],
+                       [ '1e0', 1 ],
+                       [ '1e-0000', 1 ],
+                       [ '1e+00010', 1e10 ],
+
+                       'Weird, but ok' => [ '-0', 0 ],
+                       'Underflow is ok' => [ '1e-9999', 0 ],
+
+                       'Empty decimal part' => [ '1.', new ValidationException( 'test', '1.', [], 'badfloat', [] ) ],
+                       'Bad sign' => [ ' 1', new ValidationException( 'test', ' 1', [], 'badfloat', [] ) ],
+                       'Comma as decimal separator or thousands grouping?'
+                               => [ '1,234', new ValidationException( 'test', '1,234', [], 'badfloat', [] ) ],
+                       'U+2212 minus' => [ '−1', new ValidationException( 'test', '−1', [], 'badfloat', [] ) ],
+                       'Overflow' => [ '1e9999', new ValidationException( 'test', '1e9999', [], 'notfinite', [] ) ],
+                       'Overflow, -INF'
+                               => [ '-1e9999', new ValidationException( 'test', '-1e9999', [], 'notfinite', [] ) ],
+                       'Bogus value' => [ 'foo', new ValidationException( 'test', 'foo', [], 'badfloat', [] ) ],
+                       'Bogus value (2)' => [ '123f4', new ValidationException( 'test', '123f4', [], 'badfloat', [] ) ],
+                       'Newline' => [ "123\n", new ValidationException( 'test', "123\n", [], 'badfloat', [] ) ],
+               ];
+       }
+
+       public function provideStringifyValue() {
+               $digits = defined( 'PHP_FLOAT_DIG' ) ? PHP_FLOAT_DIG : 15;
+
+               return [
+                       [ 1.2, '1.2' ],
+                       [ 10 / 3, '3.' . str_repeat( '3', $digits - 1 ) ],
+                       [ 1e100, '1.0e+100' ],
+                       [ 6.022e-23, '6.022e-23' ],
+               ];
+       }
+
+       /** @dataProvider provideLocales */
+       public function testStringifyValue_localeWeirdness( $locale ) {
+               static $cats = [ LC_ALL, LC_MONETARY, LC_NUMERIC ];
+
+               $curLocales = [];
+               foreach ( $cats as $c ) {
+                       $curLocales[$c] = setlocale( $c, '0' );
+                       if ( $curLocales[$c] === false ) {
+                               $this->markTestSkipped( 'Locale support is unavailable' );
+                       }
+               }
+               try {
+                       foreach ( $cats as $c ) {
+                               if ( setlocale( $c, $locale ) === false ) {
+                                       $this->markTestSkipped( "Locale \"$locale\" is unavailable" );
+                               }
+                       }
+
+                       $typeDef = $this->getInstance( new SimpleCallbacks( [] ), [] );
+                       $this->assertSame( '123456.789', $typeDef->stringifyValue( 'test', 123456.789, [], [] ) );
+                       $this->assertSame( '-123456.789', $typeDef->stringifyValue( 'test', -123456.789, [], [] ) );
+                       $this->assertSame( '1.0e+20', $typeDef->stringifyValue( 'test', 1e20, [], [] ) );
+                       $this->assertSame( '1.0e-20', $typeDef->stringifyValue( 'test', 1e-20, [], [] ) );
+               } finally {
+                       foreach ( $curLocales as $c => $v ) {
+                               setlocale( $c, $v );
+                       }
+               }
+       }
+
+       public function provideLocales() {
+               return [
+                       // May as well test these.
+                       [ 'C' ],
+                       [ 'C.UTF-8' ],
+
+                       // Some hopefullt-common locales with decimal_point = ',' and thousands_sep = '.'
+                       [ 'de_DE' ],
+                       [ 'de_DE.utf8' ],
+                       [ 'es_ES' ],
+                       [ 'es_ES.utf8' ],
+
+                       // This one, on my system at least, has decimal_point as U+066B.
+                       [ 'ps_AF' ],
+               ];
+       }
+
+}
diff --git a/tests/phpunit/includes/libs/ParamValidator/TypeDef/IntegerDefTest.php b/tests/phpunit/includes/libs/ParamValidator/TypeDef/IntegerDefTest.php
new file mode 100644 (file)
index 0000000..21fc987
--- /dev/null
@@ -0,0 +1,159 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\ParamValidator\ParamValidator;
+use Wikimedia\ParamValidator\ValidationException;
+
+/**
+ * @covers Wikimedia\ParamValidator\TypeDef\IntegerDef
+ */
+class IntegerDefTest extends TypeDefTestCase {
+
+       protected static $testClass = IntegerDef::class;
+
+       /**
+        * @param string $v Representing a positive integer
+        * @return string Representing $v + 1
+        */
+       private static function plusOne( $v ) {
+               for ( $i = strlen( $v ) - 1; $i >= 0; $i-- ) {
+                       if ( $v[$i] === '9' ) {
+                               $v[$i] = '0';
+                       } else {
+                               $v[$i] = $v[$i] + 1;
+                               return $v;
+                       }
+               }
+               return '1' . $v;
+       }
+
+       public function provideValidate() {
+               $badinteger = new ValidationException( 'test', '...', [], 'badinteger', [] );
+               $belowminimum = new ValidationException(
+                       'test', '...', [], 'belowminimum', [ 'min' => 0, 'max' => 2, 'max2' => '' ]
+               );
+               $abovemaximum = new ValidationException(
+                       'test', '...', [], 'abovemaximum', [ 'min' => 0, 'max' => 2, 'max2' => '' ]
+               );
+               $abovemaximum2 = new ValidationException(
+                       'test', '...', [], 'abovemaximum', [ 'min' => 0, 'max' => 2, 'max2' => 4 ]
+               );
+               $abovehighmaximum = new ValidationException(
+                       'test', '...', [], 'abovehighmaximum', [ 'min' => 0, 'max' => 2, 'max2' => 4 ]
+               );
+               $asWarn = function ( ValidationException $ex ) {
+                       return [ $ex->getFailureCode() ] + $ex->getFailureData();
+               };
+
+               $minmax = [
+                       IntegerDef::PARAM_MIN => 0,
+                       IntegerDef::PARAM_MAX => 2,
+               ];
+               $minmax2 = [
+                       IntegerDef::PARAM_MIN => 0,
+                       IntegerDef::PARAM_MAX => 2,
+                       IntegerDef::PARAM_MAX2 => 4,
+               ];
+               $ignore = [
+                       IntegerDef::PARAM_IGNORE_RANGE => true,
+               ];
+               $usehigh = [ 'useHighLimits' => true ];
+
+               return [
+                       [ '123', 123 ],
+                       [ '-123', -123 ],
+                       [ '000123', 123 ],
+                       [ '000', 0 ],
+                       [ '-0', 0 ],
+                       [ (string)PHP_INT_MAX, PHP_INT_MAX ],
+                       [ '0000' . PHP_INT_MAX, PHP_INT_MAX ],
+                       [ (string)PHP_INT_MIN, PHP_INT_MIN ],
+                       [ '-0000' . substr( PHP_INT_MIN, 1 ), PHP_INT_MIN ],
+
+                       'Overflow' => [ self::plusOne( (string)PHP_INT_MAX ), $badinteger ],
+                       'Negative overflow' => [ '-' . self::plusOne( substr( PHP_INT_MIN, 1 ) ), $badinteger ],
+
+                       'Float' => [ '1.5', $badinteger ],
+                       'Float (e notation)' => [ '1e1', $badinteger ],
+                       'Bad sign (space)' => [ ' 1', $badinteger ],
+                       'Bad sign (newline)' => [ "\n1", $badinteger ],
+                       'Bogus value' => [ 'foo', $badinteger ],
+                       'Bogus value (2)' => [ '1foo', $badinteger ],
+                       'Hex value' => [ '0x123', $badinteger ],
+                       'Newline' => [ "1\n", $badinteger ],
+
+                       'Ok with range' => [ '1', 1, $minmax ],
+                       'Below minimum' => [ '-1', $belowminimum, $minmax ],
+                       'Below minimum, ignored' => [ '-1', 0, $minmax + $ignore, [], [ $asWarn( $belowminimum ) ] ],
+                       'Above maximum' => [ '3', $abovemaximum, $minmax ],
+                       'Above maximum, ignored' => [ '3', 2, $minmax + $ignore, [], [ $asWarn( $abovemaximum ) ] ],
+                       'Not above max2 but can\'t use it' => [ '3', $abovemaximum2, $minmax2, [] ],
+                       'Not above max2 but can\'t use it, ignored'
+                               => [ '3', 2, $minmax2 + $ignore, [], [ $asWarn( $abovemaximum2 ) ] ],
+                       'Not above max2' => [ '3', 3, $minmax2, $usehigh ],
+                       'Above max2' => [ '5', $abovehighmaximum, $minmax2, $usehigh ],
+                       'Above max2, ignored'
+                               => [ '5', 4, $minmax2 + $ignore, $usehigh, [ $asWarn( $abovehighmaximum ) ] ],
+               ];
+       }
+
+       public function provideNormalizeSettings() {
+               return [
+                       [ [], [] ],
+                       [
+                               [ IntegerDef::PARAM_MAX => 2 ],
+                               [ IntegerDef::PARAM_MAX => 2 ],
+                       ],
+                       [
+                               [ IntegerDef::PARAM_MIN => 1, IntegerDef::PARAM_MAX => 2, IntegerDef::PARAM_MAX2 => 4 ],
+                               [ IntegerDef::PARAM_MIN => 1, IntegerDef::PARAM_MAX => 2, IntegerDef::PARAM_MAX2 => 4 ],
+                       ],
+                       [
+                               [ IntegerDef::PARAM_MIN => 1, IntegerDef::PARAM_MAX => 4, IntegerDef::PARAM_MAX2 => 2 ],
+                               [ IntegerDef::PARAM_MIN => 1, IntegerDef::PARAM_MAX => 4, IntegerDef::PARAM_MAX2 => 4 ],
+                       ],
+                       [
+                               [ IntegerDef::PARAM_MAX2 => 2 ],
+                               [],
+                       ],
+               ];
+       }
+
+       public function provideDescribeSettings() {
+               return [
+                       'Basic' => [ [], [], [] ],
+                       'Default' => [
+                               [ ParamValidator::PARAM_DEFAULT => 123 ],
+                               [ 'default' => '123' ],
+                               [ 'default' => [ 'value' => '123' ] ],
+                       ],
+                       'Min' => [
+                               [ ParamValidator::PARAM_DEFAULT => 123, IntegerDef::PARAM_MIN => 0 ],
+                               [ 'default' => '123', 'min' => 0 ],
+                               [ 'default' => [ 'value' => '123' ], 'min' => [ 'min' => 0, 'max' => '', 'max2' => '' ] ],
+                       ],
+                       'Max' => [
+                               [ IntegerDef::PARAM_MAX => 2 ],
+                               [ 'max' => 2 ],
+                               [ 'max' => [ 'min' => '', 'max' => 2, 'max2' => '' ] ],
+                       ],
+                       'Max2' => [
+                               [ IntegerDef::PARAM_MAX => 2, IntegerDef::PARAM_MAX2 => 4 ],
+                               [ 'max' => 2, 'max2' => 4 ],
+                               [ 'max2' => [ 'min' => '', 'max' => 2, 'max2' => 4 ] ],
+                       ],
+                       'Minmax' => [
+                               [ IntegerDef::PARAM_MIN => 0, IntegerDef::PARAM_MAX => 2 ],
+                               [ 'min' => 0, 'max' => 2 ],
+                               [ 'minmax' => [ 'min' => 0, 'max' => 2, 'max2' => '' ] ],
+                       ],
+                       'Minmax2' => [
+                               [ IntegerDef::PARAM_MIN => 0, IntegerDef::PARAM_MAX => 2, IntegerDef::PARAM_MAX2 => 4 ],
+                               [ 'min' => 0, 'max' => 2, 'max2' => 4 ],
+                               [ 'minmax2' => [ 'min' => 0, 'max' => 2, 'max2' => 4 ] ],
+                       ],
+               ];
+       }
+
+}
diff --git a/tests/phpunit/includes/libs/ParamValidator/TypeDef/LimitDefTest.php b/tests/phpunit/includes/libs/ParamValidator/TypeDef/LimitDefTest.php
new file mode 100644 (file)
index 0000000..2bf25e5
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+require_once __DIR__ . '/IntegerDefTest.php';
+
+/**
+ * @covers Wikimedia\ParamValidator\TypeDef\LimitDef
+ */
+class LimitDefTest extends IntegerDefTest {
+
+       protected static $testClass = LimitDef::class;
+
+       public function provideValidate() {
+               yield from parent::provideValidate();
+
+               $useHigh = [ 'useHighLimits' => true ];
+               $max = [ IntegerDef::PARAM_MAX => 2 ];
+               $max2 = [ IntegerDef::PARAM_MAX => 2, IntegerDef::PARAM_MAX2 => 4 ];
+
+               yield 'Max' => [ 'max', 2, $max ];
+               yield 'Max, use high' => [ 'max', 2, $max, $useHigh ];
+               yield 'Max2' => [ 'max', 2, $max2 ];
+               yield 'Max2, use high' => [ 'max', 4, $max2, $useHigh ];
+       }
+
+       public function provideNormalizeSettings() {
+               return [
+                       [ [], [ IntegerDef::PARAM_MIN => 0 ] ],
+                       [
+                               [ IntegerDef::PARAM_MAX => 2 ],
+                               [ IntegerDef::PARAM_MAX => 2, IntegerDef::PARAM_MIN => 0 ],
+                       ],
+                       [
+                               [ IntegerDef::PARAM_MIN => 1, IntegerDef::PARAM_MAX => 2, IntegerDef::PARAM_MAX2 => 4 ],
+                               [ IntegerDef::PARAM_MIN => 1, IntegerDef::PARAM_MAX => 2, IntegerDef::PARAM_MAX2 => 4 ],
+                       ],
+                       [
+                               [ IntegerDef::PARAM_MIN => 1, IntegerDef::PARAM_MAX => 4, IntegerDef::PARAM_MAX2 => 2 ],
+                               [ IntegerDef::PARAM_MIN => 1, IntegerDef::PARAM_MAX => 4, IntegerDef::PARAM_MAX2 => 4 ],
+                       ],
+                       [
+                               [ IntegerDef::PARAM_MAX2 => 2 ],
+                               [ IntegerDef::PARAM_MIN => 0 ],
+                       ],
+               ];
+       }
+
+}
diff --git a/tests/phpunit/includes/libs/ParamValidator/TypeDef/PasswordDefTest.php b/tests/phpunit/includes/libs/ParamValidator/TypeDef/PasswordDefTest.php
new file mode 100644 (file)
index 0000000..dd97903
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\ParamValidator\ParamValidator;
+
+require_once __DIR__ . '/StringDefTest.php';
+
+/**
+ * @covers Wikimedia\ParamValidator\TypeDef\PasswordDef
+ */
+class PasswordDefTest extends StringDefTest {
+
+       protected static $testClass = PasswordDef::class;
+
+       public function provideNormalizeSettings() {
+               return [
+                       [ [], [ ParamValidator::PARAM_SENSITIVE => true ] ],
+                       [ [ ParamValidator::PARAM_SENSITIVE => false ], [ ParamValidator::PARAM_SENSITIVE => true ] ],
+               ];
+       }
+
+}
diff --git a/tests/phpunit/includes/libs/ParamValidator/TypeDef/PresenceBooleanDefTest.php b/tests/phpunit/includes/libs/ParamValidator/TypeDef/PresenceBooleanDefTest.php
new file mode 100644 (file)
index 0000000..dd690de
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\ParamValidator\ParamValidator;
+
+/**
+ * @covers Wikimedia\ParamValidator\TypeDef\PresenceBooleanDef
+ */
+class PresenceBooleanDefTest extends TypeDefTestCase {
+
+       protected static $testClass = PresenceBooleanDef::class;
+
+       public function provideValidate() {
+               return [
+                       [ null, false ],
+                       [ '', true ],
+                       [ '0', true ],
+                       [ '1', true ],
+                       [ 'anything really', true ],
+               ];
+       }
+
+       public function provideDescribeSettings() {
+               return [
+                       [ [], [], [] ],
+                       [ [ ParamValidator::PARAM_DEFAULT => 'foo' ], [], [] ],
+               ];
+       }
+
+}
diff --git a/tests/phpunit/includes/libs/ParamValidator/TypeDef/StringDefTest.php b/tests/phpunit/includes/libs/ParamValidator/TypeDef/StringDefTest.php
new file mode 100644 (file)
index 0000000..bae2f02
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\ParamValidator\ParamValidator;
+use Wikimedia\ParamValidator\SimpleCallbacks;
+use Wikimedia\ParamValidator\ValidationException;
+
+/**
+ * @covers Wikimedia\ParamValidator\TypeDef\StringDef
+ */
+class StringDefTest extends TypeDefTestCase {
+
+       protected static $testClass = StringDef::class;
+
+       protected function getInstance( SimpleCallbacks $callbacks, array $options ) {
+               if ( static::$testClass === null ) {
+                       throw new \LogicException( 'Either assign static::$testClass or override ' . __METHOD__ );
+               }
+
+               return new static::$testClass( $callbacks, $options );
+       }
+
+       public function provideValidate() {
+               $req = [
+                       ParamValidator::PARAM_REQUIRED => true,
+               ];
+               $maxBytes = [
+                       StringDef::PARAM_MAX_BYTES => 4,
+               ];
+               $maxChars = [
+                       StringDef::PARAM_MAX_CHARS => 2,
+               ];
+
+               return [
+                       'Basic' => [ '123', '123' ],
+                       'Empty' => [ '', '' ],
+                       'Empty, required' => [
+                               '',
+                               new ValidationException( 'test', '', [], 'missingparam', [] ),
+                               $req,
+                       ],
+                       'Empty, required, allowed' => [ '', '', $req, [ 'allowEmptyWhenRequired' => true ] ],
+                       'Max bytes, ok' => [ 'abcd', 'abcd', $maxBytes ],
+                       'Max bytes, exceeded' => [
+                               'abcde',
+                               new ValidationException( 'test', '', [], 'maxbytes', [ 'maxbytes' => 4, 'maxchars' => '' ] ),
+                               $maxBytes,
+                       ],
+                       'Max bytes, ok (2)' => [ '😄', '😄', $maxBytes ],
+                       'Max bytes, exceeded (2)' => [
+                               '😭?',
+                               new ValidationException( 'test', '', [], 'maxbytes', [ 'maxbytes' => 4, 'maxchars' => '' ] ),
+                               $maxBytes,
+                       ],
+                       'Max chars, ok' => [ 'ab', 'ab', $maxChars ],
+                       'Max chars, exceeded' => [
+                               'abc',
+                               new ValidationException( 'test', '', [], 'maxchars', [ 'maxbytes' => '', 'maxchars' => 2 ] ),
+                               $maxChars,
+                       ],
+                       'Max chars, ok (2)' => [ '😄😄', '😄😄', $maxChars ],
+                       'Max chars, exceeded (2)' => [
+                               '😭??',
+                               new ValidationException( 'test', '', [], 'maxchars', [ 'maxbytes' => '', 'maxchars' => 2 ] ),
+                               $maxChars,
+                       ],
+               ];
+       }
+
+}
diff --git a/tests/phpunit/includes/libs/ParamValidator/TypeDef/TimestampDefTest.php b/tests/phpunit/includes/libs/ParamValidator/TypeDef/TimestampDefTest.php
new file mode 100644 (file)
index 0000000..8adf190
--- /dev/null
@@ -0,0 +1,90 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\Timestamp\ConvertibleTimestamp;
+use Wikimedia\ParamValidator\SimpleCallbacks;
+use Wikimedia\ParamValidator\ValidationException;
+
+/**
+ * @covers Wikimedia\ParamValidator\TypeDef\TimestampDef
+ */
+class TimestampDefTest extends TypeDefTestCase {
+
+       protected static $testClass = TimestampDef::class;
+
+       protected function getInstance( SimpleCallbacks $callbacks, array $options ) {
+               if ( static::$testClass === null ) {
+                       throw new \LogicException( 'Either assign static::$testClass or override ' . __METHOD__ );
+               }
+
+               return new static::$testClass( $callbacks, $options );
+       }
+
+       /** @dataProvider provideValidate */
+       public function testValidate(
+               $value, $expect, array $settings = [], array $options = [], array $expectConds = []
+       ) {
+               $reset = ConvertibleTimestamp::setFakeTime( 1559764242 );
+               try {
+                       parent::testValidate( $value, $expect, $settings, $options, $expectConds );
+               } finally {
+                       ConvertibleTimestamp::setFakeTime( $reset );
+               }
+       }
+
+       public function provideValidate() {
+               $specific = new ConvertibleTimestamp( 1517630706 );
+               $specificMs = new ConvertibleTimestamp( 1517630706.999 );
+               $now = new ConvertibleTimestamp( 1559764242 );
+
+               $formatDT = [ TimestampDef::PARAM_TIMESTAMP_FORMAT => 'DateTime' ];
+               $formatMW = [ TimestampDef::PARAM_TIMESTAMP_FORMAT => TS_MW ];
+
+               return [
+                       // We don't try to validate all formats supported by ConvertibleTimestamp, just
+                       // some of the interesting ones.
+                       'ISO format' => [ '2018-02-03T04:05:06Z', $specific ],
+                       'ISO format with TZ' => [ '2018-02-03T00:05:06-04:00', $specific ],
+                       'ISO format without punctuation' => [ '20180203T040506', $specific ],
+                       'ISO format with ms' => [ '2018-02-03T04:05:06.999000Z', $specificMs ],
+                       'ISO format with ms without punctuation' => [ '20180203T040506.999', $specificMs ],
+                       'MW format' => [ '20180203040506', $specific ],
+                       'Generic format' => [ '2018-02-03 04:05:06', $specific ],
+                       'Generic format + GMT' => [ '2018-02-03 04:05:06 GMT', $specific ],
+                       'Generic format + TZ +0100' => [ '2018-02-03 05:05:06+0100', $specific ],
+                       'Generic format + TZ -01' => [ '2018-02-03 03:05:06-01', $specific ],
+                       'Seconds-since-epoch format' => [ '1517630706', $specific ],
+                       'Now' => [ 'now', $now ],
+
+                       // Warnings
+                       'Empty' => [ '', $now, [], [], [ [ 'unclearnowtimestamp' ] ] ],
+                       'Zero' => [ '0', $now, [], [], [ [ 'unclearnowtimestamp' ] ] ],
+
+                       // Error handling
+                       'Bad value' => [
+                               'bogus',
+                               new ValidationException( 'test', 'bogus', [], 'badtimestamp', [] ),
+                       ],
+
+                       // Formatting
+                       '=> DateTime' => [ 'now', $now->timestamp, $formatDT ],
+                       '=> TS_MW' => [ 'now', '20190605195042', $formatMW ],
+                       '=> TS_MW as default' => [ 'now', '20190605195042', [], [ 'defaultFormat' => TS_MW ] ],
+                       '=> TS_MW overriding default'
+                               => [ 'now', '20190605195042', $formatMW, [ 'defaultFormat' => TS_ISO_8601 ] ],
+               ];
+       }
+
+       public function provideStringifyValue() {
+               $specific = new ConvertibleTimestamp( '20180203040506' );
+
+               return [
+                       [ '20180203040506', '2018-02-03T04:05:06Z' ],
+                       [ $specific, '2018-02-03T04:05:06Z' ],
+                       [ $specific->timestamp, '2018-02-03T04:05:06Z' ],
+                       [ $specific, '20180203040506', [], [ 'stringifyFormat' => TS_MW ] ],
+               ];
+       }
+
+}
diff --git a/tests/phpunit/includes/libs/ParamValidator/TypeDef/TypeDefTestCase.php b/tests/phpunit/includes/libs/ParamValidator/TypeDef/TypeDefTestCase.php
new file mode 100644 (file)
index 0000000..fa86c79
--- /dev/null
@@ -0,0 +1,193 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\ParamValidator\ParamValidator;
+use Wikimedia\ParamValidator\SimpleCallbacks;
+use Wikimedia\ParamValidator\TypeDef;
+use Wikimedia\ParamValidator\ValidationException;
+
+/**
+ * Test case infrastructure for TypeDef subclasses
+ *
+ * Generally you'll only need to override static::$testClass and data providers
+ * for methods the TypeDef actually implements.
+ */
+abstract class TypeDefTestCase extends \PHPUnit\Framework\TestCase {
+
+       /** @var string|null TypeDef class name being tested */
+       protected static $testClass = null;
+
+       /**
+        * Create a SimpleCallbacks for testing
+        *
+        * The object created here should result in a call to the TypeDef's
+        * `getValue( 'test' )` returning an appropriate result for testing.
+        *
+        * @param mixed $value Value to return for 'test'
+        * @param array $options Options array.
+        * @return SimpleCallbacks
+        */
+       protected function getCallbacks( $value, array $options ) {
+               return new SimpleCallbacks( [ 'test' => $value ] );
+       }
+
+       /**
+        * Create an instance of the TypeDef subclass being tested
+        *
+        * @param SimpleCallbacks $callbacks From $this->getCallbacks()
+        * @param array $options Options array.
+        * @return TypeDef
+        */
+       protected function getInstance( SimpleCallbacks $callbacks, array $options ) {
+               if ( static::$testClass === null ) {
+                       throw new \LogicException( 'Either assign static::$testClass or override ' . __METHOD__ );
+               }
+
+               return new static::$testClass( $callbacks );
+       }
+
+       /**
+        * @dataProvider provideValidate
+        * @param mixed $value Value for getCallbacks()
+        * @param mixed|ValidationException $expect Expected result from TypeDef::validate().
+        *  If a ValidationException, it is expected that a ValidationException
+        *  with matching failure code and data will be thrown. Otherwise, the return value must be equal.
+        * @param array $settings Settings array.
+        * @param array $options Options array
+        * @param array[] $expectConds Expected conditions reported. Each array is
+        *  `[ $ex->getFailureCode() ] + $ex->getFailureData()`.
+        */
+       public function testValidate(
+               $value, $expect, array $settings = [], array $options = [], array $expectConds = []
+       ) {
+               $callbacks = $this->getCallbacks( $value, $options );
+               $typeDef = $this->getInstance( $callbacks, $options );
+
+               if ( $expect instanceof ValidationException ) {
+                       try {
+                               $v = $typeDef->getValue( 'test', $settings, $options );
+                               $typeDef->validate( 'test', $v, $settings, $options );
+                               $this->fail( 'Expected exception not thrown' );
+                       } catch ( ValidationException $ex ) {
+                               $this->assertEquals( $expect->getFailureCode(), $ex->getFailureCode() );
+                               $this->assertEquals( $expect->getFailureData(), $ex->getFailureData() );
+                       }
+               } else {
+                       $v = $typeDef->getValue( 'test', $settings, $options );
+                       $this->assertEquals( $expect, $typeDef->validate( 'test', $v, $settings, $options ) );
+               }
+
+               $conditions = [];
+               foreach ( $callbacks->getRecordedConditions() as $ex ) {
+                       $conditions[] = array_merge( [ $ex->getFailureCode() ], $ex->getFailureData() );
+               }
+               $this->assertSame( $expectConds, $conditions );
+       }
+
+       /**
+        * @return array|Iterable
+        */
+       abstract public function provideValidate();
+
+       /**
+        * @dataProvider provideNormalizeSettings
+        * @param array $settings
+        * @param array $expect
+        * @param array $options Options array
+        */
+       public function testNormalizeSettings( array $settings, array $expect, array $options = [] ) {
+               $typeDef = $this->getInstance( new SimpleCallbacks( [] ), $options );
+               $this->assertSame( $expect, $typeDef->normalizeSettings( $settings ) );
+       }
+
+       /**
+        * @return array|Iterable
+        */
+       public function provideNormalizeSettings() {
+               return [
+                       'Basic test' => [ [ 'param-foo' => 'bar' ], [ 'param-foo' => 'bar' ] ],
+               ];
+       }
+
+       /**
+        * @dataProvider provideGetEnumValues
+        * @param array $settings
+        * @param array|null $expect
+        * @param array $options Options array
+        */
+       public function testGetEnumValues( array $settings, $expect, array $options = [] ) {
+               $typeDef = $this->getInstance( new SimpleCallbacks( [] ), $options );
+               $this->assertSame( $expect, $typeDef->getEnumValues( 'test', $settings, $options ) );
+       }
+
+       /**
+        * @return array|Iterable
+        */
+       public function provideGetEnumValues() {
+               return [
+                       'Basic test' => [ [], null ],
+               ];
+       }
+
+       /**
+        * @dataProvider provideStringifyValue
+        * @param mixed $value
+        * @param string|null $expect
+        * @param array $settings
+        * @param array $options Options array
+        */
+       public function testStringifyValue( $value, $expect, array $settings = [], array $options = [] ) {
+               $typeDef = $this->getInstance( new SimpleCallbacks( [] ), $options );
+               $this->assertSame( $expect, $typeDef->stringifyValue( 'test', $value, $settings, $options ) );
+       }
+
+       /**
+        * @return array|Iterable
+        */
+       public function provideStringifyValue() {
+               return [
+                       'Basic test' => [ 123, '123' ],
+               ];
+       }
+
+       /**
+        * @dataProvider provideDescribeSettings
+        * @param array $settings
+        * @param array $expectNormal
+        * @param array $expectCompact
+        * @param array $options Options array
+        */
+       public function testDescribeSettings(
+               array $settings, array $expectNormal, array $expectCompact, array $options = []
+       ) {
+               $typeDef = $this->getInstance( new SimpleCallbacks( [] ), $options );
+               $this->assertSame(
+                       $expectNormal,
+                       $typeDef->describeSettings( 'test', $settings, $options ),
+                       'Normal mode'
+               );
+               $this->assertSame(
+                       $expectCompact,
+                       $typeDef->describeSettings( 'test', $settings, [ 'compact' => true ] + $options ),
+                       'Compact mode'
+               );
+       }
+
+       /**
+        * @return array|Iterable
+        */
+       public function provideDescribeSettings() {
+               yield 'Basic test' => [ [], [], [] ];
+
+               foreach ( $this->provideStringifyValue() as $i => $v ) {
+                       yield "Default value (from provideStringifyValue data set \"$i\")" => [
+                               [ ParamValidator::PARAM_DEFAULT => $v[0] ] + ( $v[2] ?? [] ),
+                               [ 'default' => $v[1] ],
+                               [ 'default' => [ 'value' => $v[1] ] ],
+                               $v[3] ?? [],
+                       ];
+               }
+       }
+
+}
diff --git a/tests/phpunit/includes/libs/ParamValidator/TypeDef/UploadDefTest.php b/tests/phpunit/includes/libs/ParamValidator/TypeDef/UploadDefTest.php
new file mode 100644 (file)
index 0000000..c81647c
--- /dev/null
@@ -0,0 +1,113 @@
+<?php
+
+namespace Wikimedia\ParamValidator\TypeDef;
+
+use Wikimedia\ParamValidator\SimpleCallbacks;
+use Wikimedia\ParamValidator\Util\UploadedFile;
+use Wikimedia\ParamValidator\ValidationException;
+
+/**
+ * @covers Wikimedia\ParamValidator\TypeDef\UploadDef
+ */
+class UploadDefTest extends TypeDefTestCase {
+
+       protected static $testClass = UploadDef::class;
+
+       protected function getCallbacks( $value, array $options ) {
+               if ( $value instanceof UploadedFile ) {
+                       return new SimpleCallbacks( [], [ 'test' => $value ] );
+               } else {
+                       return new SimpleCallbacks( [ 'test' => $value ] );
+               }
+       }
+
+       protected function getInstance( SimpleCallbacks $callbacks, array $options ) {
+               $ret = $this->getMockBuilder( UploadDef::class )
+                       ->setConstructorArgs( [ $callbacks ] )
+                       ->setMethods( [ 'getIniSize' ] )
+                       ->getMock();
+               $ret->method( 'getIniSize' )->willReturn( $options['inisize'] ?? 2 * 1024 * 1024 );
+               return $ret;
+       }
+
+       private function makeUpload( $err = UPLOAD_ERR_OK ) {
+               return new UploadedFile( [
+                       'name' => 'example.txt',
+                       'type' => 'text/plain',
+                       'size' => 0,
+                       'tmp_name' => '...',
+                       'error' => $err,
+               ] );
+       }
+
+       public function testGetNoFile() {
+               $typeDef = $this->getInstance(
+                       $this->getCallbacks( $this->makeUpload( UPLOAD_ERR_NO_FILE ), [] ),
+                       []
+               );
+
+               $this->assertNull( $typeDef->getValue( 'test', [], [] ) );
+               $this->assertNull( $typeDef->getValue( 'nothing', [], [] ) );
+       }
+
+       public function provideValidate() {
+               $okFile = $this->makeUpload();
+               $iniFile = $this->makeUpload( UPLOAD_ERR_INI_SIZE );
+               $exIni = new ValidationException(
+                       'test', '', [], 'badupload-inisize', [ 'size' => 2 * 1024 * 1024 * 1024 ]
+               );
+
+               return [
+                       'Valid upload' => [ $okFile, $okFile ],
+                       'Not an upload' => [
+                               'bar',
+                               new ValidationException( 'test', 'bar', [], 'badupload-notupload', [] ),
+                       ],
+
+                       'Too big (bytes)' => [ $iniFile, $exIni, [], [ 'inisize' => 2 * 1024 * 1024 * 1024 ] ],
+                       'Too big (k)' => [ $iniFile, $exIni, [], [ 'inisize' => ( 2 * 1024 * 1024 ) . 'k' ] ],
+                       'Too big (K)' => [ $iniFile, $exIni, [], [ 'inisize' => ( 2 * 1024 * 1024 ) . 'K' ] ],
+                       'Too big (m)' => [ $iniFile, $exIni, [], [ 'inisize' => ( 2 * 1024 ) . 'm' ] ],
+                       'Too big (M)' => [ $iniFile, $exIni, [], [ 'inisize' => ( 2 * 1024 ) . 'M' ] ],
+                       'Too big (g)' => [ $iniFile, $exIni, [], [ 'inisize' => '2g' ] ],
+                       'Too big (G)' => [ $iniFile, $exIni, [], [ 'inisize' => '2G' ] ],
+
+                       'Form size' => [
+                               $this->makeUpload( UPLOAD_ERR_FORM_SIZE ),
+                               new ValidationException( 'test', '', [], 'badupload-formsize', [] ),
+                       ],
+                       'Partial' => [
+                               $this->makeUpload( UPLOAD_ERR_PARTIAL ),
+                               new ValidationException( 'test', '', [], 'badupload-partial', [] ),
+                       ],
+                       'No tmp' => [
+                               $this->makeUpload( UPLOAD_ERR_NO_TMP_DIR ),
+                               new ValidationException( 'test', '', [], 'badupload-notmpdir', [] ),
+                       ],
+                       'Can\'t write' => [
+                               $this->makeUpload( UPLOAD_ERR_CANT_WRITE ),
+                               new ValidationException( 'test', '', [], 'badupload-cantwrite', [] ),
+                       ],
+                       'Ext abort' => [
+                               $this->makeUpload( UPLOAD_ERR_EXTENSION ),
+                               new ValidationException( 'test', '', [], 'badupload-phpext', [] ),
+                       ],
+                       'Unknown' => [
+                               $this->makeUpload( -43 ), // Should be safe from ever being an UPLOAD_ERR_* constant
+                               new ValidationException( 'test', '', [], 'badupload-unknown', [ 'code' => -43 ] ),
+                       ],
+
+                       'Validating null' => [
+                               null,
+                               new ValidationException( 'test', '', [], 'badupload', [] ),
+                       ],
+               ];
+       }
+
+       public function provideStringifyValue() {
+               return [
+                       'Yeah, right' => [ $this->makeUpload(), null ],
+               ];
+       }
+
+}
diff --git a/tests/phpunit/includes/libs/ParamValidator/TypeDefTest.php b/tests/phpunit/includes/libs/ParamValidator/TypeDefTest.php
new file mode 100644 (file)
index 0000000..7675a8c
--- /dev/null
@@ -0,0 +1,79 @@
+<?php
+
+namespace Wikimedia\ParamValidator;
+
+/**
+ * @covers Wikimedia\ParamValidator\TypeDef
+ */
+class TypeDefTest extends \PHPUnit\Framework\TestCase {
+
+       public function testMisc() {
+               $typeDef = $this->getMockBuilder( TypeDef::class )
+                       ->setConstructorArgs( [ new SimpleCallbacks( [] ) ] )
+                       ->getMockForAbstractClass();
+
+               $this->assertSame( [ 'foobar' ], $typeDef->normalizeSettings( [ 'foobar' ] ) );
+               $this->assertNull( $typeDef->getEnumValues( 'foobar', [], [] ) );
+               $this->assertSame( '123', $typeDef->stringifyValue( 'foobar', 123, [], [] ) );
+       }
+
+       public function testGetValue() {
+               $options = [ (object)[] ];
+
+               $callbacks = $this->getMockBuilder( Callbacks::class )->getMockForAbstractClass();
+               $callbacks->expects( $this->once() )->method( 'getValue' )
+                       ->with(
+                               $this->identicalTo( 'foobar' ),
+                               $this->identicalTo( null ),
+                               $this->identicalTo( $options )
+                       )
+                       ->willReturn( 'zyx' );
+
+               $typeDef = $this->getMockBuilder( TypeDef::class )
+                       ->setConstructorArgs( [ $callbacks ] )
+                       ->getMockForAbstractClass();
+
+               $this->assertSame(
+                       'zyx',
+                       $typeDef->getValue( 'foobar', [ ParamValidator::PARAM_DEFAULT => 'foo' ], $options )
+               );
+       }
+
+       public function testDescribeSettings() {
+               $typeDef = $this->getMockBuilder( TypeDef::class )
+                       ->setConstructorArgs( [ new SimpleCallbacks( [] ) ] )
+                       ->getMockForAbstractClass();
+
+               $this->assertSame(
+                       [],
+                       $typeDef->describeSettings(
+                               'foobar',
+                               [ ParamValidator::PARAM_TYPE => 'xxx' ],
+                               []
+                       )
+               );
+
+               $this->assertSame(
+                       [
+                               'default' => '123',
+                       ],
+                       $typeDef->describeSettings(
+                               'foobar',
+                               [ ParamValidator::PARAM_DEFAULT => 123 ],
+                               []
+                       )
+               );
+
+               $this->assertSame(
+                       [
+                               'default' => [ 'value' => '123' ],
+                       ],
+                       $typeDef->describeSettings(
+                               'foobar',
+                               [ ParamValidator::PARAM_DEFAULT => 123 ],
+                               [ 'compact' => true ]
+                       )
+               );
+       }
+
+}
diff --git a/tests/phpunit/includes/libs/ParamValidator/Util/UploadedFileStreamTest.php b/tests/phpunit/includes/libs/ParamValidator/Util/UploadedFileStreamTest.php
new file mode 100644 (file)
index 0000000..9eaddf6
--- /dev/null
@@ -0,0 +1,294 @@
+<?php
+
+namespace Wikimedia\ParamValidator\Util;
+
+require_once __DIR__ . '/UploadedFileTestBase.php';
+
+use RuntimeException;
+use Wikimedia\AtEase\AtEase;
+use Wikimedia\TestingAccessWrapper;
+
+/**
+ * @covers Wikimedia\ParamValidator\Util\UploadedFileStream
+ */
+class UploadedFileStreamTest extends UploadedFileTestBase {
+
+       /**
+        * @expectedException RuntimeException
+        * @expectedExceptionMessage Failed to open file:
+        */
+       public function testConstruct_doesNotExist() {
+               $filename = $this->makeTemp( __FUNCTION__ );
+               unlink( $filename );
+
+               $this->assertFileNotExists( $filename, 'sanity check' );
+               $stream = new UploadedFileStream( $filename );
+       }
+
+       /**
+        * @expectedException RuntimeException
+        * @expectedExceptionMessage Failed to open file:
+        */
+       public function testConstruct_notReadable() {
+               $filename = $this->makeTemp( __FUNCTION__ );
+
+               chmod( $filename, 0000 );
+               $stream = new UploadedFileStream( $filename );
+       }
+
+       public function testCloseOnDestruct() {
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $stream = new UploadedFileStream( $filename );
+               $fp = TestingAccessWrapper::newFromObject( $stream )->fp;
+               $this->assertSame( 'f', fread( $fp, 1 ), 'sanity check' );
+               unset( $stream );
+               $this->assertFalse( AtEase::quietCall( 'fread', $fp, 1 ) );
+       }
+
+       public function testToString() {
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $stream = new UploadedFileStream( $filename );
+
+               // Always starts at the start of the stream
+               $stream->seek( 3 );
+               $this->assertSame( 'foobar', (string)$stream );
+
+               // No exception when closed
+               $stream->close();
+               $this->assertSame( '', (string)$stream );
+       }
+
+       public function testToString_Error() {
+               if ( !class_exists( \Error::class ) ) {
+                       $this->markTestSkipped( 'No PHP Error class' );
+               }
+
+               // ... Yeah
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $stream = $this->getMockBuilder( UploadedFileStream::class )
+                       ->setConstructorArgs( [ $filename ] )
+                       ->setMethods( [ 'getContents' ] )
+                       ->getMock();
+               $stream->method( 'getContents' )->willReturnCallback( function () {
+                       throw new \Error( 'Bogus' );
+               } );
+               $this->assertSame( '', (string)$stream );
+       }
+
+       public function testClose() {
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $stream = new UploadedFileStream( $filename );
+
+               $stream->close();
+
+               // Second call doesn't error
+               $stream->close();
+       }
+
+       public function testDetach() {
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $stream = new UploadedFileStream( $filename );
+
+               // We got the file descriptor
+               $fp = $stream->detach();
+               $this->assertNotNull( $fp );
+               $this->assertSame( 'f', fread( $fp, 1 ) );
+
+               // Stream operations now fail.
+               try {
+                       $stream->seek( 0 );
+               } catch ( \PHPUnit\Framework\AssertionFailedError $ex ) {
+                       throw $ex;
+               } catch ( RuntimeException $ex ) {
+               }
+
+               // Stream close doesn't affect the file descriptor
+               $stream->close();
+               $this->assertSame( 'o', fread( $fp, 1 ) );
+
+               // Stream destruction doesn't affect the file descriptor
+               unset( $stream );
+               $this->assertSame( 'o', fread( $fp, 1 ) );
+
+               // On a closed stream, we don't get a file descriptor
+               $stream = new UploadedFileStream( $filename );
+               $stream->close();
+               $this->assertNull( $stream->detach() );
+       }
+
+       public function testGetSize() {
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $stream = new UploadedFileStream( $filename );
+               file_put_contents( $filename, 'foobarbaz' );
+               $this->assertSame( 9, $stream->getSize() );
+
+               // Cached
+               file_put_contents( $filename, 'baz' );
+               clearstatcache();
+               $this->assertSame( 3, stat( $filename )['size'], 'sanity check' );
+               $this->assertSame( 9, $stream->getSize() );
+
+               // No error if closed
+               $stream = new UploadedFileStream( $filename );
+               $stream->close();
+               $this->assertSame( null, $stream->getSize() );
+
+               // No error even if the fd goes bad
+               $stream = new UploadedFileStream( $filename );
+               fclose( TestingAccessWrapper::newFromObject( $stream )->fp );
+               $this->assertSame( null, $stream->getSize() );
+       }
+
+       public function testSeekTell() {
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $stream = new UploadedFileStream( $filename );
+
+               $stream->seek( 2 );
+               $this->assertSame( 2, $stream->tell() );
+               $stream->seek( 2, SEEK_CUR );
+               $this->assertSame( 4, $stream->tell() );
+               $stream->seek( -5, SEEK_END );
+               $this->assertSame( 1, $stream->tell() );
+               $stream->read( 2 );
+               $this->assertSame( 3, $stream->tell() );
+
+               $stream->close();
+               try {
+                       $stream->seek( 0 );
+               } catch ( \PHPUnit\Framework\AssertionFailedError $ex ) {
+                       throw $ex;
+               } catch ( RuntimeException $ex ) {
+               }
+               try {
+                       $stream->tell();
+               } catch ( \PHPUnit\Framework\AssertionFailedError $ex ) {
+                       throw $ex;
+               } catch ( RuntimeException $ex ) {
+               }
+       }
+
+       public function testEof() {
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $stream = new UploadedFileStream( $filename );
+
+               $this->assertFalse( $stream->eof() );
+               $stream->getContents();
+               $this->assertTrue( $stream->eof() );
+               $stream->seek( -1, SEEK_END );
+               $this->assertFalse( $stream->eof() );
+
+               // No error if closed
+               $stream = new UploadedFileStream( $filename );
+               $stream->close();
+               $this->assertTrue( $stream->eof() );
+
+               // No error even if the fd goes bad
+               $stream = new UploadedFileStream( $filename );
+               fclose( TestingAccessWrapper::newFromObject( $stream )->fp );
+               $this->assertInternalType( 'boolean', $stream->eof() );
+       }
+
+       public function testIsFuncs() {
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $stream = new UploadedFileStream( $filename );
+               $this->assertTrue( $stream->isSeekable() );
+               $this->assertTrue( $stream->isReadable() );
+               $this->assertFalse( $stream->isWritable() );
+
+               $stream->close();
+               $this->assertFalse( $stream->isSeekable() );
+               $this->assertFalse( $stream->isReadable() );
+               $this->assertFalse( $stream->isWritable() );
+       }
+
+       public function testRewind() {
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $stream = new UploadedFileStream( $filename );
+
+               $stream->seek( 2 );
+               $this->assertSame( 2, $stream->tell() );
+               $stream->rewind();
+               $this->assertSame( 0, $stream->tell() );
+
+               $stream->close();
+               try {
+                       $stream->rewind();
+               } catch ( \PHPUnit\Framework\AssertionFailedError $ex ) {
+                       throw $ex;
+               } catch ( RuntimeException $ex ) {
+               }
+       }
+
+       public function testWrite() {
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $stream = new UploadedFileStream( $filename );
+
+               try {
+                       $stream->write( 'foo' );
+               } catch ( \PHPUnit\Framework\AssertionFailedError $ex ) {
+                       throw $ex;
+               } catch ( RuntimeException $ex ) {
+               }
+       }
+
+       public function testRead() {
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $stream = new UploadedFileStream( $filename );
+
+               $this->assertSame( 'foo', $stream->read( 3 ) );
+               $this->assertSame( 'bar', $stream->read( 10 ) );
+               $this->assertSame( '', $stream->read( 10 ) );
+               $stream->rewind();
+               $this->assertSame( 'foobar', $stream->read( 10 ) );
+
+               $stream->close();
+               try {
+                       $stream->read( 1 );
+               } catch ( \PHPUnit\Framework\AssertionFailedError $ex ) {
+                       throw $ex;
+               } catch ( RuntimeException $ex ) {
+               }
+       }
+
+       public function testGetContents() {
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $stream = new UploadedFileStream( $filename );
+
+               $this->assertSame( 'foobar', $stream->getContents() );
+               $this->assertSame( '', $stream->getContents() );
+               $stream->seek( 3 );
+               $this->assertSame( 'bar', $stream->getContents() );
+
+               $stream->close();
+               try {
+                       $stream->getContents();
+               } catch ( \PHPUnit\Framework\AssertionFailedError $ex ) {
+                       throw $ex;
+               } catch ( RuntimeException $ex ) {
+               }
+       }
+
+       public function testGetMetadata() {
+               // Whatever
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $fp = fopen( $filename, 'r' );
+               $expect = stream_get_meta_data( $fp );
+               fclose( $fp );
+
+               $stream = new UploadedFileStream( $filename );
+               $this->assertSame( $expect, $stream->getMetadata() );
+               foreach ( $expect as $k => $v ) {
+                       $this->assertSame( $v, $stream->getMetadata( $k ) );
+               }
+               $this->assertNull( $stream->getMetadata( 'bogus' ) );
+
+               $stream->close();
+               try {
+                       $stream->getMetadata();
+               } catch ( \PHPUnit\Framework\AssertionFailedError $ex ) {
+                       throw $ex;
+               } catch ( RuntimeException $ex ) {
+               }
+       }
+
+}
diff --git a/tests/phpunit/includes/libs/ParamValidator/Util/UploadedFileTest.php b/tests/phpunit/includes/libs/ParamValidator/Util/UploadedFileTest.php
new file mode 100644 (file)
index 0000000..80a74e7
--- /dev/null
@@ -0,0 +1,215 @@
+<?php
+
+namespace Wikimedia\ParamValidator\Util;
+
+require_once __DIR__ . '/UploadedFileTestBase.php';
+
+use Psr\Http\Message\StreamInterface;
+use RuntimeException;
+
+/**
+ * @covers Wikimedia\ParamValidator\Util\UploadedFile
+ */
+class UploadedFileTest extends UploadedFileTestBase {
+
+       public function testGetStream() {
+               $filename = $this->makeTemp( __FUNCTION__ );
+
+               $file = new UploadedFile( [ 'error' => UPLOAD_ERR_OK, 'tmp_name' => $filename ], false );
+
+               // getStream() fails for non-OK uploads
+               foreach ( [
+                       UPLOAD_ERR_INI_SIZE,
+                       UPLOAD_ERR_FORM_SIZE,
+                       UPLOAD_ERR_PARTIAL,
+                       UPLOAD_ERR_NO_FILE,
+                       UPLOAD_ERR_NO_TMP_DIR,
+                       UPLOAD_ERR_CANT_WRITE,
+                       UPLOAD_ERR_EXTENSION,
+                       -42
+               ] as $code ) {
+                       $file2 = new UploadedFile( [ 'error' => $code, 'tmp_name' => $filename ], false );
+                       try {
+                               $file2->getStream();
+                               $this->fail( 'Expected exception not thrown' );
+                       } catch ( \PHPUnit\Framework\AssertionFailedError $ex ) {
+                               throw $ex;
+                       } catch ( RuntimeException $ex ) {
+                       }
+               }
+
+               // getStream() works
+               $stream = $file->getStream();
+               $this->assertInstanceOf( StreamInterface::class, $stream );
+               $stream->seek( 0 );
+               $this->assertSame( 'foobar', $stream->getContents() );
+
+               // Second call also works
+               $this->assertInstanceOf( StreamInterface::class, $file->getStream() );
+
+               // getStream() throws after move, and the stream is invalidated too
+               $file->moveTo( $filename . '.xxx' );
+               try {
+                       try {
+                               $file->getStream();
+                               $this->fail( 'Expected exception not thrown' );
+                       } catch ( \PHPUnit\Framework\AssertionFailedError $ex ) {
+                               throw $ex;
+                       } catch ( RuntimeException $ex ) {
+                               $this->assertSame( 'File has already been moved', $ex->getMessage() );
+                       }
+                       try {
+                               $stream->seek( 0 );
+                               $stream->getContents();
+                               $this->fail( 'Expected exception not thrown' );
+                       } catch ( \PHPUnit\Framework\AssertionFailedError $ex ) {
+                               throw $ex;
+                       } catch ( RuntimeException $ex ) {
+                       }
+               } finally {
+                       unlink( $filename . '.xxx' ); // Clean up
+               }
+
+               // getStream() fails if the file is missing
+               $file = new UploadedFile( [ 'error' => UPLOAD_ERR_OK, 'tmp_name' => $filename ], true );
+               try {
+                       $file->getStream();
+                       $this->fail( 'Expected exception not thrown' );
+               } catch ( \PHPUnit\Framework\AssertionFailedError $ex ) {
+                       throw $ex;
+               } catch ( RuntimeException $ex ) {
+                       $this->assertSame( 'Uploaded file is missing', $ex->getMessage() );
+               }
+       }
+
+       public function testMoveTo() {
+               // Successful move
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $this->assertFileExists( $filename, 'sanity check' );
+               $this->assertFileNotExists( "$filename.xxx", 'sanity check' );
+               $file = new UploadedFile( [ 'error' => UPLOAD_ERR_OK, 'tmp_name' => $filename ], false );
+               $file->moveTo( $filename . '.xxx' );
+               $this->assertFileNotExists( $filename );
+               $this->assertFileExists( "$filename.xxx" );
+
+               // Fails on a second move attempt
+               $this->assertFileNotExists( "$filename.yyy", 'sanity check' );
+               try {
+                       $file->moveTo( $filename . '.yyy' );
+                       $this->fail( 'Expected exception not thrown' );
+               } catch ( \PHPUnit\Framework\AssertionFailedError $ex ) {
+                       throw $ex;
+               } catch ( RuntimeException $ex ) {
+                       $this->assertSame( 'File has already been moved', $ex->getMessage() );
+               }
+               $this->assertFileNotExists( $filename );
+               $this->assertFileExists( "$filename.xxx" );
+               $this->assertFileNotExists( "$filename.yyy" );
+
+               // Fails if the file is missing
+               $file = new UploadedFile( [ 'error' => UPLOAD_ERR_OK, 'tmp_name' => "$filename.aaa" ], false );
+               $this->assertFileNotExists( "$filename.aaa", 'sanity check' );
+               $this->assertFileNotExists( "$filename.bbb", 'sanity check' );
+               try {
+                       $file->moveTo( $filename . '.bbb' );
+                       $this->fail( 'Expected exception not thrown' );
+               } catch ( \PHPUnit\Framework\AssertionFailedError $ex ) {
+                       throw $ex;
+               } catch ( RuntimeException $ex ) {
+                       $this->assertSame( 'Uploaded file is missing', $ex->getMessage() );
+               }
+               $this->assertFileNotExists( "$filename.aaa" );
+               $this->assertFileNotExists( "$filename.bbb" );
+
+               // Fails for non-upload file (when not flagged to ignore that)
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $this->assertFileExists( $filename, 'sanity check' );
+               $this->assertFileNotExists( "$filename.xxx", 'sanity check' );
+               $file = new UploadedFile( [ 'error' => UPLOAD_ERR_OK, 'tmp_name' => $filename ] );
+               try {
+                       $file->moveTo( $filename . '.xxx' );
+                       $this->fail( 'Expected exception not thrown' );
+               } catch ( \PHPUnit\Framework\AssertionFailedError $ex ) {
+                       throw $ex;
+               } catch ( RuntimeException $ex ) {
+                       $this->assertSame( 'Specified file is not an uploaded file', $ex->getMessage() );
+               }
+               $this->assertFileExists( $filename );
+               $this->assertFileNotExists( "$filename.xxx" );
+
+               // Fails for error uploads
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $this->assertFileExists( $filename, 'sanity check' );
+               $this->assertFileNotExists( "$filename.xxx", 'sanity check' );
+               foreach ( [
+                       UPLOAD_ERR_INI_SIZE,
+                       UPLOAD_ERR_FORM_SIZE,
+                       UPLOAD_ERR_PARTIAL,
+                       UPLOAD_ERR_NO_FILE,
+                       UPLOAD_ERR_NO_TMP_DIR,
+                       UPLOAD_ERR_CANT_WRITE,
+                       UPLOAD_ERR_EXTENSION,
+                       -42
+               ] as $code ) {
+                       $file = new UploadedFile( [ 'error' => $code, 'tmp_name' => $filename ], false );
+                       try {
+                               $file->moveTo( $filename . '.xxx' );
+                               $this->fail( 'Expected exception not thrown' );
+                       } catch ( \PHPUnit\Framework\AssertionFailedError $ex ) {
+                               throw $ex;
+                       } catch ( RuntimeException $ex ) {
+                       }
+                       $this->assertFileExists( $filename );
+                       $this->assertFileNotExists( "$filename.xxx" );
+               }
+
+               // Move failure triggers exception
+               $filename = $this->makeTemp( __FUNCTION__, 'file1' );
+               $filename2 = $this->makeTemp( __FUNCTION__, 'file2' );
+               $this->assertFileExists( $filename, 'sanity check' );
+               $file = new UploadedFile( [ 'error' => UPLOAD_ERR_OK, 'tmp_name' => $filename ], false );
+               try {
+                       $file->moveTo( $filename2 . DIRECTORY_SEPARATOR . 'foobar' );
+                       $this->fail( 'Expected exception not thrown' );
+               } catch ( \PHPUnit\Framework\AssertionFailedError $ex ) {
+                       throw $ex;
+               } catch ( RuntimeException $ex ) {
+               }
+               $this->assertFileExists( $filename );
+       }
+
+       public function testInfoMethods() {
+               $filename = $this->makeTemp( __FUNCTION__ );
+               $file = new UploadedFile( [
+                       'name' => 'C:\\example.txt',
+                       'type' => 'text/plain',
+                       'size' => 1025,
+                       'error' => UPLOAD_ERR_OK,
+                       'tmp_name' => $filename,
+               ], false );
+               $this->assertSame( 1025, $file->getSize() );
+               $this->assertSame( UPLOAD_ERR_OK, $file->getError() );
+               $this->assertSame( 'C:\\example.txt', $file->getClientFilename() );
+               $this->assertSame( 'text/plain', $file->getClientMediaType() );
+
+               // None of these are allowed to error
+               $file = new UploadedFile( [], false );
+               $this->assertSame( null, $file->getSize() );
+               $this->assertSame( UPLOAD_ERR_NO_FILE, $file->getError() );
+               $this->assertSame( null, $file->getClientFilename() );
+               $this->assertSame( null, $file->getClientMediaType() );
+
+               // "if none was provided" behavior, given that $_FILES often contains
+               // the empty string.
+               $file = new UploadedFile( [
+                       'name' => '',
+                       'type' => '',
+                       'size' => 100,
+                       'error' => UPLOAD_ERR_NO_FILE,
+                       'tmp_name' => $filename,
+               ], false );
+               $this->assertSame( null, $file->getClientFilename() );
+               $this->assertSame( null, $file->getClientMediaType() );
+       }
+
+}
diff --git a/tests/phpunit/includes/libs/ParamValidator/Util/UploadedFileTestBase.php b/tests/phpunit/includes/libs/ParamValidator/Util/UploadedFileTestBase.php
new file mode 100644 (file)
index 0000000..6e1bd6a
--- /dev/null
@@ -0,0 +1,82 @@
+<?php
+
+namespace Wikimedia\ParamValidator\Util;
+
+use RecursiveDirectoryIterator;
+use RecursiveIteratorIterator;
+use Wikimedia\AtEase\AtEase;
+
+class UploadedFileTestBase extends \PHPUnit\Framework\TestCase {
+
+       /** @var string|null */
+       protected static $tmpdir;
+
+       public static function setUpBeforeClass() {
+               parent::setUpBeforeClass();
+
+               // Create a temporary directory for this test's files.
+               self::$tmpdir = null;
+               $base = sys_get_temp_dir() . DIRECTORY_SEPARATOR .
+                       'phpunit-ParamValidator-UploadedFileTest-' . time() . '-' . getmypid() . '-';
+               for ( $i = 0; $i < 10000; $i++ ) {
+                       $dir = $base . sprintf( '%04d', $i );
+                       if ( AtEase::quietCall( 'mkdir', $dir, 0700, false ) === true ) {
+                               self::$tmpdir = $dir;
+                               break;
+                       }
+               }
+               if ( self::$tmpdir === null ) {
+                       self::fail( "Could not create temporary directory '{$base}XXXX'" );
+               }
+       }
+
+       public static function tearDownAfterClass() {
+               parent::tearDownAfterClass();
+
+               // Clean up temporary directory.
+               if ( self::$tmpdir !== null ) {
+                       $iter = new RecursiveIteratorIterator(
+                               new RecursiveDirectoryIterator( self::$tmpdir, RecursiveDirectoryIterator::SKIP_DOTS ),
+                               RecursiveIteratorIterator::CHILD_FIRST
+                       );
+                       foreach ( $iter as $file ) {
+                               if ( $file->isDir() ) {
+                                       rmdir( $file->getRealPath() );
+                               } else {
+                                       unlink( $file->getRealPath() );
+                               }
+                       }
+                       rmdir( self::$tmpdir );
+                       self::$tmpdir = null;
+               }
+       }
+
+       protected static function assertTmpdir() {
+               if ( self::$tmpdir === null || !is_dir( self::$tmpdir ) ) {
+                       self::fail( 'No temporary directory for ' . static::class );
+               }
+       }
+
+       /**
+        * @param string $prefix For tempnam()
+        * @param string $content Contents of the file
+        * @return string Filename
+        */
+       protected function makeTemp( $prefix, $content = 'foobar' ) {
+               self::assertTmpdir();
+
+               $filename = tempnam( self::$tmpdir, $prefix );
+               if ( $filename === false ) {
+                       self::fail( 'Failed to create temporary file' );
+               }
+
+               self::assertSame(
+                       strlen( $content ),
+                       file_put_contents( $filename, $content ),
+                       'Writing test temporary file'
+               );
+
+               return $filename;
+       }
+
+}
index 2e03163..c5e8e89 100644 (file)
@@ -119,15 +119,18 @@ class CommandTest extends PHPUnit\Framework\TestCase {
        }
 
        public function testT69870() {
-               $commandLine = wfIsWindows()
-                       // 333 = 331 + CRLF
-                       ? ( 'for /l %i in (1, 1, 1001) do @echo ' . str_repeat( '*', 331 ) )
-                       : 'printf "%-333333s" "*"';
+               if ( wfIsWindows() ) {
+                       // T209159: Anonymous pipe under Windows does not support asynchronous read and write,
+                       // and the default buffer is too small (~4K), it is easy to be blocked.
+                       $this->markTestSkipped(
+                               'T209159: Anonymous pipe under Windows cannot withstand such a large amount of data'
+                       );
+               }
 
                // Test several times because it involves a race condition that may randomly succeed or fail
                for ( $i = 0; $i < 10; $i++ ) {
                        $command = new Command();
-                       $output = $command->unsafeParams( $commandLine )
+                       $output = $command->unsafeParams( 'printf "%-333333s" "*"' )
                                ->execute()
                                ->getStdout();
                        $this->assertEquals( 333333, strlen( $output ) );