Merge "Only put returnto parameter if needed on the from-http redirect in Special...
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 18 Mar 2014 11:25:50 +0000 (11:25 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 18 Mar 2014 11:25:50 +0000 (11:25 +0000)
111 files changed:
includes/AutoLoader.php
includes/User.php
includes/cache/LocalisationCache.php
includes/db/LoadBalancer.php
includes/job/Job.php [deleted file]
includes/job/JobQueue.php [deleted file]
includes/job/JobQueueDB.php [deleted file]
includes/job/JobQueueFederated.php [deleted file]
includes/job/JobQueueGroup.php [deleted file]
includes/job/JobQueueRedis.php [deleted file]
includes/job/JobSpecification.php [deleted file]
includes/job/README [deleted file]
includes/job/aggregator/JobQueueAggregator.php [deleted file]
includes/job/aggregator/JobQueueAggregatorMemc.php [deleted file]
includes/job/aggregator/JobQueueAggregatorRedis.php [deleted file]
includes/job/jobs/AssembleUploadChunksJob.php [deleted file]
includes/job/jobs/DoubleRedirectJob.php [deleted file]
includes/job/jobs/DuplicateJob.php [deleted file]
includes/job/jobs/EmaillingJob.php [deleted file]
includes/job/jobs/EnotifNotifyJob.php [deleted file]
includes/job/jobs/HTMLCacheUpdateJob.php [deleted file]
includes/job/jobs/NullJob.php [deleted file]
includes/job/jobs/PublishStashedFileJob.php [deleted file]
includes/job/jobs/RefreshLinksJob.php [deleted file]
includes/job/jobs/RefreshLinksJob2.php [deleted file]
includes/job/jobs/UploadFromUrlJob.php [deleted file]
includes/job/utils/BacklinkJobUtils.php [deleted file]
includes/jobqueue/Job.php [new file with mode: 0644]
includes/jobqueue/JobQueue.php [new file with mode: 0644]
includes/jobqueue/JobQueueDB.php [new file with mode: 0644]
includes/jobqueue/JobQueueFederated.php [new file with mode: 0644]
includes/jobqueue/JobQueueGroup.php [new file with mode: 0644]
includes/jobqueue/JobQueueRedis.php [new file with mode: 0644]
includes/jobqueue/JobSpecification.php [new file with mode: 0644]
includes/jobqueue/README [new file with mode: 0644]
includes/jobqueue/aggregator/JobQueueAggregator.php [new file with mode: 0644]
includes/jobqueue/aggregator/JobQueueAggregatorMemc.php [new file with mode: 0644]
includes/jobqueue/aggregator/JobQueueAggregatorRedis.php [new file with mode: 0644]
includes/jobqueue/jobs/AssembleUploadChunksJob.php [new file with mode: 0644]
includes/jobqueue/jobs/DoubleRedirectJob.php [new file with mode: 0644]
includes/jobqueue/jobs/DuplicateJob.php [new file with mode: 0644]
includes/jobqueue/jobs/EmaillingJob.php [new file with mode: 0644]
includes/jobqueue/jobs/EnotifNotifyJob.php [new file with mode: 0644]
includes/jobqueue/jobs/HTMLCacheUpdateJob.php [new file with mode: 0644]
includes/jobqueue/jobs/NullJob.php [new file with mode: 0644]
includes/jobqueue/jobs/PublishStashedFileJob.php [new file with mode: 0644]
includes/jobqueue/jobs/RefreshLinksJob.php [new file with mode: 0644]
includes/jobqueue/jobs/RefreshLinksJob2.php [new file with mode: 0644]
includes/jobqueue/jobs/UploadFromUrlJob.php [new file with mode: 0644]
includes/jobqueue/utils/BacklinkJobUtils.php [new file with mode: 0644]
includes/profiler/Profiler.php
includes/profiler/ProfilerMwprof.php
includes/profiler/ProfilerSimple.php
languages/messages/MessagesAz.php
languages/messages/MessagesBe.php
languages/messages/MessagesBe_tarask.php
languages/messages/MessagesBo.php
languages/messages/MessagesBs.php
languages/messages/MessagesCe.php
languages/messages/MessagesCs.php
languages/messages/MessagesDe.php
languages/messages/MessagesDiq.php
languages/messages/MessagesEgl.php
languages/messages/MessagesEs.php
languages/messages/MessagesFa.php
languages/messages/MessagesHe.php
languages/messages/MessagesHsb.php
languages/messages/MessagesIlo.php
languages/messages/MessagesIt.php
languages/messages/MessagesKk_cyrl.php
languages/messages/MessagesLb.php
languages/messages/MessagesLv.php
languages/messages/MessagesMk.php
languages/messages/MessagesMl.php
languages/messages/MessagesMn.php
languages/messages/MessagesNan.php
languages/messages/MessagesOc.php
languages/messages/MessagesOr.php
languages/messages/MessagesPa.php
languages/messages/MessagesPl.php
languages/messages/MessagesPs.php
languages/messages/MessagesPt.php
languages/messages/MessagesPt_br.php
languages/messages/MessagesQqq.php
languages/messages/MessagesRm.php
languages/messages/MessagesRo.php
languages/messages/MessagesRu.php
languages/messages/MessagesSa.php
languages/messages/MessagesSco.php
languages/messages/MessagesSk.php
languages/messages/MessagesSr_ec.php
languages/messages/MessagesSv.php
languages/messages/MessagesTe.php
languages/messages/MessagesUz.php
languages/messages/MessagesYi.php
languages/messages/MessagesZh_hans.php
languages/messages/MessagesZh_hant.php
resources/mediawiki.api/mediawiki.api.category.js
resources/mediawiki.api/mediawiki.api.edit.js
resources/mediawiki.api/mediawiki.api.js
resources/mediawiki.api/mediawiki.api.parse.js
resources/mediawiki.api/mediawiki.api.watch.js
tests/phpunit/includes/ArticleTablesTest.php
tests/phpunit/includes/ExtraParserTest.php
tests/phpunit/includes/TitleTest.php
tests/phpunit/includes/UserTest.php
tests/phpunit/includes/api/ApiQueryAllPagesTest.php
tests/phpunit/includes/libs/JavaScriptMinifierTest.php
tests/phpunit/includes/search/SearchUpdateTest.php
tests/phpunit/includes/specials/SpecialPreferencesTest.php
tests/phpunit/includes/upload/UploadStashTest.php

index a9080b2..b290e8d 100644 (file)
@@ -657,35 +657,35 @@ $wgAutoloadLocalClasses = array(
        'WebInstallerPage' => 'includes/installer/WebInstallerPage.php',
 
        # includes/job
-       'IJobSpecification' => 'includes/job/JobSpecification.php',
-       'Job' => 'includes/job/Job.php',
-       'JobQueue' => 'includes/job/JobQueue.php',
-       'JobQueueAggregator' => 'includes/job/aggregator/JobQueueAggregator.php',
-       'JobQueueAggregatorMemc' => 'includes/job/aggregator/JobQueueAggregatorMemc.php',
-       'JobQueueAggregatorRedis' => 'includes/job/aggregator/JobQueueAggregatorRedis.php',
-       'JobQueueDB' => 'includes/job/JobQueueDB.php',
-       'JobQueueConnectionError' => 'includes/job/JobQueue.php',
-       'JobQueueError' => 'includes/job/JobQueue.php',
-       'JobQueueGroup' => 'includes/job/JobQueueGroup.php',
-       'JobQueueFederated' => 'includes/job/JobQueueFederated.php',
-       'JobQueueRedis' => 'includes/job/JobQueueRedis.php',
-       'JobSpecification' => 'includes/job/JobSpecification.php',
-
-       # includes/job/jobs
-       'DoubleRedirectJob' => 'includes/job/jobs/DoubleRedirectJob.php',
-       'DuplicateJob' => 'includes/job/jobs/DuplicateJob.php',
-       'EmaillingJob' => 'includes/job/jobs/EmaillingJob.php',
-       'EnotifNotifyJob' => 'includes/job/jobs/EnotifNotifyJob.php',
-       'HTMLCacheUpdateJob' => 'includes/job/jobs/HTMLCacheUpdateJob.php',
-       'NullJob' => 'includes/job/jobs/NullJob.php',
-       'RefreshLinksJob' => 'includes/job/jobs/RefreshLinksJob.php',
-       'RefreshLinksJob2' => 'includes/job/jobs/RefreshLinksJob2.php',
-       'UploadFromUrlJob' => 'includes/job/jobs/UploadFromUrlJob.php',
-       'AssembleUploadChunksJob' => 'includes/job/jobs/AssembleUploadChunksJob.php',
-       'PublishStashedFileJob' => 'includes/job/jobs/PublishStashedFileJob.php',
-
-       # includes/job/utils
-       'BacklinkJobUtils' => 'includes/job/utils/BacklinkJobUtils.php',
+       'IJobSpecification' => 'includes/jobqueue/JobSpecification.php',
+       'Job' => 'includes/jobqueue/Job.php',
+       'JobQueue' => 'includes/jobqueue/JobQueue.php',
+       'JobQueueAggregator' => 'includes/jobqueue/aggregator/JobQueueAggregator.php',
+       'JobQueueAggregatorMemc' => 'includes/jobqueue/aggregator/JobQueueAggregatorMemc.php',
+       'JobQueueAggregatorRedis' => 'includes/jobqueue/aggregator/JobQueueAggregatorRedis.php',
+       'JobQueueDB' => 'includes/jobqueue/JobQueueDB.php',
+       'JobQueueConnectionError' => 'includes/jobqueue/JobQueue.php',
+       'JobQueueError' => 'includes/jobqueue/JobQueue.php',
+       'JobQueueGroup' => 'includes/jobqueue/JobQueueGroup.php',
+       'JobQueueFederated' => 'includes/jobqueue/JobQueueFederated.php',
+       'JobQueueRedis' => 'includes/jobqueue/JobQueueRedis.php',
+       'JobSpecification' => 'includes/jobqueue/JobSpecification.php',
+
+       # includes/jobqueue/jobs
+       'DoubleRedirectJob' => 'includes/jobqueue/jobs/DoubleRedirectJob.php',
+       'DuplicateJob' => 'includes/jobqueue/jobs/DuplicateJob.php',
+       'EmaillingJob' => 'includes/jobqueue/jobs/EmaillingJob.php',
+       'EnotifNotifyJob' => 'includes/jobqueue/jobs/EnotifNotifyJob.php',
+       'HTMLCacheUpdateJob' => 'includes/jobqueue/jobs/HTMLCacheUpdateJob.php',
+       'NullJob' => 'includes/jobqueue/jobs/NullJob.php',
+       'RefreshLinksJob' => 'includes/jobqueue/jobs/RefreshLinksJob.php',
+       'RefreshLinksJob2' => 'includes/jobqueue/jobs/RefreshLinksJob2.php',
+       'UploadFromUrlJob' => 'includes/jobqueue/jobs/UploadFromUrlJob.php',
+       'AssembleUploadChunksJob' => 'includes/jobqueue/jobs/AssembleUploadChunksJob.php',
+       'PublishStashedFileJob' => 'includes/jobqueue/jobs/PublishStashedFileJob.php',
+
+       # includes/jobqueue/utils
+       'BacklinkJobUtils' => 'includes/jobqueue/utils/BacklinkJobUtils.php',
 
        # includes/json
        'FormatJson' => 'includes/json/FormatJson.php',
index 6d9f372..9b47acf 100644 (file)
@@ -697,6 +697,7 @@ class User {
                return $this->getPasswordValidity( $password ) === true;
        }
 
+
        /**
         * Given unvalidated password input, return error message on failure.
         *
@@ -704,6 +705,33 @@ class User {
         * @return mixed: true on success, string or array of error message on failure
         */
        public function getPasswordValidity( $password ) {
+               $result = $this->checkPasswordValidity( $password );
+               if ( $result->isGood() ) {
+                       return true;
+               } else {
+                       $messages = array();
+                       foreach ( $result->getErrorsByType( 'error' ) as $error ) {
+                               $messages[] = $error['message'];
+                       }
+                       foreach ( $result->getErrorsByType( 'warning' ) as $warning ) {
+                               $messages[] = $warning['message'];
+                       }
+                       if ( count( $messages ) === 1 ) {
+                               return $messages[0];
+                       }
+                       return $messages;
+               }
+       }
+
+       /**
+        * Check if this is a valid password for this user. Status will be good if
+        * the password is valid, or have an array of error messages if not.
+        *
+        * @param string $password Desired password
+        * @return Status
+        * @since 1.23
+        */
+       public function checkPasswordValidity( $password ) {
                global $wgMinimalPasswordLength, $wgContLang;
 
                static $blockedLogins = array(
@@ -711,30 +739,37 @@ class User {
                        'Apitestsysop' => 'testpass', 'Apitestuser' => 'testpass' # r75605
                );
 
+               $status = Status::newGood();
+
                $result = false; //init $result to false for the internal checks
 
                if ( !wfRunHooks( 'isValidPassword', array( $password, &$result, $this ) ) ) {
-                       return $result;
+                       $status->error( $result );
+                       return $status;
                }
 
                if ( $result === false ) {
                        if ( strlen( $password ) < $wgMinimalPasswordLength ) {
-                               return 'passwordtooshort';
+                               $status->error( 'passwordtooshort', $wgMinimalPasswordLength );
+                               return $status;
                        } elseif ( $wgContLang->lc( $password ) == $wgContLang->lc( $this->mName ) ) {
-                               return 'password-name-match';
+                               $status->error( 'password-name-match' );
+                               return $status;
                        } elseif ( isset( $blockedLogins[$this->getName()] ) && $password == $blockedLogins[$this->getName()] ) {
-                               return 'password-login-forbidden';
+                               $status->error( 'password-login-forbidden' );
+                               return $status;
                        } else {
-                               //it seems weird returning true here, but this is because of the
+                               //it seems weird returning a Good status here, but this is because of the
                                //initialization of $result to false above. If the hook is never run or it
                                //doesn't modify $result, then we will likely get down into this if with
                                //a valid password.
-                               return true;
+                               return $status;
                        }
                } elseif ( $result === true ) {
-                       return true;
+                       return $status;
                } else {
-                       return $result; //the isValidPassword hook set a string $result and returned true
+                       $status->error( $result );
+                       return $status; //the isValidPassword hook set a string $result and returned true
                }
        }
 
index 409160c..c56111f 100644 (file)
@@ -541,18 +541,27 @@ class LocalisationCache {
         */
        protected function readJSONFile( $fileName ) {
                wfProfileIn( __METHOD__ );
+
                if ( !is_readable( $fileName ) ) {
+                       wfProfileOut( __METHOD__ );
+
                        return array();
                }
 
                $json = file_get_contents( $fileName );
                if ( $json === false ) {
+                       wfProfileOut( __METHOD__ );
+
                        return array();
                }
+
                $data = FormatJson::decode( $json, true );
                if ( $data === null ) {
+                       wfProfileOut( __METHOD__ );
+
                        throw new MWException( __METHOD__ . ": Invalid JSON file: $fileName" );
                }
+
                // Remove keys starting with '@', they're reserved for metadata and non-message data
                foreach ( $data as $key => $unused ) {
                        if ( $key === '' || $key[0] === '@' ) {
@@ -560,6 +569,8 @@ class LocalisationCache {
                        }
                }
 
+               wfProfileOut( __METHOD__ );
+
                // The JSON format only supports messages, none of the other variables, so wrap the data
                return array( 'messages' => $data );
        }
index 5f880d6..de4c2f5 100644 (file)
@@ -493,13 +493,6 @@ class LoadBalancer {
        public function reuseConnection( $conn ) {
                $serverIndex = $conn->getLBInfo( 'serverIndex' );
                $refCount = $conn->getLBInfo( 'foreignPoolRefCount' );
-               $dbName = $conn->getDBname();
-               $prefix = $conn->tablePrefix();
-               if ( strval( $prefix ) !== '' ) {
-                       $wiki = "$dbName-$prefix";
-               } else {
-                       $wiki = $dbName;
-               }
                if ( $serverIndex === null || $refCount === null ) {
                        wfDebug( __METHOD__ . ": this connection was not opened as a foreign connection\n" );
 
@@ -516,6 +509,14 @@ class LoadBalancer {
 
                        return;
                }
+
+               $dbName = $conn->getDBname();
+               $prefix = $conn->tablePrefix();
+               if ( strval( $prefix ) !== '' ) {
+                       $wiki = "$dbName-$prefix";
+               } else {
+                       $wiki = $dbName;
+               }
                if ( $this->mConns['foreignUsed'][$serverIndex][$wiki] !== $conn ) {
                        throw new MWException( __METHOD__ . ": connection not found, has " .
                                "the connection been freed already?" );
diff --git a/includes/job/Job.php b/includes/job/Job.php
deleted file mode 100644 (file)
index 5fc1e06..0000000
+++ /dev/null
@@ -1,330 +0,0 @@
-<?php
-/**
- * Job queue task base code.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @defgroup JobQueue JobQueue
- */
-
-/**
- * Class to both describe a background job and handle jobs.
- * The queue aspects of this class are now deprecated.
- * Using the class to push jobs onto queues is deprecated (use JobSpecification).
- *
- * @ingroup JobQueue
- */
-abstract class Job implements IJobSpecification {
-       /** @var string */
-       public $command;
-
-       /** @var array|bool Array of job parameters or false if none */
-       public $params;
-
-       /** @var array Additional queue metadata */
-       public $metadata = array();
-
-       /** @var Title */
-       protected $title;
-
-       /** @var bool Expensive jobs may set this to true */
-       protected $removeDuplicates;
-
-       /** @var string Text for error that occurred last */
-       protected $error;
-
-       /*-------------------------------------------------------------------------
-        * Abstract functions
-        *------------------------------------------------------------------------*/
-
-       /**
-        * Run the job
-        * @return bool Success
-        */
-       abstract public function run();
-
-       /*-------------------------------------------------------------------------
-        * Static functions
-        *------------------------------------------------------------------------*/
-
-       /**
-        * Create the appropriate object to handle a specific job
-        *
-        * @param string $command Job command
-        * @param Title $title Associated title
-        * @param array|bool $params Job parameters
-        * @throws MWException
-        * @return Job
-        */
-       public static function factory( $command, Title $title, $params = false ) {
-               global $wgJobClasses;
-               if ( isset( $wgJobClasses[$command] ) ) {
-                       $class = $wgJobClasses[$command];
-
-                       return new $class( $title, $params );
-               }
-               throw new MWException( "Invalid job command `{$command}`" );
-       }
-
-       /**
-        * Batch-insert a group of jobs into the queue.
-        * This will be wrapped in a transaction with a forced commit.
-        *
-        * This may add duplicate at insert time, but they will be
-        * removed later on, when the first one is popped.
-        *
-        * @param array $jobs of Job objects
-        * @return bool
-        * @deprecated since 1.21
-        */
-       public static function batchInsert( $jobs ) {
-               return JobQueueGroup::singleton()->push( $jobs );
-       }
-
-       /**
-        * Insert a group of jobs into the queue.
-        *
-        * Same as batchInsert() but does not commit and can thus
-        * be rolled-back as part of a larger transaction. However,
-        * large batches of jobs can cause slave lag.
-        *
-        * @param array $jobs of Job objects
-        * @return bool
-        * @deprecated since 1.21
-        */
-       public static function safeBatchInsert( $jobs ) {
-               return JobQueueGroup::singleton()->push( $jobs, JobQueue::QOS_ATOMIC );
-       }
-
-       /**
-        * Pop a job of a certain type.  This tries less hard than pop() to
-        * actually find a job; it may be adversely affected by concurrent job
-        * runners.
-        *
-        * @param $type string
-        * @return Job|bool Returns false if there are no jobs
-        * @deprecated since 1.21
-        */
-       public static function pop_type( $type ) {
-               return JobQueueGroup::singleton()->get( $type )->pop();
-       }
-
-       /**
-        * Pop a job off the front of the queue.
-        * This is subject to $wgJobTypesExcludedFromDefaultQueue.
-        *
-        * @return Job|bool False if there are no jobs
-        * @deprecated since 1.21
-        */
-       public static function pop() {
-               return JobQueueGroup::singleton()->pop();
-       }
-
-       /*-------------------------------------------------------------------------
-        * Non-static functions
-        *------------------------------------------------------------------------*/
-
-       /**
-        * @param $command
-        * @param $title
-        * @param $params array|bool
-        */
-       public function __construct( $command, $title, $params = false ) {
-               $this->command = $command;
-               $this->title = $title;
-               $this->params = $params;
-
-               // expensive jobs may set this to true
-               $this->removeDuplicates = false;
-       }
-
-       /**
-        * @return string
-        */
-       public function getType() {
-               return $this->command;
-       }
-
-       /**
-        * @return Title
-        */
-       public function getTitle() {
-               return $this->title;
-       }
-
-       /**
-        * @return array
-        */
-       public function getParams() {
-               return $this->params;
-       }
-
-       /**
-        * @return int|null UNIX timestamp to delay running this job until, otherwise null
-        * @since 1.22
-        */
-       public function getReleaseTimestamp() {
-               return isset( $this->params['jobReleaseTimestamp'] )
-                       ? wfTimestampOrNull( TS_UNIX, $this->params['jobReleaseTimestamp'] )
-                       : null;
-       }
-
-       /**
-        * @return bool Whether only one of each identical set of jobs should be run
-        */
-       public function ignoreDuplicates() {
-               return $this->removeDuplicates;
-       }
-
-       /**
-        * @return bool Whether this job can be retried on failure by job runners
-        * @since 1.21
-        */
-       public function allowRetries() {
-               return true;
-       }
-
-       /**
-        * @return integer Number of actually "work items" handled in this job
-        * @see $wgJobBackoffThrottling
-        * @since 1.23
-        */
-       public function workItemCount() {
-               return 1;
-       }
-
-       /**
-        * Subclasses may need to override this to make duplication detection work.
-        * The resulting map conveys everything that makes the job unique. This is
-        * only checked if ignoreDuplicates() returns true, meaning that duplicate
-        * jobs are supposed to be ignored.
-        *
-        * @return array Map of key/values
-        * @since 1.21
-        */
-       public function getDeduplicationInfo() {
-               $info = array(
-                       'type' => $this->getType(),
-                       'namespace' => $this->getTitle()->getNamespace(),
-                       'title' => $this->getTitle()->getDBkey(),
-                       'params' => $this->getParams()
-               );
-               if ( is_array( $info['params'] ) ) {
-                       // Identical jobs with different "root" jobs should count as duplicates
-                       unset( $info['params']['rootJobSignature'] );
-                       unset( $info['params']['rootJobTimestamp'] );
-                       // Likewise for jobs with different delay times
-                       unset( $info['params']['jobReleaseTimestamp'] );
-               }
-
-               return $info;
-       }
-
-       /**
-        * @see JobQueue::deduplicateRootJob()
-        * @param string $key A key that identifies the task
-        * @return array Map of:
-        *   - rootJobSignature : hash (e.g. SHA1) that identifies the task
-        *   - rootJobTimestamp : TS_MW timestamp of this instance of the task
-        * @since 1.21
-        */
-       public static function newRootJobParams( $key ) {
-               return array(
-                       'rootJobSignature' => sha1( $key ),
-                       'rootJobTimestamp' => wfTimestampNow()
-               );
-       }
-
-       /**
-        * @see JobQueue::deduplicateRootJob()
-        * @return array
-        * @since 1.21
-        */
-       public function getRootJobParams() {
-               return array(
-                       'rootJobSignature' => isset( $this->params['rootJobSignature'] )
-                               ? $this->params['rootJobSignature']
-                               : null,
-                       'rootJobTimestamp' => isset( $this->params['rootJobTimestamp'] )
-                               ? $this->params['rootJobTimestamp']
-                               : null
-               );
-       }
-
-       /**
-        * @see JobQueue::deduplicateRootJob()
-        * @return bool
-        * @since 1.22
-        */
-       public function hasRootJobParams() {
-               return isset( $this->params['rootJobSignature'] )
-                       && isset( $this->params['rootJobTimestamp'] );
-       }
-
-       /**
-        * Insert a single job into the queue.
-        * @return bool true on success
-        * @deprecated since 1.21
-        */
-       public function insert() {
-               return JobQueueGroup::singleton()->push( $this );
-       }
-
-       /**
-        * @return string
-        */
-       public function toString() {
-               $paramString = '';
-               if ( $this->params ) {
-                       foreach ( $this->params as $key => $value ) {
-                               if ( $paramString != '' ) {
-                                       $paramString .= ' ';
-                               }
-                               if ( is_array( $value ) ) {
-                                       $value = "array(" . count( $value ) . ")";
-                               } elseif ( is_object( $value ) && !method_exists( $value, '__toString' ) ) {
-                                       $value = "object(" . get_class( $value ) . ")";
-                               }
-                               $value = (string)$value;
-                               if ( mb_strlen( $value ) > 1024 ) {
-                                       $value = "string(" . mb_strlen( $value ) . ")";
-                               }
-
-                               $paramString .= "$key=$value";
-                       }
-               }
-
-               if ( is_object( $this->title ) ) {
-                       $s = "{$this->command} " . $this->title->getPrefixedDBkey();
-                       if ( $paramString !== '' ) {
-                               $s .= ' ' . $paramString;
-                       }
-
-                       return $s;
-               } else {
-                       return "{$this->command} $paramString";
-               }
-       }
-
-       protected function setLastError( $error ) {
-               $this->error = $error;
-       }
-
-       public function getLastError() {
-               return $this->error;
-       }
-}
diff --git a/includes/job/JobQueue.php b/includes/job/JobQueue.php
deleted file mode 100644 (file)
index a537861..0000000
+++ /dev/null
@@ -1,745 +0,0 @@
-<?php
-/**
- * Job queue base code.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @defgroup JobQueue JobQueue
- * @author Aaron Schulz
- */
-
-/**
- * Class to handle enqueueing and running of background jobs
- *
- * @ingroup JobQueue
- * @since 1.21
- */
-abstract class JobQueue {
-       /** @var string Wiki ID */
-       protected $wiki;
-
-       /** @var string Job type */
-       protected $type;
-
-       /** @var string Job priority for pop() */
-       protected $order;
-
-       /** @var int Time to live in seconds */
-       protected $claimTTL;
-
-       /** @var int Maximum number of times to try a job */
-       protected $maxTries;
-
-       /** @var bool Allow delayed jobs */
-       protected $checkDelay;
-
-       /** @var BagOStuff */
-       protected $dupCache;
-
-       const QOS_ATOMIC = 1; // integer; "all-or-nothing" job insertions
-
-       const ROOTJOB_TTL = 2419200; // integer; seconds to remember root jobs (28 days)
-
-       /**
-        * @param array $params
-        * @throws MWException
-        */
-       protected function __construct( array $params ) {
-               $this->wiki = $params['wiki'];
-               $this->type = $params['type'];
-               $this->claimTTL = isset( $params['claimTTL'] ) ? $params['claimTTL'] : 0;
-               $this->maxTries = isset( $params['maxTries'] ) ? $params['maxTries'] : 3;
-               if ( isset( $params['order'] ) && $params['order'] !== 'any' ) {
-                       $this->order = $params['order'];
-               } else {
-                       $this->order = $this->optimalOrder();
-               }
-               if ( !in_array( $this->order, $this->supportedOrders() ) ) {
-                       throw new MWException( __CLASS__ . " does not support '{$this->order}' order." );
-               }
-               $this->checkDelay = !empty( $params['checkDelay'] );
-               if ( $this->checkDelay && !$this->supportsDelayedJobs() ) {
-                       throw new MWException( __CLASS__ . " does not support delayed jobs." );
-               }
-               $this->dupCache = wfGetCache( CACHE_ANYTHING );
-       }
-
-       /**
-        * Get a job queue object of the specified type.
-        * $params includes:
-        *   - class      : What job class to use (determines job type)
-        *   - wiki       : wiki ID of the wiki the jobs are for (defaults to current wiki)
-        *   - type       : The name of the job types this queue handles
-        *   - order      : Order that pop() selects jobs, one of "fifo", "timestamp" or "random".
-        *                  If "fifo" is used, the queue will effectively be FIFO. Note that job
-        *                  completion will not appear to be exactly FIFO if there are multiple
-        *                  job runners since jobs can take different times to finish once popped.
-        *                  If "timestamp" is used, the queue will at least be loosely ordered
-        *                  by timestamp, allowing for some jobs to be popped off out of order.
-        *                  If "random" is used, pop() will pick jobs in random order.
-        *                  Note that it may only be weakly random (e.g. a lottery of the oldest X).
-        *                  If "any" is choosen, the queue will use whatever order is the fastest.
-        *                  This might be useful for improving concurrency for job acquisition.
-        *   - claimTTL   : If supported, the queue will recycle jobs that have been popped
-        *                  but not acknowledged as completed after this many seconds. Recycling
-        *                  of jobs simple means re-inserting them into the queue. Jobs can be
-        *                  attempted up to three times before being discarded.
-        *   - checkDelay : If supported, respect Job::getReleaseTimestamp() in the push functions.
-        *                  This lets delayed jobs wait in a staging area until a given timestamp is
-        *                  reached, at which point they will enter the queue. If this is not enabled
-        *                  or not supported, an exception will be thrown on delayed job insertion.
-        *
-        * Queue classes should throw an exception if they do not support the options given.
-        *
-        * @param array $params
-        * @return JobQueue
-        * @throws MWException
-        */
-       final public static function factory( array $params ) {
-               $class = $params['class'];
-               if ( !class_exists( $class ) ) {
-                       throw new MWException( "Invalid job queue class '$class'." );
-               }
-               $obj = new $class( $params );
-               if ( !( $obj instanceof self ) ) {
-                       throw new MWException( "Class '$class' is not a " . __CLASS__ . " class." );
-               }
-
-               return $obj;
-       }
-
-       /**
-        * @return string Wiki ID
-        */
-       final public function getWiki() {
-               return $this->wiki;
-       }
-
-       /**
-        * @return string Job type that this queue handles
-        */
-       final public function getType() {
-               return $this->type;
-       }
-
-       /**
-        * @return string One of (random, timestamp, fifo, undefined)
-        */
-       final public function getOrder() {
-               return $this->order;
-       }
-
-       /**
-        * @return bool Whether delayed jobs are enabled
-        * @since 1.22
-        */
-       final public function delayedJobsEnabled() {
-               return $this->checkDelay;
-       }
-
-       /**
-        * Get the allowed queue orders for configuration validation
-        *
-        * @return array Subset of (random, timestamp, fifo, undefined)
-        */
-       abstract protected function supportedOrders();
-
-       /**
-        * Get the default queue order to use if configuration does not specify one
-        *
-        * @return string One of (random, timestamp, fifo, undefined)
-        */
-       abstract protected function optimalOrder();
-
-       /**
-        * Find out if delayed jobs are supported for configuration validation
-        *
-        * @return bool Whether delayed jobs are supported
-        */
-       protected function supportsDelayedJobs() {
-               return false; // not implemented
-       }
-
-       /**
-        * Quickly check if the queue has no available (unacquired, non-delayed) jobs.
-        * Queue classes should use caching if they are any slower without memcached.
-        *
-        * If caching is used, this might return false when there are actually no jobs.
-        * If pop() is called and returns false then it should correct the cache. Also,
-        * calling flushCaches() first prevents this. However, this affect is typically
-        * not distinguishable from the race condition between isEmpty() and pop().
-        *
-        * @return bool
-        * @throws JobQueueError
-        */
-       final public function isEmpty() {
-               wfProfileIn( __METHOD__ );
-               $res = $this->doIsEmpty();
-               wfProfileOut( __METHOD__ );
-
-               return $res;
-       }
-
-       /**
-        * @see JobQueue::isEmpty()
-        * @return bool
-        */
-       abstract protected function doIsEmpty();
-
-       /**
-        * Get the number of available (unacquired, non-delayed) jobs in the queue.
-        * Queue classes should use caching if they are any slower without memcached.
-        *
-        * If caching is used, this number might be out of date for a minute.
-        *
-        * @return int
-        * @throws JobQueueError
-        */
-       final public function getSize() {
-               wfProfileIn( __METHOD__ );
-               $res = $this->doGetSize();
-               wfProfileOut( __METHOD__ );
-
-               return $res;
-       }
-
-       /**
-        * @see JobQueue::getSize()
-        * @return int
-        */
-       abstract protected function doGetSize();
-
-       /**
-        * Get the number of acquired jobs (these are temporarily out of the queue).
-        * Queue classes should use caching if they are any slower without memcached.
-        *
-        * If caching is used, this number might be out of date for a minute.
-        *
-        * @return int
-        * @throws JobQueueError
-        */
-       final public function getAcquiredCount() {
-               wfProfileIn( __METHOD__ );
-               $res = $this->doGetAcquiredCount();
-               wfProfileOut( __METHOD__ );
-
-               return $res;
-       }
-
-       /**
-        * @see JobQueue::getAcquiredCount()
-        * @return int
-        */
-       abstract protected function doGetAcquiredCount();
-
-       /**
-        * Get the number of delayed jobs (these are temporarily out of the queue).
-        * Queue classes should use caching if they are any slower without memcached.
-        *
-        * If caching is used, this number might be out of date for a minute.
-        *
-        * @return int
-        * @throws JobQueueError
-        * @since 1.22
-        */
-       final public function getDelayedCount() {
-               wfProfileIn( __METHOD__ );
-               $res = $this->doGetDelayedCount();
-               wfProfileOut( __METHOD__ );
-
-               return $res;
-       }
-
-       /**
-        * @see JobQueue::getDelayedCount()
-        * @return int
-        */
-       protected function doGetDelayedCount() {
-               return 0; // not implemented
-       }
-
-       /**
-        * Get the number of acquired jobs that can no longer be attempted.
-        * Queue classes should use caching if they are any slower without memcached.
-        *
-        * If caching is used, this number might be out of date for a minute.
-        *
-        * @return int
-        * @throws JobQueueError
-        */
-       final public function getAbandonedCount() {
-               wfProfileIn( __METHOD__ );
-               $res = $this->doGetAbandonedCount();
-               wfProfileOut( __METHOD__ );
-
-               return $res;
-       }
-
-       /**
-        * @see JobQueue::getAbandonedCount()
-        * @return int
-        */
-       protected function doGetAbandonedCount() {
-               return 0; // not implemented
-       }
-
-       /**
-        * Push one or more jobs into the queue.
-        * This does not require $wgJobClasses to be set for the given job type.
-        * Outside callers should use JobQueueGroup::push() instead of this function.
-        *
-        * @param Job|array $jobs A single job or an array of Jobs
-        * @param int $flags Bitfield (supports JobQueue::QOS_ATOMIC)
-        * @return bool Returns false on failure
-        * @throws JobQueueError
-        */
-       final public function push( $jobs, $flags = 0 ) {
-               return $this->batchPush( is_array( $jobs ) ? $jobs : array( $jobs ), $flags );
-       }
-
-       /**
-        * Push a batch of jobs into the queue.
-        * This does not require $wgJobClasses to be set for the given job type.
-        * Outside callers should use JobQueueGroup::push() instead of this function.
-        *
-        * @param array $jobs List of Jobs
-        * @param int $flags Bitfield (supports JobQueue::QOS_ATOMIC)
-        * @throws MWException
-        * @return bool Returns false on failure
-        */
-       final public function batchPush( array $jobs, $flags = 0 ) {
-               if ( !count( $jobs ) ) {
-                       return true; // nothing to do
-               }
-
-               foreach ( $jobs as $job ) {
-                       if ( $job->getType() !== $this->type ) {
-                               throw new MWException(
-                                       "Got '{$job->getType()}' job; expected a '{$this->type}' job." );
-                       } elseif ( $job->getReleaseTimestamp() && !$this->checkDelay ) {
-                               throw new MWException(
-                                       "Got delayed '{$job->getType()}' job; delays are not supported." );
-                       }
-               }
-
-               wfProfileIn( __METHOD__ );
-               $ok = $this->doBatchPush( $jobs, $flags );
-               wfProfileOut( __METHOD__ );
-
-               return $ok;
-       }
-
-       /**
-        * @see JobQueue::batchPush()
-        * @param array $jobs
-        * @param $flags
-        * @return bool
-        */
-       abstract protected function doBatchPush( array $jobs, $flags );
-
-       /**
-        * Pop a job off of the queue.
-        * This requires $wgJobClasses to be set for the given job type.
-        * Outside callers should use JobQueueGroup::pop() instead of this function.
-        *
-        * @throws MWException
-        * @return Job|bool Returns false if there are no jobs
-        */
-       final public function pop() {
-               global $wgJobClasses;
-
-               if ( $this->wiki !== wfWikiID() ) {
-                       throw new MWException( "Cannot pop '{$this->type}' job off foreign wiki queue." );
-               } elseif ( !isset( $wgJobClasses[$this->type] ) ) {
-                       // Do not pop jobs if there is no class for the queue type
-                       throw new MWException( "Unrecognized job type '{$this->type}'." );
-               }
-
-               wfProfileIn( __METHOD__ );
-               $job = $this->doPop();
-               wfProfileOut( __METHOD__ );
-
-               // Flag this job as an old duplicate based on its "root" job...
-               try {
-                       if ( $job && $this->isRootJobOldDuplicate( $job ) ) {
-                               JobQueue::incrStats( 'job-pop-duplicate', $this->type );
-                               $job = DuplicateJob::newFromJob( $job ); // convert to a no-op
-                       }
-               } catch ( MWException $e ) {
-                       // don't lose jobs over this
-               }
-
-               return $job;
-       }
-
-       /**
-        * @see JobQueue::pop()
-        * @return Job
-        */
-       abstract protected function doPop();
-
-       /**
-        * Acknowledge that a job was completed.
-        *
-        * This does nothing for certain queue classes or if "claimTTL" is not set.
-        * Outside callers should use JobQueueGroup::ack() instead of this function.
-        *
-        * @param Job $job
-        * @throws MWException
-        * @return bool
-        */
-       final public function ack( Job $job ) {
-               if ( $job->getType() !== $this->type ) {
-                       throw new MWException( "Got '{$job->getType()}' job; expected '{$this->type}'." );
-               }
-               wfProfileIn( __METHOD__ );
-               $ok = $this->doAck( $job );
-               wfProfileOut( __METHOD__ );
-
-               return $ok;
-       }
-
-       /**
-        * @see JobQueue::ack()
-        * @param Job $job
-        * @return bool
-        */
-       abstract protected function doAck( Job $job );
-
-       /**
-        * Register the "root job" of a given job into the queue for de-duplication.
-        * This should only be called right *after* all the new jobs have been inserted.
-        * This is used to turn older, duplicate, job entries into no-ops. The root job
-        * information will remain in the registry until it simply falls out of cache.
-        *
-        * This requires that $job has two special fields in the "params" array:
-        *   - rootJobSignature : hash (e.g. SHA1) that identifies the task
-        *   - rootJobTimestamp : TS_MW timestamp of this instance of the task
-        *
-        * A "root job" is a conceptual job that consist of potentially many smaller jobs
-        * that are actually inserted into the queue. For example, "refreshLinks" jobs are
-        * spawned when a template is edited. One can think of the task as "update links
-        * of pages that use template X" and an instance of that task as a "root job".
-        * However, what actually goes into the queue are range and leaf job subtypes.
-        * Since these jobs include things like page ID ranges and DB master positions,
-        * and can morph into smaller jobs recursively, simple duplicate detection
-        * for individual jobs being identical (like that of job_sha1) is not useful.
-        *
-        * In the case of "refreshLinks", if these jobs are still in the queue when the template
-        * is edited again, we want all of these old refreshLinks jobs for that template to become
-        * no-ops. This can greatly reduce server load, since refreshLinks jobs involves parsing.
-        * Essentially, the new batch of jobs belong to a new "root job" and the older ones to a
-        * previous "root job" for the same task of "update links of pages that use template X".
-        *
-        * This does nothing for certain queue classes.
-        *
-        * @param Job $job
-        * @throws MWException
-        * @return bool
-        */
-       final public function deduplicateRootJob( Job $job ) {
-               if ( $job->getType() !== $this->type ) {
-                       throw new MWException( "Got '{$job->getType()}' job; expected '{$this->type}'." );
-               }
-               wfProfileIn( __METHOD__ );
-               $ok = $this->doDeduplicateRootJob( $job );
-               wfProfileOut( __METHOD__ );
-
-               return $ok;
-       }
-
-       /**
-        * @see JobQueue::deduplicateRootJob()
-        * @param Job $job
-        * @throws MWException
-        * @return bool
-        */
-       protected function doDeduplicateRootJob( Job $job ) {
-               if ( !$job->hasRootJobParams() ) {
-                       throw new MWException( "Cannot register root job; missing parameters." );
-               }
-               $params = $job->getRootJobParams();
-
-               $key = $this->getRootJobCacheKey( $params['rootJobSignature'] );
-               // Callers should call batchInsert() and then this function so that if the insert
-               // fails, the de-duplication registration will be aborted. Since the insert is
-               // deferred till "transaction idle", do the same here, so that the ordering is
-               // maintained. Having only the de-duplication registration succeed would cause
-               // jobs to become no-ops without any actual jobs that made them redundant.
-               $timestamp = $this->dupCache->get( $key ); // current last timestamp of this job
-               if ( $timestamp && $timestamp >= $params['rootJobTimestamp'] ) {
-                       return true; // a newer version of this root job was enqueued
-               }
-
-               // Update the timestamp of the last root job started at the location...
-               return $this->dupCache->set( $key, $params['rootJobTimestamp'], JobQueueDB::ROOTJOB_TTL );
-       }
-
-       /**
-        * Check if the "root" job of a given job has been superseded by a newer one
-        *
-        * @param Job $job
-        * @throws MWException
-        * @return bool
-        */
-       final protected function isRootJobOldDuplicate( Job $job ) {
-               if ( $job->getType() !== $this->type ) {
-                       throw new MWException( "Got '{$job->getType()}' job; expected '{$this->type}'." );
-               }
-               wfProfileIn( __METHOD__ );
-               $isDuplicate = $this->doIsRootJobOldDuplicate( $job );
-               wfProfileOut( __METHOD__ );
-
-               return $isDuplicate;
-       }
-
-       /**
-        * @see JobQueue::isRootJobOldDuplicate()
-        * @param Job $job
-        * @return bool
-        */
-       protected function doIsRootJobOldDuplicate( Job $job ) {
-               if ( !$job->hasRootJobParams() ) {
-                       return false; // job has no de-deplication info
-               }
-               $params = $job->getRootJobParams();
-
-               $key = $this->getRootJobCacheKey( $params['rootJobSignature'] );
-               // Get the last time this root job was enqueued
-               $timestamp = $this->dupCache->get( $key );
-
-               // Check if a new root job was started at the location after this one's...
-               return ( $timestamp && $timestamp > $params['rootJobTimestamp'] );
-       }
-
-       /**
-        * @param string $signature Hash identifier of the root job
-        * @return string
-        */
-       protected function getRootJobCacheKey( $signature ) {
-               list( $db, $prefix ) = wfSplitWikiID( $this->wiki );
-
-               return wfForeignMemcKey( $db, $prefix, 'jobqueue', $this->type, 'rootjob', $signature );
-       }
-
-       /**
-        * Deleted all unclaimed and delayed jobs from the queue
-        *
-        * @return bool Success
-        * @throws JobQueueError
-        * @since 1.22
-        */
-       final public function delete() {
-               wfProfileIn( __METHOD__ );
-               $res = $this->doDelete();
-               wfProfileOut( __METHOD__ );
-
-               return $res;
-       }
-
-       /**
-        * @see JobQueue::delete()
-        * @throws MWException
-        * @return bool Success
-        */
-       protected function doDelete() {
-               throw new MWException( "This method is not implemented." );
-       }
-
-       /**
-        * Wait for any slaves or backup servers to catch up.
-        *
-        * This does nothing for certain queue classes.
-        *
-        * @return void
-        * @throws JobQueueError
-        */
-       final public function waitForBackups() {
-               wfProfileIn( __METHOD__ );
-               $this->doWaitForBackups();
-               wfProfileOut( __METHOD__ );
-       }
-
-       /**
-        * @see JobQueue::waitForBackups()
-        * @return void
-        */
-       protected function doWaitForBackups() {
-       }
-
-       /**
-        * Return a map of task names to task definition maps.
-        * A "task" is a fast periodic queue maintenance action.
-        * Mutually exclusive tasks must implement their own locking in the callback.
-        *
-        * Each task value is an associative array with:
-        *   - name     : the name of the task
-        *   - callback : a PHP callable that performs the task
-        *   - period   : the period in seconds corresponding to the task frequency
-        *
-        * @return array
-        */
-       final public function getPeriodicTasks() {
-               $tasks = $this->doGetPeriodicTasks();
-               foreach ( $tasks as $name => &$def ) {
-                       $def['name'] = $name;
-               }
-
-               return $tasks;
-       }
-
-       /**
-        * @see JobQueue::getPeriodicTasks()
-        * @return array
-        */
-       protected function doGetPeriodicTasks() {
-               return array();
-       }
-
-       /**
-        * Clear any process and persistent caches
-        *
-        * @return void
-        */
-       final public function flushCaches() {
-               wfProfileIn( __METHOD__ );
-               $this->doFlushCaches();
-               wfProfileOut( __METHOD__ );
-       }
-
-       /**
-        * @see JobQueue::flushCaches()
-        * @return void
-        */
-       protected function doFlushCaches() {
-       }
-
-       /**
-        * Get an iterator to traverse over all available jobs in this queue.
-        * This does not include jobs that are currently acquired or delayed.
-        * Note: results may be stale if the queue is concurrently modified.
-        *
-        * @return Iterator
-        * @throws JobQueueError
-        */
-       abstract public function getAllQueuedJobs();
-
-       /**
-        * Get an iterator to traverse over all delayed jobs in this queue.
-        * Note: results may be stale if the queue is concurrently modified.
-        *
-        * @return Iterator
-        * @throws JobQueueError
-        * @since 1.22
-        */
-       public function getAllDelayedJobs() {
-               return new ArrayIterator( array() ); // not implemented
-       }
-
-       /**
-        * Do not use this function outside of JobQueue/JobQueueGroup
-        *
-        * @return string
-        * @since 1.22
-        */
-       public function getCoalesceLocationInternal() {
-               return null;
-       }
-
-       /**
-        * Check whether each of the given queues are empty.
-        * This is used for batching checks for queues stored at the same place.
-        *
-        * @param array $types List of queues types
-        * @return array|null (list of non-empty queue types) or null if unsupported
-        * @throws MWException
-        * @since 1.22
-        */
-       final public function getSiblingQueuesWithJobs( array $types ) {
-               $section = new ProfileSection( __METHOD__ );
-
-               return $this->doGetSiblingQueuesWithJobs( $types );
-       }
-
-       /**
-        * @see JobQueue::getSiblingQueuesWithJobs()
-        * @param array $types List of queues types
-        * @return array|null (list of queue types) or null if unsupported
-        */
-       protected function doGetSiblingQueuesWithJobs( array $types ) {
-               return null; // not supported
-       }
-
-       /**
-        * Check the size of each of the given queues.
-        * For queues not served by the same store as this one, 0 is returned.
-        * This is used for batching checks for queues stored at the same place.
-        *
-        * @param array $types List of queues types
-        * @return array|null (job type => whether queue is empty) or null if unsupported
-        * @throws MWException
-        * @since 1.22
-        */
-       final public function getSiblingQueueSizes( array $types ) {
-               $section = new ProfileSection( __METHOD__ );
-
-               return $this->doGetSiblingQueueSizes( $types );
-       }
-
-       /**
-        * @see JobQueue::getSiblingQueuesSize()
-        * @param array $types List of queues types
-        * @return array|null (list of queue types) or null if unsupported
-        */
-       protected function doGetSiblingQueueSizes( array $types ) {
-               return null; // not supported
-       }
-
-       /**
-        * Call wfIncrStats() for the queue overall and for the queue type
-        *
-        * @param string $key Event type
-        * @param string $type Job type
-        * @param int $delta
-        * @since 1.22
-        */
-       public static function incrStats( $key, $type, $delta = 1 ) {
-               wfIncrStats( $key, $delta );
-               wfIncrStats( "{$key}-{$type}", $delta );
-       }
-
-       /**
-        * Namespace the queue with a key to isolate it for testing
-        *
-        * @param string $key
-        * @return void
-        * @throws MWException
-        */
-       public function setTestingPrefix( $key ) {
-               throw new MWException( "Queue namespacing not supported for this queue type." );
-       }
-}
-
-/**
- * @ingroup JobQueue
- * @since 1.22
- */
-class JobQueueError extends MWException {
-}
-
-class JobQueueConnectionError extends JobQueueError {
-}
diff --git a/includes/job/JobQueueDB.php b/includes/job/JobQueueDB.php
deleted file mode 100644 (file)
index 6097d31..0000000
+++ /dev/null
@@ -1,848 +0,0 @@
-<?php
-/**
- * Database-backed job queue code.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @author Aaron Schulz
- */
-
-/**
- * Class to handle job queues stored in the DB
- *
- * @ingroup JobQueue
- * @since 1.21
- */
-class JobQueueDB extends JobQueue {
-       const CACHE_TTL_SHORT = 30; // integer; seconds to cache info without re-validating
-       const CACHE_TTL_LONG = 300; // integer; seconds to cache info that is kept up to date
-       const MAX_AGE_PRUNE = 604800; // integer; seconds a job can live once claimed
-       const MAX_JOB_RANDOM = 2147483647; // integer; 2^31 - 1, used for job_random
-       const MAX_OFFSET = 255; // integer; maximum number of rows to skip
-
-       /** @var BagOStuff */
-       protected $cache;
-
-       /** @var bool|string Name of an external DB cluster. False if not set */
-       protected $cluster = false;
-
-       /**
-        * Additional parameters include:
-        *   - cluster : The name of an external cluster registered via LBFactory.
-        *               If not specified, the primary DB cluster for the wiki will be used.
-        *               This can be overridden with a custom cluster so that DB handles will
-        *               be retrieved via LBFactory::getExternalLB() and getConnection().
-        * @param array $params
-        */
-       protected function __construct( array $params ) {
-               global $wgMemc;
-
-               parent::__construct( $params );
-
-               $this->cluster = isset( $params['cluster'] ) ? $params['cluster'] : false;
-               // Make sure that we don't use the SQL cache, which would be harmful
-               $this->cache = ( $wgMemc instanceof SqlBagOStuff ) ? new EmptyBagOStuff() : $wgMemc;
-       }
-
-       protected function supportedOrders() {
-               return array( 'random', 'timestamp', 'fifo' );
-       }
-
-       protected function optimalOrder() {
-               return 'random';
-       }
-
-       /**
-        * @see JobQueue::doIsEmpty()
-        * @return bool
-        */
-       protected function doIsEmpty() {
-               $key = $this->getCacheKey( 'empty' );
-
-               $isEmpty = $this->cache->get( $key );
-               if ( $isEmpty === 'true' ) {
-                       return true;
-               } elseif ( $isEmpty === 'false' ) {
-                       return false;
-               }
-
-               $dbr = $this->getSlaveDB();
-               try {
-                       $found = $dbr->selectField( // unclaimed job
-                               'job', '1', array( 'job_cmd' => $this->type, 'job_token' => '' ), __METHOD__
-                       );
-               } catch ( DBError $e ) {
-                       $this->throwDBException( $e );
-               }
-               $this->cache->add( $key, $found ? 'false' : 'true', self::CACHE_TTL_LONG );
-
-               return !$found;
-       }
-
-       /**
-        * @see JobQueue::doGetSize()
-        * @return int
-        */
-       protected function doGetSize() {
-               $key = $this->getCacheKey( 'size' );
-
-               $size = $this->cache->get( $key );
-               if ( is_int( $size ) ) {
-                       return $size;
-               }
-
-               try {
-                       $dbr = $this->getSlaveDB();
-                       $size = (int)$dbr->selectField( 'job', 'COUNT(*)',
-                               array( 'job_cmd' => $this->type, 'job_token' => '' ),
-                               __METHOD__
-                       );
-               } catch ( DBError $e ) {
-                       $this->throwDBException( $e );
-               }
-               $this->cache->set( $key, $size, self::CACHE_TTL_SHORT );
-
-               return $size;
-       }
-
-       /**
-        * @see JobQueue::doGetAcquiredCount()
-        * @return int
-        */
-       protected function doGetAcquiredCount() {
-               if ( $this->claimTTL <= 0 ) {
-                       return 0; // no acknowledgements
-               }
-
-               $key = $this->getCacheKey( 'acquiredcount' );
-
-               $count = $this->cache->get( $key );
-               if ( is_int( $count ) ) {
-                       return $count;
-               }
-
-               $dbr = $this->getSlaveDB();
-               try {
-                       $count = (int)$dbr->selectField( 'job', 'COUNT(*)',
-                               array( 'job_cmd' => $this->type, "job_token != {$dbr->addQuotes( '' )}" ),
-                               __METHOD__
-                       );
-               } catch ( DBError $e ) {
-                       $this->throwDBException( $e );
-               }
-               $this->cache->set( $key, $count, self::CACHE_TTL_SHORT );
-
-               return $count;
-       }
-
-       /**
-        * @see JobQueue::doGetAbandonedCount()
-        * @return int
-        * @throws MWException
-        */
-       protected function doGetAbandonedCount() {
-               global $wgMemc;
-
-               if ( $this->claimTTL <= 0 ) {
-                       return 0; // no acknowledgements
-               }
-
-               $key = $this->getCacheKey( 'abandonedcount' );
-
-               $count = $wgMemc->get( $key );
-               if ( is_int( $count ) ) {
-                       return $count;
-               }
-
-               $dbr = $this->getSlaveDB();
-               try {
-                       $count = (int)$dbr->selectField( 'job', 'COUNT(*)',
-                               array(
-                                       'job_cmd' => $this->type,
-                                       "job_token != {$dbr->addQuotes( '' )}",
-                                       "job_attempts >= " . $dbr->addQuotes( $this->maxTries )
-                               ),
-                               __METHOD__
-                       );
-               } catch ( DBError $e ) {
-                       $this->throwDBException( $e );
-               }
-               $wgMemc->set( $key, $count, self::CACHE_TTL_SHORT );
-
-               return $count;
-       }
-
-       /**
-        * @see JobQueue::doBatchPush()
-        * @param array $jobs
-        * @param $flags
-        * @throws DBError|Exception
-        * @return bool
-        */
-       protected function doBatchPush( array $jobs, $flags ) {
-               $dbw = $this->getMasterDB();
-
-               $that = $this;
-               $method = __METHOD__;
-               $dbw->onTransactionIdle(
-                       function () use ( $dbw, $that, $jobs, $flags, $method ) {
-                               $that->doBatchPushInternal( $dbw, $jobs, $flags, $method );
-                       }
-               );
-
-               return true;
-       }
-
-       /**
-        * This function should *not* be called outside of JobQueueDB
-        *
-        * @param IDatabase $dbw
-        * @param array $jobs
-        * @param int $flags
-        * @param string $method
-        * @throws DBError
-        * @return bool
-        */
-       public function doBatchPushInternal( IDatabase $dbw, array $jobs, $flags, $method ) {
-               if ( !count( $jobs ) ) {
-                       return true;
-               }
-
-               $rowSet = array(); // (sha1 => job) map for jobs that are de-duplicated
-               $rowList = array(); // list of jobs for jobs that are are not de-duplicated
-               foreach ( $jobs as $job ) {
-                       $row = $this->insertFields( $job );
-                       if ( $job->ignoreDuplicates() ) {
-                               $rowSet[$row['job_sha1']] = $row;
-                       } else {
-                               $rowList[] = $row;
-                       }
-               }
-
-               if ( $flags & self::QOS_ATOMIC ) {
-                       $dbw->begin( $method ); // wrap all the job additions in one transaction
-               }
-               try {
-                       // Strip out any duplicate jobs that are already in the queue...
-                       if ( count( $rowSet ) ) {
-                               $res = $dbw->select( 'job', 'job_sha1',
-                                       array(
-                                               // No job_type condition since it's part of the job_sha1 hash
-                                               'job_sha1' => array_keys( $rowSet ),
-                                               'job_token' => '' // unclaimed
-                                       ),
-                                       $method
-                               );
-                               foreach ( $res as $row ) {
-                                       wfDebug( "Job with hash '{$row->job_sha1}' is a duplicate.\n" );
-                                       unset( $rowSet[$row->job_sha1] ); // already enqueued
-                               }
-                       }
-                       // Build the full list of job rows to insert
-                       $rows = array_merge( $rowList, array_values( $rowSet ) );
-                       // Insert the job rows in chunks to avoid slave lag...
-                       foreach ( array_chunk( $rows, 50 ) as $rowBatch ) {
-                               $dbw->insert( 'job', $rowBatch, $method );
-                       }
-                       JobQueue::incrStats( 'job-insert', $this->type, count( $rows ) );
-                       JobQueue::incrStats(
-                               'job-insert-duplicate',
-                               $this->type,
-                               count( $rowSet ) + count( $rowList ) - count( $rows )
-                       );
-               } catch ( DBError $e ) {
-                       if ( $flags & self::QOS_ATOMIC ) {
-                               $dbw->rollback( $method );
-                       }
-                       throw $e;
-               }
-               if ( $flags & self::QOS_ATOMIC ) {
-                       $dbw->commit( $method );
-               }
-
-               $this->cache->set( $this->getCacheKey( 'empty' ), 'false', JobQueueDB::CACHE_TTL_LONG );
-
-               return true;
-       }
-
-       /**
-        * @see JobQueue::doPop()
-        * @return Job|bool
-        */
-       protected function doPop() {
-               if ( $this->cache->get( $this->getCacheKey( 'empty' ) ) === 'true' ) {
-                       return false; // queue is empty
-               }
-
-               $dbw = $this->getMasterDB();
-               try {
-                       $dbw->commit( __METHOD__, 'flush' ); // flush existing transaction
-                       $autoTrx = $dbw->getFlag( DBO_TRX ); // get current setting
-                       $dbw->clearFlag( DBO_TRX ); // make each query its own transaction
-                       $scopedReset = new ScopedCallback( function () use ( $dbw, $autoTrx ) {
-                               $dbw->setFlag( $autoTrx ? DBO_TRX : 0 ); // restore old setting
-                       } );
-
-                       $uuid = wfRandomString( 32 ); // pop attempt
-                       $job = false; // job popped off
-                       do { // retry when our row is invalid or deleted as a duplicate
-                               // Try to reserve a row in the DB...
-                               if ( in_array( $this->order, array( 'fifo', 'timestamp' ) ) ) {
-                                       $row = $this->claimOldest( $uuid );
-                               } else { // random first
-                                       $rand = mt_rand( 0, self::MAX_JOB_RANDOM ); // encourage concurrent UPDATEs
-                                       $gte = (bool)mt_rand( 0, 1 ); // find rows with rand before/after $rand
-                                       $row = $this->claimRandom( $uuid, $rand, $gte );
-                               }
-                               // Check if we found a row to reserve...
-                               if ( !$row ) {
-                                       $this->cache->set( $this->getCacheKey( 'empty' ), 'true', self::CACHE_TTL_LONG );
-                                       break; // nothing to do
-                               }
-                               JobQueue::incrStats( 'job-pop', $this->type );
-                               // Get the job object from the row...
-                               $title = Title::makeTitleSafe( $row->job_namespace, $row->job_title );
-                               if ( !$title ) {
-                                       $dbw->delete( 'job', array( 'job_id' => $row->job_id ), __METHOD__ );
-                                       wfDebug( "Row has invalid title '{$row->job_title}'." );
-                                       continue; // try again
-                               }
-                               $job = Job::factory( $row->job_cmd, $title,
-                                       self::extractBlob( $row->job_params ), $row->job_id );
-                               $job->metadata['id'] = $row->job_id;
-                               break; // done
-                       } while ( true );
-               } catch ( DBError $e ) {
-                       $this->throwDBException( $e );
-               }
-
-               return $job;
-       }
-
-       /**
-        * Reserve a row with a single UPDATE without holding row locks over RTTs...
-        *
-        * @param string $uuid 32 char hex string
-        * @param $rand integer Random unsigned integer (31 bits)
-        * @param bool $gte Search for job_random >= $random (otherwise job_random <= $random)
-        * @return stdClass|bool Row|false
-        */
-       protected function claimRandom( $uuid, $rand, $gte ) {
-               $dbw = $this->getMasterDB();
-               // Check cache to see if the queue has <= OFFSET items
-               $tinyQueue = $this->cache->get( $this->getCacheKey( 'small' ) );
-
-               $row = false; // the row acquired
-               $invertedDirection = false; // whether one job_random direction was already scanned
-               // This uses a replication safe method for acquiring jobs. One could use UPDATE+LIMIT
-               // instead, but that either uses ORDER BY (in which case it deadlocks in MySQL) or is
-               // not replication safe. Due to http://bugs.mysql.com/bug.php?id=6980, subqueries cannot
-               // be used here with MySQL.
-               do {
-                       if ( $tinyQueue ) { // queue has <= MAX_OFFSET rows
-                               // For small queues, using OFFSET will overshoot and return no rows more often.
-                               // Instead, this uses job_random to pick a row (possibly checking both directions).
-                               $ineq = $gte ? '>=' : '<=';
-                               $dir = $gte ? 'ASC' : 'DESC';
-                               $row = $dbw->selectRow( 'job', self::selectFields(), // find a random job
-                                       array(
-                                               'job_cmd' => $this->type,
-                                               'job_token' => '', // unclaimed
-                                               "job_random {$ineq} {$dbw->addQuotes( $rand )}" ),
-                                       __METHOD__,
-                                       array( 'ORDER BY' => "job_random {$dir}" )
-                               );
-                               if ( !$row && !$invertedDirection ) {
-                                       $gte = !$gte;
-                                       $invertedDirection = true;
-                                       continue; // try the other direction
-                               }
-                       } else { // table *may* have >= MAX_OFFSET rows
-                               // Bug 42614: "ORDER BY job_random" with a job_random inequality causes high CPU
-                               // in MySQL if there are many rows for some reason. This uses a small OFFSET
-                               // instead of job_random for reducing excess claim retries.
-                               $row = $dbw->selectRow( 'job', self::selectFields(), // find a random job
-                                       array(
-                                               'job_cmd' => $this->type,
-                                               'job_token' => '', // unclaimed
-                                       ),
-                                       __METHOD__,
-                                       array( 'OFFSET' => mt_rand( 0, self::MAX_OFFSET ) )
-                               );
-                               if ( !$row ) {
-                                       $tinyQueue = true; // we know the queue must have <= MAX_OFFSET rows
-                                       $this->cache->set( $this->getCacheKey( 'small' ), 1, 30 );
-                                       continue; // use job_random
-                               }
-                       }
-
-                       if ( $row ) { // claim the job
-                               $dbw->update( 'job', // update by PK
-                                       array(
-                                               'job_token' => $uuid,
-                                               'job_token_timestamp' => $dbw->timestamp(),
-                                               'job_attempts = job_attempts+1' ),
-                                       array( 'job_cmd' => $this->type, 'job_id' => $row->job_id, 'job_token' => '' ),
-                                       __METHOD__
-                               );
-                               // This might get raced out by another runner when claiming the previously
-                               // selected row. The use of job_random should minimize this problem, however.
-                               if ( !$dbw->affectedRows() ) {
-                                       $row = false; // raced out
-                               }
-                       } else {
-                               break; // nothing to do
-                       }
-               } while ( !$row );
-
-               return $row;
-       }
-
-       /**
-        * Reserve a row with a single UPDATE without holding row locks over RTTs...
-        *
-        * @param string $uuid 32 char hex string
-        * @return stdClass|bool Row|false
-        */
-       protected function claimOldest( $uuid ) {
-               $dbw = $this->getMasterDB();
-
-               $row = false; // the row acquired
-               do {
-                       if ( $dbw->getType() === 'mysql' ) {
-                               // Per http://bugs.mysql.com/bug.php?id=6980, we can't use subqueries on the
-                               // same table being changed in an UPDATE query in MySQL (gives Error: 1093).
-                               // Oracle and Postgre have no such limitation. However, MySQL offers an
-                               // alternative here by supporting ORDER BY + LIMIT for UPDATE queries.
-                               $dbw->query( "UPDATE {$dbw->tableName( 'job' )} " .
-                                       "SET " .
-                                               "job_token = {$dbw->addQuotes( $uuid ) }, " .
-                                               "job_token_timestamp = {$dbw->addQuotes( $dbw->timestamp() )}, " .
-                                               "job_attempts = job_attempts+1 " .
-                                       "WHERE ( " .
-                                               "job_cmd = {$dbw->addQuotes( $this->type )} " .
-                                               "AND job_token = {$dbw->addQuotes( '' )} " .
-                                       ") ORDER BY job_id ASC LIMIT 1",
-                                       __METHOD__
-                               );
-                       } else {
-                               // Use a subquery to find the job, within an UPDATE to claim it.
-                               // This uses as much of the DB wrapper functions as possible.
-                               $dbw->update( 'job',
-                                       array(
-                                               'job_token' => $uuid,
-                                               'job_token_timestamp' => $dbw->timestamp(),
-                                               'job_attempts = job_attempts+1' ),
-                                       array( 'job_id = (' .
-                                               $dbw->selectSQLText( 'job', 'job_id',
-                                                       array( 'job_cmd' => $this->type, 'job_token' => '' ),
-                                                       __METHOD__,
-                                                       array( 'ORDER BY' => 'job_id ASC', 'LIMIT' => 1 ) ) .
-                                               ')'
-                                       ),
-                                       __METHOD__
-                               );
-                       }
-                       // Fetch any row that we just reserved...
-                       if ( $dbw->affectedRows() ) {
-                               $row = $dbw->selectRow( 'job', self::selectFields(),
-                                       array( 'job_cmd' => $this->type, 'job_token' => $uuid ), __METHOD__
-                               );
-                               if ( !$row ) { // raced out by duplicate job removal
-                                       wfDebug( "Row deleted as duplicate by another process." );
-                               }
-                       } else {
-                               break; // nothing to do
-                       }
-               } while ( !$row );
-
-               return $row;
-       }
-
-       /**
-        * @see JobQueue::doAck()
-        * @param Job $job
-        * @throws MWException
-        * @return Job|bool
-        */
-       protected function doAck( Job $job ) {
-               if ( !isset( $job->metadata['id'] ) ) {
-                       throw new MWException( "Job of type '{$job->getType()}' has no ID." );
-               }
-
-               $dbw = $this->getMasterDB();
-               try {
-                       $dbw->commit( __METHOD__, 'flush' ); // flush existing transaction
-                       $autoTrx = $dbw->getFlag( DBO_TRX ); // get current setting
-                       $dbw->clearFlag( DBO_TRX ); // make each query its own transaction
-                       $scopedReset = new ScopedCallback( function () use ( $dbw, $autoTrx ) {
-                               $dbw->setFlag( $autoTrx ? DBO_TRX : 0 ); // restore old setting
-                       } );
-
-                       // Delete a row with a single DELETE without holding row locks over RTTs...
-                       $dbw->delete( 'job',
-                               array( 'job_cmd' => $this->type, 'job_id' => $job->metadata['id'] ), __METHOD__ );
-               } catch ( DBError $e ) {
-                       $this->throwDBException( $e );
-               }
-
-               return true;
-       }
-
-       /**
-        * @see JobQueue::doDeduplicateRootJob()
-        * @param Job $job
-        * @throws MWException
-        * @return bool
-        */
-       protected function doDeduplicateRootJob( Job $job ) {
-               $params = $job->getParams();
-               if ( !isset( $params['rootJobSignature'] ) ) {
-                       throw new MWException( "Cannot register root job; missing 'rootJobSignature'." );
-               } elseif ( !isset( $params['rootJobTimestamp'] ) ) {
-                       throw new MWException( "Cannot register root job; missing 'rootJobTimestamp'." );
-               }
-               $key = $this->getRootJobCacheKey( $params['rootJobSignature'] );
-               // Callers should call batchInsert() and then this function so that if the insert
-               // fails, the de-duplication registration will be aborted. Since the insert is
-               // deferred till "transaction idle", do the same here, so that the ordering is
-               // maintained. Having only the de-duplication registration succeed would cause
-               // jobs to become no-ops without any actual jobs that made them redundant.
-               $dbw = $this->getMasterDB();
-               $cache = $this->dupCache;
-               $dbw->onTransactionIdle( function () use ( $cache, $params, $key, $dbw ) {
-                       $timestamp = $cache->get( $key ); // current last timestamp of this job
-                       if ( $timestamp && $timestamp >= $params['rootJobTimestamp'] ) {
-                               return true; // a newer version of this root job was enqueued
-                       }
-
-                       // Update the timestamp of the last root job started at the location...
-                       return $cache->set( $key, $params['rootJobTimestamp'], JobQueueDB::ROOTJOB_TTL );
-               } );
-
-               return true;
-       }
-
-       /**
-        * @see JobQueue::doDelete()
-        * @return bool
-        */
-       protected function doDelete() {
-               $dbw = $this->getMasterDB();
-               try {
-                       $dbw->delete( 'job', array( 'job_cmd' => $this->type ) );
-               } catch ( DBError $e ) {
-                       $this->throwDBException( $e );
-               }
-
-               return true;
-       }
-
-       /**
-        * @see JobQueue::doWaitForBackups()
-        * @return void
-        */
-       protected function doWaitForBackups() {
-               wfWaitForSlaves();
-       }
-
-       /**
-        * @return array
-        */
-       protected function doGetPeriodicTasks() {
-               return array(
-                       'recycleAndDeleteStaleJobs' => array(
-                               'callback' => array( $this, 'recycleAndDeleteStaleJobs' ),
-                               'period' => ceil( $this->claimTTL / 2 )
-                       )
-               );
-       }
-
-       /**
-        * @return void
-        */
-       protected function doFlushCaches() {
-               foreach ( array( 'empty', 'size', 'acquiredcount' ) as $type ) {
-                       $this->cache->delete( $this->getCacheKey( $type ) );
-               }
-       }
-
-       /**
-        * @see JobQueue::getAllQueuedJobs()
-        * @return Iterator
-        */
-       public function getAllQueuedJobs() {
-               $dbr = $this->getSlaveDB();
-               try {
-                       return new MappedIterator(
-                               $dbr->select( 'job', self::selectFields(),
-                                       array( 'job_cmd' => $this->getType(), 'job_token' => '' ) ),
-                               function ( $row ) use ( $dbr ) {
-                                       $job = Job::factory(
-                                               $row->job_cmd,
-                                               Title::makeTitle( $row->job_namespace, $row->job_title ),
-                                               strlen( $row->job_params ) ? unserialize( $row->job_params ) : false
-                                       );
-                                       $job->metadata['id'] = $row->job_id;
-                                       return $job;
-                               }
-                       );
-               } catch ( DBError $e ) {
-                       $this->throwDBException( $e );
-               }
-       }
-
-       public function getCoalesceLocationInternal() {
-               return $this->cluster
-                       ? "DBCluster:{$this->cluster}:{$this->wiki}"
-                       : "LBFactory:{$this->wiki}";
-       }
-
-       protected function doGetSiblingQueuesWithJobs( array $types ) {
-               $dbr = $this->getSlaveDB();
-               $res = $dbr->select( 'job', 'DISTINCT job_cmd',
-                       array( 'job_cmd' => $types ), __METHOD__ );
-
-               $types = array();
-               foreach ( $res as $row ) {
-                       $types[] = $row->job_cmd;
-               }
-
-               return $types;
-       }
-
-       protected function doGetSiblingQueueSizes( array $types ) {
-               $dbr = $this->getSlaveDB();
-               $res = $dbr->select( 'job', array( 'job_cmd', 'COUNT(*) AS count' ),
-                       array( 'job_cmd' => $types ), __METHOD__, array( 'GROUP BY' => 'job_cmd' ) );
-
-               $sizes = array();
-               foreach ( $res as $row ) {
-                       $sizes[$row->job_cmd] = (int)$row->count;
-               }
-
-               return $sizes;
-       }
-
-       /**
-        * Recycle or destroy any jobs that have been claimed for too long
-        *
-        * @return int Number of jobs recycled/deleted
-        */
-       public function recycleAndDeleteStaleJobs() {
-               $now = time();
-               $count = 0; // affected rows
-               $dbw = $this->getMasterDB();
-
-               try {
-                       if ( !$dbw->lock( "jobqueue-recycle-{$this->type}", __METHOD__, 1 ) ) {
-                               return $count; // already in progress
-                       }
-
-                       // Remove claims on jobs acquired for too long if enabled...
-                       if ( $this->claimTTL > 0 ) {
-                               $claimCutoff = $dbw->timestamp( $now - $this->claimTTL );
-                               // Get the IDs of jobs that have be claimed but not finished after too long.
-                               // These jobs can be recycled into the queue by expiring the claim. Selecting
-                               // the IDs first means that the UPDATE can be done by primary key (less deadlocks).
-                               $res = $dbw->select( 'job', 'job_id',
-                                       array(
-                                               'job_cmd' => $this->type,
-                                               "job_token != {$dbw->addQuotes( '' )}", // was acquired
-                                               "job_token_timestamp < {$dbw->addQuotes( $claimCutoff )}", // stale
-                                               "job_attempts < {$dbw->addQuotes( $this->maxTries )}" ), // retries left
-                                       __METHOD__
-                               );
-                               $ids = array_map(
-                                       function ( $o ) {
-                                               return $o->job_id;
-                                       }, iterator_to_array( $res )
-                               );
-                               if ( count( $ids ) ) {
-                                       // Reset job_token for these jobs so that other runners will pick them up.
-                                       // Set the timestamp to the current time, as it is useful to now that the job
-                                       // was already tried before (the timestamp becomes the "released" time).
-                                       $dbw->update( 'job',
-                                               array(
-                                                       'job_token' => '',
-                                                       'job_token_timestamp' => $dbw->timestamp( $now ) ), // time of release
-                                               array(
-                                                       'job_id' => $ids ),
-                                               __METHOD__
-                                       );
-                                       $count += $dbw->affectedRows();
-                                       JobQueue::incrStats( 'job-recycle', $this->type, $dbw->affectedRows() );
-                                       $this->cache->set( $this->getCacheKey( 'empty' ), 'false', self::CACHE_TTL_LONG );
-                               }
-                       }
-
-                       // Just destroy any stale jobs...
-                       $pruneCutoff = $dbw->timestamp( $now - self::MAX_AGE_PRUNE );
-                       $conds = array(
-                               'job_cmd' => $this->type,
-                               "job_token != {$dbw->addQuotes( '' )}", // was acquired
-                               "job_token_timestamp < {$dbw->addQuotes( $pruneCutoff )}" // stale
-                       );
-                       if ( $this->claimTTL > 0 ) { // only prune jobs attempted too many times...
-                               $conds[] = "job_attempts >= {$dbw->addQuotes( $this->maxTries )}";
-                       }
-                       // Get the IDs of jobs that are considered stale and should be removed. Selecting
-                       // the IDs first means that the UPDATE can be done by primary key (less deadlocks).
-                       $res = $dbw->select( 'job', 'job_id', $conds, __METHOD__ );
-                       $ids = array_map(
-                               function ( $o ) {
-                                       return $o->job_id;
-                               }, iterator_to_array( $res )
-                       );
-                       if ( count( $ids ) ) {
-                               $dbw->delete( 'job', array( 'job_id' => $ids ), __METHOD__ );
-                               $count += $dbw->affectedRows();
-                               JobQueue::incrStats( 'job-abandon', $this->type, $dbw->affectedRows() );
-                       }
-
-                       $dbw->unlock( "jobqueue-recycle-{$this->type}", __METHOD__ );
-               } catch ( DBError $e ) {
-                       $this->throwDBException( $e );
-               }
-
-               return $count;
-       }
-
-       /**
-        * @param IJobSpecification $job
-        * @return array
-        */
-       protected function insertFields( IJobSpecification $job ) {
-               $dbw = $this->getMasterDB();
-
-               return array(
-                       // Fields that describe the nature of the job
-                       'job_cmd' => $job->getType(),
-                       'job_namespace' => $job->getTitle()->getNamespace(),
-                       'job_title' => $job->getTitle()->getDBkey(),
-                       'job_params' => self::makeBlob( $job->getParams() ),
-                       // Additional job metadata
-                       'job_id' => $dbw->nextSequenceValue( 'job_job_id_seq' ),
-                       'job_timestamp' => $dbw->timestamp(),
-                       'job_sha1' => wfBaseConvert(
-                               sha1( serialize( $job->getDeduplicationInfo() ) ),
-                               16, 36, 31
-                       ),
-                       'job_random' => mt_rand( 0, self::MAX_JOB_RANDOM )
-               );
-       }
-
-       /**
-        * @throws JobQueueConnectionError
-        * @return DBConnRef
-        */
-       protected function getSlaveDB() {
-               try {
-                       return $this->getDB( DB_SLAVE );
-               } catch ( DBConnectionError $e ) {
-                       throw new JobQueueConnectionError( "DBConnectionError:" . $e->getMessage() );
-               }
-       }
-
-       /**
-        * @throws JobQueueConnectionError
-        * @return DBConnRef
-        */
-       protected function getMasterDB() {
-               try {
-                       return $this->getDB( DB_MASTER );
-               } catch ( DBConnectionError $e ) {
-                       throw new JobQueueConnectionError( "DBConnectionError:" . $e->getMessage() );
-               }
-       }
-
-       /**
-        * @param $index integer (DB_SLAVE/DB_MASTER)
-        * @return DBConnRef
-        */
-       protected function getDB( $index ) {
-               $lb = ( $this->cluster !== false )
-                       ? wfGetLBFactory()->getExternalLB( $this->cluster, $this->wiki )
-                       : wfGetLB( $this->wiki );
-
-               return $lb->getConnectionRef( $index, array(), $this->wiki );
-       }
-
-       /**
-        * @param $property
-        * @return string
-        */
-       private function getCacheKey( $property ) {
-               list( $db, $prefix ) = wfSplitWikiID( $this->wiki );
-               $cluster = is_string( $this->cluster ) ? $this->cluster : 'main';
-
-               return wfForeignMemcKey( $db, $prefix, 'jobqueue', $cluster, $this->type, $property );
-       }
-
-       /**
-        * @param $params
-        * @return string
-        */
-       protected static function makeBlob( $params ) {
-               if ( $params !== false ) {
-                       return serialize( $params );
-               } else {
-                       return '';
-               }
-       }
-
-       /**
-        * @param $blob
-        * @return bool|mixed
-        */
-       protected static function extractBlob( $blob ) {
-               if ( (string)$blob !== '' ) {
-                       return unserialize( $blob );
-               } else {
-                       return false;
-               }
-       }
-
-       /**
-        * @param DBError $e
-        * @throws JobQueueError
-        */
-       protected function throwDBException( DBError $e ) {
-               throw new JobQueueError( get_class( $e ) . ": " . $e->getMessage() );
-       }
-
-       /**
-        * Return the list of job fields that should be selected.
-        * @since 1.23
-        * @return array
-        */
-       public static function selectFields() {
-               return array(
-                       'job_id',
-                       'job_cmd',
-                       'job_namespace',
-                       'job_title',
-                       'job_timestamp',
-                       'job_params',
-                       'job_random',
-                       'job_attempts',
-                       'job_token',
-                       'job_token_timestamp',
-                       'job_sha1',
-               );
-       }
-}
diff --git a/includes/job/JobQueueFederated.php b/includes/job/JobQueueFederated.php
deleted file mode 100644 (file)
index 9502148..0000000
+++ /dev/null
@@ -1,553 +0,0 @@
-<?php
-/**
- * Job queue code for federated queues.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @author Aaron Schulz
- */
-
-/**
- * Class to handle enqueueing and running of background jobs for federated queues
- *
- * This class allows for queues to be partitioned into smaller queues.
- * A partition is defined by the configuration for a JobQueue instance.
- * For example, one can set $wgJobTypeConf['refreshLinks'] to point to a
- * JobQueueFederated instance, which itself would consist of three JobQueueRedis
- * instances, each using their own redis server. This would allow for the jobs
- * to be split (evenly or based on weights) accross multiple servers if a single
- * server becomes impractical or expensive. Different JobQueue classes can be mixed.
- *
- * The basic queue configuration (e.g. "order", "claimTTL") of a federated queue
- * is inherited by the partition queues. Additional configuration defines what
- * section each wiki is in, what partition queues each section uses (and their weight),
- * and the JobQueue configuration for each partition. Some sections might only need a
- * single queue partition, like the sections for groups of small wikis.
- *
- * If used for performance, then $wgMainCacheType should be set to memcached/redis.
- * Note that "fifo" cannot be used for the ordering, since the data is distributed.
- * One can still use "timestamp" instead, as in "roughly timestamp ordered". Also,
- * queue classes used by this should ignore down servers (with TTL) to avoid slowness.
- *
- * @ingroup JobQueue
- * @since 1.22
- */
-class JobQueueFederated extends JobQueue {
-       /** @var array (partition name => weight) reverse sorted by weight */
-       protected $partitionMap = array();
-
-       /** @var array (partition name => JobQueue) reverse sorted by weight */
-       protected $partitionQueues = array();
-
-       /** @var HashRing */
-       protected $partitionPushRing;
-
-       /** @var BagOStuff */
-       protected $cache;
-
-       /** @var int Maximum number of partitions to try */
-       protected $maxPartitionsTry;
-
-       const CACHE_TTL_SHORT = 30; // integer; seconds to cache info without re-validating
-       const CACHE_TTL_LONG = 300; // integer; seconds to cache info that is kept up to date
-
-       /**
-        * @params include:
-        *  - sectionsByWiki      : A map of wiki IDs to section names.
-        *                          Wikis will default to using the section "default".
-        *  - partitionsBySection : Map of section names to maps of (partition name => weight).
-        *                          A section called 'default' must be defined if not all wikis
-        *                          have explicitly defined sections.
-        *  - configByPartition   : Map of queue partition names to configuration arrays.
-        *                          These configuration arrays are passed to JobQueue::factory().
-        *                          The options set here are overriden by those passed to this
-        *                          the federated queue itself (e.g. 'order' and 'claimTTL').
-        *  - partitionsNoPush    : List of partition names that can handle pop() but not push().
-        *                          This can be used to migrate away from a certain partition.
-        *  - maxPartitionsTry    : Maximum number of times to attempt job insertion using
-        *                          different partition queues. This improves availability
-        *                          during failure, at the cost of added latency and somewhat
-        *                          less reliable job de-duplication mechanisms.
-        * @param array $params
-        * @throws MWException
-        */
-       protected function __construct( array $params ) {
-               parent::__construct( $params );
-               $section = isset( $params['sectionsByWiki'][$this->wiki] )
-                       ? $params['sectionsByWiki'][$this->wiki]
-                       : 'default';
-               if ( !isset( $params['partitionsBySection'][$section] ) ) {
-                       throw new MWException( "No configuration for section '$section'." );
-               }
-               $this->maxPartitionsTry = isset( $params['maxPartitionsTry'] )
-                       ? $params['maxPartitionsTry']
-                       : 2;
-               // Get the full partition map
-               $this->partitionMap = $params['partitionsBySection'][$section];
-               arsort( $this->partitionMap, SORT_NUMERIC );
-               // Get the partitions jobs can actually be pushed to
-               $partitionPushMap = $this->partitionMap;
-               if ( isset( $params['partitionsNoPush'] ) ) {
-                       foreach ( $params['partitionsNoPush'] as $partition ) {
-                               unset( $partitionPushMap[$partition] );
-                       }
-               }
-               // Get the config to pass to merge into each partition queue config
-               $baseConfig = $params;
-               foreach ( array( 'class', 'sectionsByWiki', 'maxPartitionsTry',
-                       'partitionsBySection', 'configByPartition', 'partitionsNoPush' ) as $o
-               ) {
-                       unset( $baseConfig[$o] ); // partition queue doesn't care about this
-               }
-               // Get the partition queue objects
-               foreach ( $this->partitionMap as $partition => $w ) {
-                       if ( !isset( $params['configByPartition'][$partition] ) ) {
-                               throw new MWException( "No configuration for partition '$partition'." );
-                       }
-                       $this->partitionQueues[$partition] = JobQueue::factory(
-                               $baseConfig + $params['configByPartition'][$partition] );
-               }
-               // Get the ring of partitions to push jobs into
-               $this->partitionPushRing = new HashRing( $partitionPushMap );
-               // Aggregate cache some per-queue values if there are multiple partition queues
-               $this->cache = count( $this->partitionMap ) > 1 ? wfGetMainCache() : new EmptyBagOStuff();
-       }
-
-       protected function supportedOrders() {
-               // No FIFO due to partitioning, though "rough timestamp order" is supported
-               return array( 'undefined', 'random', 'timestamp' );
-       }
-
-       protected function optimalOrder() {
-               return 'undefined'; // defer to the partitions
-       }
-
-       protected function supportsDelayedJobs() {
-               return true; // defer checks to the partitions
-       }
-
-       protected function doIsEmpty() {
-               $key = $this->getCacheKey( 'empty' );
-
-               $isEmpty = $this->cache->get( $key );
-               if ( $isEmpty === 'true' ) {
-                       return true;
-               } elseif ( $isEmpty === 'false' ) {
-                       return false;
-               }
-
-               $empty = true;
-               $failed = 0;
-               foreach ( $this->partitionQueues as $queue ) {
-                       try {
-                               $empty = $empty && $queue->doIsEmpty();
-                       } catch ( JobQueueError $e ) {
-                               ++$failed;
-                               MWExceptionHandler::logException( $e );
-                       }
-               }
-               $this->throwErrorIfAllPartitionsDown( $failed );
-
-               $this->cache->add( $key, $empty ? 'true' : 'false', self::CACHE_TTL_LONG );
-               return $empty;
-       }
-
-       protected function doGetSize() {
-               return $this->getCrossPartitionSum( 'size', 'doGetSize' );
-       }
-
-       protected function doGetAcquiredCount() {
-               return $this->getCrossPartitionSum( 'acquiredcount', 'doGetAcquiredCount' );
-       }
-
-       protected function doGetDelayedCount() {
-               return $this->getCrossPartitionSum( 'delayedcount', 'doGetDelayedCount' );
-       }
-
-       protected function doGetAbandonedCount() {
-               return $this->getCrossPartitionSum( 'abandonedcount', 'doGetAbandonedCount' );
-       }
-
-       /**
-        * @param string $type
-        * @param string $method
-        * @return int
-        */
-       protected function getCrossPartitionSum( $type, $method ) {
-               $key = $this->getCacheKey( $type );
-
-               $count = $this->cache->get( $key );
-               if ( is_int( $count ) ) {
-                       return $count;
-               }
-
-               $failed = 0;
-               foreach ( $this->partitionQueues as $queue ) {
-                       try {
-                               $count += $queue->$method();
-                       } catch ( JobQueueError $e ) {
-                               ++$failed;
-                               MWExceptionHandler::logException( $e );
-                       }
-               }
-               $this->throwErrorIfAllPartitionsDown( $failed );
-
-               $this->cache->set( $key, $count, self::CACHE_TTL_SHORT );
-
-               return $count;
-       }
-
-       protected function doBatchPush( array $jobs, $flags ) {
-               // Local ring variable that may be changed to point to a new ring on failure
-               $partitionRing = $this->partitionPushRing;
-               // Try to insert the jobs and update $partitionsTry on any failures.
-               // Retry to insert any remaning jobs again, ignoring the bad partitions.
-               $jobsLeft = $jobs;
-               for ( $i = $this->maxPartitionsTry; $i > 0 && count( $jobsLeft ); --$i ) {
-                       $jobsLeft = $this->tryJobInsertions( $jobsLeft, $partitionRing, $flags );
-               }
-               if ( count( $jobsLeft ) ) {
-                       throw new JobQueueError(
-                               "Could not insert job(s), {$this->maxPartitionsTry} partitions tried." );
-               }
-
-               return true;
-       }
-
-       /**
-        * @param array $jobs
-        * @param HashRing $partitionRing
-        * @param int $flags
-        * @throws JobQueueError
-        * @return array List of Job object that could not be inserted
-        */
-       protected function tryJobInsertions( array $jobs, HashRing &$partitionRing, $flags ) {
-               $jobsLeft = array();
-
-               // Because jobs are spread across partitions, per-job de-duplication needs
-               // to use a consistent hash to avoid allowing duplicate jobs per partition.
-               // When inserting a batch of de-duplicated jobs, QOS_ATOMIC is disregarded.
-               $uJobsByPartition = array(); // (partition name => job list)
-               /** @var Job $job */
-               foreach ( $jobs as $key => $job ) {
-                       if ( $job->ignoreDuplicates() ) {
-                               $sha1 = sha1( serialize( $job->getDeduplicationInfo() ) );
-                               $uJobsByPartition[$partitionRing->getLocation( $sha1 )][] = $job;
-                               unset( $jobs[$key] );
-                       }
-               }
-               // Get the batches of jobs that are not de-duplicated
-               if ( $flags & self::QOS_ATOMIC ) {
-                       $nuJobBatches = array( $jobs ); // all or nothing
-               } else {
-                       // Split the jobs into batches and spread them out over servers if there
-                       // are many jobs. This helps keep the partitions even. Otherwise, send all
-                       // the jobs to a single partition queue to avoids the extra connections.
-                       $nuJobBatches = array_chunk( $jobs, 300 );
-               }
-
-               // Insert the de-duplicated jobs into the queues...
-               foreach ( $uJobsByPartition as $partition => $jobBatch ) {
-                       /** @var JobQueue $queue */
-                       $queue = $this->partitionQueues[$partition];
-                       try {
-                               $ok = $queue->doBatchPush( $jobBatch, $flags | self::QOS_ATOMIC );
-                       } catch ( JobQueueError $e ) {
-                               $ok = false;
-                               MWExceptionHandler::logException( $e );
-                       }
-                       if ( $ok ) {
-                               $key = $this->getCacheKey( 'empty' );
-                               $this->cache->set( $key, 'false', JobQueueDB::CACHE_TTL_LONG );
-                       } else {
-                               $partitionRing = $partitionRing->newWithoutLocation( $partition ); // blacklist
-                               if ( !$partitionRing ) {
-                                       throw new JobQueueError( "Could not insert job(s), no partitions available." );
-                               }
-                               $jobsLeft = array_merge( $jobsLeft, $jobBatch ); // not inserted
-                       }
-               }
-
-               // Insert the jobs that are not de-duplicated into the queues...
-               foreach ( $nuJobBatches as $jobBatch ) {
-                       $partition = ArrayUtils::pickRandom( $partitionRing->getLocationWeights() );
-                       $queue = $this->partitionQueues[$partition];
-                       try {
-                               $ok = $queue->doBatchPush( $jobBatch, $flags | self::QOS_ATOMIC );
-                       } catch ( JobQueueError $e ) {
-                               $ok = false;
-                               MWExceptionHandler::logException( $e );
-                       }
-                       if ( $ok ) {
-                               $key = $this->getCacheKey( 'empty' );
-                               $this->cache->set( $key, 'false', JobQueueDB::CACHE_TTL_LONG );
-                       } else {
-                               $partitionRing = $partitionRing->newWithoutLocation( $partition ); // blacklist
-                               if ( !$partitionRing ) {
-                                       throw new JobQueueError( "Could not insert job(s), no partitions available." );
-                               }
-                               $jobsLeft = array_merge( $jobsLeft, $jobBatch ); // not inserted
-                       }
-               }
-
-               return $jobsLeft;
-       }
-
-       protected function doPop() {
-               $key = $this->getCacheKey( 'empty' );
-
-               $isEmpty = $this->cache->get( $key );
-               if ( $isEmpty === 'true' ) {
-                       return false;
-               }
-
-               $partitionsTry = $this->partitionMap; // (partition => weight)
-
-               $failed = 0;
-               while ( count( $partitionsTry ) ) {
-                       $partition = ArrayUtils::pickRandom( $partitionsTry );
-                       if ( $partition === false ) {
-                               break; // all partitions at 0 weight
-                       }
-
-                       /** @var JobQueue $queue */
-                       $queue = $this->partitionQueues[$partition];
-                       try {
-                               $job = $queue->pop();
-                       } catch ( JobQueueError $e ) {
-                               ++$failed;
-                               MWExceptionHandler::logException( $e );
-                               $job = false;
-                       }
-                       if ( $job ) {
-                               $job->metadata['QueuePartition'] = $partition;
-
-                               return $job;
-                       } else {
-                               unset( $partitionsTry[$partition] ); // blacklist partition
-                       }
-               }
-               $this->throwErrorIfAllPartitionsDown( $failed );
-
-               $this->cache->set( $key, 'true', JobQueueDB::CACHE_TTL_LONG );
-
-               return false;
-       }
-
-       protected function doAck( Job $job ) {
-               if ( !isset( $job->metadata['QueuePartition'] ) ) {
-                       throw new MWException( "The given job has no defined partition name." );
-               }
-
-               return $this->partitionQueues[$job->metadata['QueuePartition']]->ack( $job );
-       }
-
-       protected function doIsRootJobOldDuplicate( Job $job ) {
-               $params = $job->getRootJobParams();
-               $partitions = $this->partitionPushRing->getLocations( $params['rootJobSignature'], 2 );
-               try {
-                       return $this->partitionQueues[$partitions[0]]->doIsRootJobOldDuplicate( $job );
-               } catch ( JobQueueError $e ) {
-                       if ( isset( $partitions[1] ) ) { // check fallback partition
-                               return $this->partitionQueues[$partitions[1]]->doIsRootJobOldDuplicate( $job );
-                       }
-               }
-
-               return false;
-       }
-
-       protected function doDeduplicateRootJob( Job $job ) {
-               $params = $job->getRootJobParams();
-               $partitions = $this->partitionPushRing->getLocations( $params['rootJobSignature'], 2 );
-               try {
-                       return $this->partitionQueues[$partitions[0]]->doDeduplicateRootJob( $job );
-               } catch ( JobQueueError $e ) {
-                       if ( isset( $partitions[1] ) ) { // check fallback partition
-                               return $this->partitionQueues[$partitions[1]]->doDeduplicateRootJob( $job );
-                       }
-               }
-
-               return false;
-       }
-
-       protected function doDelete() {
-               $failed = 0;
-               /** @var JobQueue $queue */
-               foreach ( $this->partitionQueues as $queue ) {
-                       try {
-                               $queue->doDelete();
-                       } catch ( JobQueueError $e ) {
-                               ++$failed;
-                               MWExceptionHandler::logException( $e );
-                       }
-               }
-               $this->throwErrorIfAllPartitionsDown( $failed );
-               return true;
-       }
-
-       protected function doWaitForBackups() {
-               $failed = 0;
-               /** @var JobQueue $queue */
-               foreach ( $this->partitionQueues as $queue ) {
-                       try {
-                               $queue->waitForBackups();
-                       } catch ( JobQueueError $e ) {
-                               ++$failed;
-                               MWExceptionHandler::logException( $e );
-                       }
-               }
-               $this->throwErrorIfAllPartitionsDown( $failed );
-       }
-
-       protected function doGetPeriodicTasks() {
-               $tasks = array();
-               /** @var JobQueue $queue */
-               foreach ( $this->partitionQueues as $partition => $queue ) {
-                       foreach ( $queue->getPeriodicTasks() as $task => $def ) {
-                               $tasks["{$partition}:{$task}"] = $def;
-                       }
-               }
-
-               return $tasks;
-       }
-
-       protected function doFlushCaches() {
-               static $types = array(
-                       'empty',
-                       'size',
-                       'acquiredcount',
-                       'delayedcount',
-                       'abandonedcount'
-               );
-
-               foreach ( $types as $type ) {
-                       $this->cache->delete( $this->getCacheKey( $type ) );
-               }
-
-               /** @var JobQueue $queue */
-               foreach ( $this->partitionQueues as $queue ) {
-                       $queue->doFlushCaches();
-               }
-       }
-
-       public function getAllQueuedJobs() {
-               $iterator = new AppendIterator();
-
-               /** @var JobQueue $queue */
-               foreach ( $this->partitionQueues as $queue ) {
-                       $iterator->append( $queue->getAllQueuedJobs() );
-               }
-
-               return $iterator;
-       }
-
-       public function getAllDelayedJobs() {
-               $iterator = new AppendIterator();
-
-               /** @var JobQueue $queue */
-               foreach ( $this->partitionQueues as $queue ) {
-                       $iterator->append( $queue->getAllDelayedJobs() );
-               }
-
-               return $iterator;
-       }
-
-       public function getCoalesceLocationInternal() {
-               return "JobQueueFederated:wiki:{$this->wiki}" .
-                       sha1( serialize( array_keys( $this->partitionMap ) ) );
-       }
-
-       protected function doGetSiblingQueuesWithJobs( array $types ) {
-               $result = array();
-
-               $failed = 0;
-               /** @var JobQueue $queue */
-               foreach ( $this->partitionQueues as $queue ) {
-                       try {
-                               $nonEmpty = $queue->doGetSiblingQueuesWithJobs( $types );
-                               if ( is_array( $nonEmpty ) ) {
-                                       $result = array_unique( array_merge( $result, $nonEmpty ) );
-                               } else {
-                                       return null; // not supported on all partitions; bail
-                               }
-                               if ( count( $result ) == count( $types ) ) {
-                                       break; // short-circuit
-                               }
-                       } catch ( JobQueueError $e ) {
-                               ++$failed;
-                               MWExceptionHandler::logException( $e );
-                       }
-               }
-               $this->throwErrorIfAllPartitionsDown( $failed );
-
-               return array_values( $result );
-       }
-
-       protected function doGetSiblingQueueSizes( array $types ) {
-               $result = array();
-               $failed = 0;
-               /** @var JobQueue $queue */
-               foreach ( $this->partitionQueues as $queue ) {
-                       try {
-                               $sizes = $queue->doGetSiblingQueueSizes( $types );
-                               if ( is_array( $sizes ) ) {
-                                       foreach ( $sizes as $type => $size ) {
-                                               $result[$type] = isset( $result[$type] ) ? $result[$type] + $size : $size;
-                                       }
-                               } else {
-                                       return null; // not supported on all partitions; bail
-                               }
-                       } catch ( JobQueueError $e ) {
-                               ++$failed;
-                               MWExceptionHandler::logException( $e );
-                       }
-               }
-               $this->throwErrorIfAllPartitionsDown( $failed );
-
-               return $result;
-       }
-
-       /**
-        * Throw an error if no partitions available
-        *
-        * @param int $down The number of up partitions down
-        * @return void
-        * @throws JobQueueError
-        */
-       protected function throwErrorIfAllPartitionsDown( $down ) {
-               if ( $down >= count( $this->partitionQueues ) ) {
-                       throw new JobQueueError( 'No queue partitions available.' );
-               }
-       }
-
-       public function setTestingPrefix( $key ) {
-               /** @var JobQueue $queue */
-               foreach ( $this->partitionQueues as $queue ) {
-                       $queue->setTestingPrefix( $key );
-               }
-       }
-
-       /**
-        * @param $property
-        * @return string
-        */
-       private function getCacheKey( $property ) {
-               list( $db, $prefix ) = wfSplitWikiID( $this->wiki );
-
-               return wfForeignMemcKey( $db, $prefix, 'jobqueue', $this->type, $property );
-       }
-}
diff --git a/includes/job/JobQueueGroup.php b/includes/job/JobQueueGroup.php
deleted file mode 100644 (file)
index 90742ce..0000000
+++ /dev/null
@@ -1,417 +0,0 @@
-<?php
-/**
- * Job queue base code.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @author Aaron Schulz
- */
-
-/**
- * Class to handle enqueueing of background jobs
- *
- * @ingroup JobQueue
- * @since 1.21
- */
-class JobQueueGroup {
-       /** @var array */
-       protected static $instances = array();
-
-       /** @var ProcessCacheLRU */
-       protected $cache;
-
-       /** @var string Wiki ID */
-       protected $wiki;
-
-       /** @var array Map of (bucket => (queue => JobQueue, types => list of types) */
-       protected $coalescedQueues;
-
-       const TYPE_DEFAULT = 1; // integer; jobs popped by default
-       const TYPE_ANY = 2; // integer; any job
-
-       const USE_CACHE = 1; // integer; use process or persistent cache
-
-       const PROC_CACHE_TTL = 15; // integer; seconds
-
-       const CACHE_VERSION = 1; // integer; cache version
-
-       /**
-        * @param string $wiki Wiki ID
-        */
-       protected function __construct( $wiki ) {
-               $this->wiki = $wiki;
-               $this->cache = new ProcessCacheLRU( 10 );
-       }
-
-       /**
-        * @param bool|string $wiki Wiki ID
-        * @return JobQueueGroup
-        */
-       public static function singleton( $wiki = false ) {
-               $wiki = ( $wiki === false ) ? wfWikiID() : $wiki;
-               if ( !isset( self::$instances[$wiki] ) ) {
-                       self::$instances[$wiki] = new self( $wiki );
-               }
-
-               return self::$instances[$wiki];
-       }
-
-       /**
-        * Destroy the singleton instances
-        *
-        * @return void
-        */
-       public static function destroySingletons() {
-               self::$instances = array();
-       }
-
-       /**
-        * Get the job queue object for a given queue type
-        *
-        * @param string $type
-        * @return JobQueue
-        */
-       public function get( $type ) {
-               global $wgJobTypeConf;
-
-               $conf = array( 'wiki' => $this->wiki, 'type' => $type );
-               if ( isset( $wgJobTypeConf[$type] ) ) {
-                       $conf = $conf + $wgJobTypeConf[$type];
-               } else {
-                       $conf = $conf + $wgJobTypeConf['default'];
-               }
-
-               return JobQueue::factory( $conf );
-       }
-
-       /**
-        * Insert jobs into the respective queues of with the belong.
-        *
-        * This inserts the jobs into the queue specified by $wgJobTypeConf
-        * and updates the aggregate job queue information cache as needed.
-        *
-        * @param Job|array $jobs A single Job or a list of Jobs
-        * @throws MWException
-        * @return bool
-        */
-       public function push( $jobs ) {
-               $jobs = is_array( $jobs ) ? $jobs : array( $jobs );
-               if ( !count( $jobs ) ) {
-                       return true;
-               }
-
-               $jobsByType = array(); // (job type => list of jobs)
-               foreach ( $jobs as $job ) {
-                       if ( $job instanceof IJobSpecification ) {
-                               $jobsByType[$job->getType()][] = $job;
-                       } else {
-                               throw new MWException( "Attempted to push a non-Job object into a queue." );
-                       }
-               }
-
-               $ok = true;
-               foreach ( $jobsByType as $type => $jobs ) {
-                       if ( $this->get( $type )->push( $jobs ) ) {
-                               JobQueueAggregator::singleton()->notifyQueueNonEmpty( $this->wiki, $type );
-                       } else {
-                               $ok = false;
-                       }
-               }
-
-               if ( $this->cache->has( 'queues-ready', 'list' ) ) {
-                       $list = $this->cache->get( 'queues-ready', 'list' );
-                       if ( count( array_diff( array_keys( $jobsByType ), $list ) ) ) {
-                               $this->cache->clear( 'queues-ready' );
-                       }
-               }
-
-               return $ok;
-       }
-
-       /**
-        * Pop a job off one of the job queues
-        *
-        * This pops a job off a queue as specified by $wgJobTypeConf and
-        * updates the aggregate job queue information cache as needed.
-        *
-        * @param int|string $qtype JobQueueGroup::TYPE_* constant or job type string
-        * @param int $flags Bitfield of JobQueueGroup::USE_* constants
-        * @param array $blacklist List of job types to ignore
-        * @return Job|bool Returns false on failure
-        */
-       public function pop( $qtype = self::TYPE_DEFAULT, $flags = 0, array $blacklist = array() ) {
-               $job = false;
-
-               if ( is_string( $qtype ) ) { // specific job type
-                       if ( !in_array( $qtype, $blacklist ) ) {
-                               $job = $this->get( $qtype )->pop();
-                               if ( !$job ) {
-                                       JobQueueAggregator::singleton()->notifyQueueEmpty( $this->wiki, $qtype );
-                               }
-                       }
-               } else { // any job in the "default" jobs types
-                       if ( $flags & self::USE_CACHE ) {
-                               if ( !$this->cache->has( 'queues-ready', 'list', self::PROC_CACHE_TTL ) ) {
-                                       $this->cache->set( 'queues-ready', 'list', $this->getQueuesWithJobs() );
-                               }
-                               $types = $this->cache->get( 'queues-ready', 'list' );
-                       } else {
-                               $types = $this->getQueuesWithJobs();
-                       }
-
-                       if ( $qtype == self::TYPE_DEFAULT ) {
-                               $types = array_intersect( $types, $this->getDefaultQueueTypes() );
-                       }
-
-                       $types = array_diff( $types, $blacklist ); // avoid selected types
-                       shuffle( $types ); // avoid starvation
-
-                       foreach ( $types as $type ) { // for each queue...
-                               $job = $this->get( $type )->pop();
-                               if ( $job ) { // found
-                                       break;
-                               } else { // not found
-                                       JobQueueAggregator::singleton()->notifyQueueEmpty( $this->wiki, $type );
-                                       $this->cache->clear( 'queues-ready' );
-                               }
-                       }
-               }
-
-               return $job;
-       }
-
-       /**
-        * Acknowledge that a job was completed
-        *
-        * @param Job $job
-        * @return bool
-        */
-       public function ack( Job $job ) {
-               return $this->get( $job->getType() )->ack( $job );
-       }
-
-       /**
-        * Register the "root job" of a given job into the queue for de-duplication.
-        * This should only be called right *after* all the new jobs have been inserted.
-        *
-        * @param Job $job
-        * @return bool
-        */
-       public function deduplicateRootJob( Job $job ) {
-               return $this->get( $job->getType() )->deduplicateRootJob( $job );
-       }
-
-       /**
-        * Wait for any slaves or backup queue servers to catch up.
-        *
-        * This does nothing for certain queue classes.
-        *
-        * @return void
-        * @throws MWException
-        */
-       public function waitForBackups() {
-               global $wgJobTypeConf;
-
-               wfProfileIn( __METHOD__ );
-               // Try to avoid doing this more than once per queue storage medium
-               foreach ( $wgJobTypeConf as $type => $conf ) {
-                       $this->get( $type )->waitForBackups();
-               }
-               wfProfileOut( __METHOD__ );
-       }
-
-       /**
-        * Get the list of queue types
-        *
-        * @return array List of strings
-        */
-       public function getQueueTypes() {
-               return array_keys( $this->getCachedConfigVar( 'wgJobClasses' ) );
-       }
-
-       /**
-        * Get the list of default queue types
-        *
-        * @return array List of strings
-        */
-       public function getDefaultQueueTypes() {
-               global $wgJobTypesExcludedFromDefaultQueue;
-
-               return array_diff( $this->getQueueTypes(), $wgJobTypesExcludedFromDefaultQueue );
-       }
-
-       /**
-        * Get the list of job types that have non-empty queues
-        *
-        * @return array List of job types that have non-empty queues
-        */
-       public function getQueuesWithJobs() {
-               $types = array();
-               foreach ( $this->getCoalescedQueues() as $info ) {
-                       $nonEmpty = $info['queue']->getSiblingQueuesWithJobs( $this->getQueueTypes() );
-                       if ( is_array( $nonEmpty ) ) { // batching features supported
-                               $types = array_merge( $types, $nonEmpty );
-                       } else { // we have to go through the queues in the bucket one-by-one
-                               foreach ( $info['types'] as $type ) {
-                                       if ( !$this->get( $type )->isEmpty() ) {
-                                               $types[] = $type;
-                                       }
-                               }
-                       }
-               }
-
-               return $types;
-       }
-
-       /**
-        * Get the size of the queus for a list of job types
-        *
-        * @return array Map of (job type => size)
-        */
-       public function getQueueSizes() {
-               $sizeMap = array();
-               foreach ( $this->getCoalescedQueues() as $info ) {
-                       $sizes = $info['queue']->getSiblingQueueSizes( $this->getQueueTypes() );
-                       if ( is_array( $sizes ) ) { // batching features supported
-                               $sizeMap = $sizeMap + $sizes;
-                       } else { // we have to go through the queues in the bucket one-by-one
-                               foreach ( $info['types'] as $type ) {
-                                       $sizeMap[$type] = $this->get( $type )->getSize();
-                               }
-                       }
-               }
-
-               return $sizeMap;
-       }
-
-       /**
-        * @return array
-        */
-       protected function getCoalescedQueues() {
-               global $wgJobTypeConf;
-
-               if ( $this->coalescedQueues === null ) {
-                       $this->coalescedQueues = array();
-                       foreach ( $wgJobTypeConf as $type => $conf ) {
-                               $queue = JobQueue::factory(
-                                       array( 'wiki' => $this->wiki, 'type' => 'null' ) + $conf );
-                               $loc = $queue->getCoalesceLocationInternal();
-                               if ( !isset( $this->coalescedQueues[$loc] ) ) {
-                                       $this->coalescedQueues[$loc]['queue'] = $queue;
-                                       $this->coalescedQueues[$loc]['types'] = array();
-                               }
-                               if ( $type === 'default' ) {
-                                       $this->coalescedQueues[$loc]['types'] = array_merge(
-                                               $this->coalescedQueues[$loc]['types'],
-                                               array_diff( $this->getQueueTypes(), array_keys( $wgJobTypeConf ) )
-                                       );
-                               } else {
-                                       $this->coalescedQueues[$loc]['types'][] = $type;
-                               }
-                       }
-               }
-
-               return $this->coalescedQueues;
-       }
-
-       /**
-        * Execute any due periodic queue maintenance tasks for all queues.
-        *
-        * A task is "due" if the time ellapsed since the last run is greater than
-        * the defined run period. Concurrent calls to this function will cause tasks
-        * to be attempted twice, so they may need their own methods of mutual exclusion.
-        *
-        * @return int Number of tasks run
-        */
-       public function executeReadyPeriodicTasks() {
-               global $wgMemc;
-
-               list( $db, $prefix ) = wfSplitWikiID( $this->wiki );
-               $key = wfForeignMemcKey( $db, $prefix, 'jobqueuegroup', 'taskruns', 'v1' );
-               $lastRuns = $wgMemc->get( $key ); // (queue => task => UNIX timestamp)
-
-               $count = 0;
-               $tasksRun = array(); // (queue => task => UNIX timestamp)
-               foreach ( $this->getQueueTypes() as $type ) {
-                       $queue = $this->get( $type );
-                       foreach ( $queue->getPeriodicTasks() as $task => $definition ) {
-                               if ( $definition['period'] <= 0 ) {
-                                       continue; // disabled
-                               } elseif ( !isset( $lastRuns[$type][$task] )
-                                       || $lastRuns[$type][$task] < ( time() - $definition['period'] )
-                               ) {
-                                       try {
-                                               if ( call_user_func( $definition['callback'] ) !== null ) {
-                                                       $tasksRun[$type][$task] = time();
-                                                       ++$count;
-                                               }
-                                       } catch ( JobQueueError $e ) {
-                                               MWExceptionHandler::logException( $e );
-                                       }
-                               }
-                       }
-                       // The tasks may have recycled jobs or release delayed jobs into the queue
-                       if ( isset( $tasksRun[$type] ) && !$queue->isEmpty() ) {
-                               JobQueueAggregator::singleton()->notifyQueueNonEmpty( $this->wiki, $type );
-                       }
-               }
-
-               $wgMemc->merge( $key, function ( $cache, $key, $lastRuns ) use ( $tasksRun ) {
-                       if ( is_array( $lastRuns ) ) {
-                               foreach ( $tasksRun as $type => $tasks ) {
-                                       foreach ( $tasks as $task => $timestamp ) {
-                                               if ( !isset( $lastRuns[$type][$task] )
-                                                       || $timestamp > $lastRuns[$type][$task]
-                                               ) {
-                                                       $lastRuns[$type][$task] = $timestamp;
-                                               }
-                                       }
-                               }
-                       } else {
-                               $lastRuns = $tasksRun;
-                       }
-
-                       return $lastRuns;
-               } );
-
-               return $count;
-       }
-
-       /**
-        * @param $name string
-        * @return mixed
-        */
-       private function getCachedConfigVar( $name ) {
-               global $wgConf, $wgMemc;
-
-               if ( $this->wiki === wfWikiID() ) {
-                       return $GLOBALS[$name]; // common case
-               } else {
-                       list( $db, $prefix ) = wfSplitWikiID( $this->wiki );
-                       $key = wfForeignMemcKey( $db, $prefix, 'configvalue', $name );
-                       $value = $wgMemc->get( $key ); // ('v' => ...) or false
-                       if ( is_array( $value ) ) {
-                               return $value['v'];
-                       } else {
-                               $value = $wgConf->getConfig( $this->wiki, $name );
-                               $wgMemc->set( $key, array( 'v' => $value ), 86400 + mt_rand( 0, 86400 ) );
-
-                               return $value;
-                       }
-               }
-       }
-}
diff --git a/includes/job/JobQueueRedis.php b/includes/job/JobQueueRedis.php
deleted file mode 100644 (file)
index c785cb2..0000000
+++ /dev/null
@@ -1,874 +0,0 @@
-<?php
-/**
- * Redis-backed job queue code.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @author Aaron Schulz
- */
-
-/**
- * Class to handle job queues stored in Redis
- *
- * This is faster, less resource intensive, queue that JobQueueDB.
- * All data for a queue using this class is placed into one redis server.
- *
- * There are eight main redis keys used to track jobs:
- *   - l-unclaimed  : A list of job IDs used for ready unclaimed jobs
- *   - z-claimed    : A sorted set of (job ID, UNIX timestamp as score) used for job retries
- *   - z-abandoned  : A sorted set of (job ID, UNIX timestamp as score) used for broken jobs
- *   - z-delayed    : A sorted set of (job ID, UNIX timestamp as score) used for delayed jobs
- *   - h-idBySha1   : A hash of (SHA1 => job ID) for unclaimed jobs used for de-duplication
- *   - h-sha1ById   : A hash of (job ID => SHA1) for unclaimed jobs used for de-duplication
- *   - h-attempts   : A hash of (job ID => attempt count) used for job claiming/retries
- *   - h-data       : A hash of (job ID => serialized blobs) for job storage
- * A job ID can be in only one of z-delayed, l-unclaimed, z-claimed, and z-abandoned.
- * If an ID appears in any of those lists, it should have a h-data entry for its ID.
- * If a job has a SHA1 de-duplication value and its ID is in l-unclaimed or z-delayed, then
- * there should be no other such jobs with that SHA1. Every h-idBySha1 entry has an h-sha1ById
- * entry and every h-sha1ById must refer to an ID that is l-unclaimed. If a job has its
- * ID in z-claimed or z-abandoned, then it must also have an h-attempts entry for its ID.
- *
- * Additionally, "rootjob:* keys track "root jobs" used for additional de-duplication.
- * Aside from root job keys, all keys have no expiry, and are only removed when jobs are run.
- * All the keys are prefixed with the relevant wiki ID information.
- *
- * This class requires Redis 2.6 as it makes use Lua scripts for fast atomic operations.
- * Additionally, it should be noted that redis has different persistence modes, such
- * as rdb snapshots, journaling, and no persistent. Appropriate configuration should be
- * made on the servers based on what queues are using it and what tolerance they have.
- *
- * @ingroup JobQueue
- * @ingroup Redis
- * @since 1.22
- */
-class JobQueueRedis extends JobQueue {
-       /** @var RedisConnectionPool */
-       protected $redisPool;
-
-       /** @var string Server address */
-       protected $server;
-
-       /** @var string Compression method to use */
-       protected $compression;
-
-       const MAX_AGE_PRUNE = 604800; // integer; seconds a job can live once claimed (7 days)
-
-       /** @var string Key to prefix the queue keys with (used for testing) */
-       protected $key;
-
-       /**
-        * @var null|int maximum seconds between execution of periodic tasks.  Used to speed up
-        * testing but should otherwise be left unset.
-        */
-       protected $maximumPeriodicTaskSeconds;
-
-       /**
-        * @params include:
-        *   - redisConfig : An array of parameters to RedisConnectionPool::__construct().
-        *                   Note that the serializer option is ignored as "none" is always used.
-        *   - redisServer : A hostname/port combination or the absolute path of a UNIX socket.
-        *                   If a hostname is specified but no port, the standard port number
-        *                   6379 will be used. Required.
-        *   - compression : The type of compression to use; one of (none,gzip).
-        *   - maximumPeriodicTaskSeconds : Maximum seconds between check periodic tasks.  Set to
-        *                   force faster execution of periodic tasks for inegration tests that
-        *                   rely on checkDelay.  Without this the integration tests are very very
-        *                   slow.  This really shouldn't be set in production.
-        * @param array $params
-        */
-       public function __construct( array $params ) {
-               parent::__construct( $params );
-               $params['redisConfig']['serializer'] = 'none'; // make it easy to use Lua
-               $this->server = $params['redisServer'];
-               $this->compression = isset( $params['compression'] ) ? $params['compression'] : 'none';
-               $this->redisPool = RedisConnectionPool::singleton( $params['redisConfig'] );
-               $this->maximumPeriodicTaskSeconds = isset( $params['maximumPeriodicTaskSeconds'] ) ?
-                       $params['maximumPeriodicTaskSeconds'] : null;
-       }
-
-       protected function supportedOrders() {
-               return array( 'timestamp', 'fifo' );
-       }
-
-       protected function optimalOrder() {
-               return 'fifo';
-       }
-
-       protected function supportsDelayedJobs() {
-               return true;
-       }
-
-       /**
-        * @see JobQueue::doIsEmpty()
-        * @return bool
-        * @throws MWException
-        */
-       protected function doIsEmpty() {
-               return $this->doGetSize() == 0;
-       }
-
-       /**
-        * @see JobQueue::doGetSize()
-        * @return int
-        * @throws MWException
-        */
-       protected function doGetSize() {
-               $conn = $this->getConnection();
-               try {
-                       return $conn->lSize( $this->getQueueKey( 'l-unclaimed' ) );
-               } catch ( RedisException $e ) {
-                       $this->throwRedisException( $conn, $e );
-               }
-       }
-
-       /**
-        * @see JobQueue::doGetAcquiredCount()
-        * @return int
-        * @throws JobQueueError
-        */
-       protected function doGetAcquiredCount() {
-               if ( $this->claimTTL <= 0 ) {
-                       return 0; // no acknowledgements
-               }
-               $conn = $this->getConnection();
-               try {
-                       $conn->multi( Redis::PIPELINE );
-                       $conn->zSize( $this->getQueueKey( 'z-claimed' ) );
-                       $conn->zSize( $this->getQueueKey( 'z-abandoned' ) );
-
-                       return array_sum( $conn->exec() );
-               } catch ( RedisException $e ) {
-                       $this->throwRedisException( $conn, $e );
-               }
-       }
-
-       /**
-        * @see JobQueue::doGetDelayedCount()
-        * @return int
-        * @throws JobQueueError
-        */
-       protected function doGetDelayedCount() {
-               if ( !$this->checkDelay ) {
-                       return 0; // no delayed jobs
-               }
-               $conn = $this->getConnection();
-               try {
-                       return $conn->zSize( $this->getQueueKey( 'z-delayed' ) );
-               } catch ( RedisException $e ) {
-                       $this->throwRedisException( $conn, $e );
-               }
-       }
-
-       /**
-        * @see JobQueue::doGetAbandonedCount()
-        * @return int
-        * @throws JobQueueError
-        */
-       protected function doGetAbandonedCount() {
-               if ( $this->claimTTL <= 0 ) {
-                       return 0; // no acknowledgements
-               }
-               $conn = $this->getConnection();
-               try {
-                       return $conn->zSize( $this->getQueueKey( 'z-abandoned' ) );
-               } catch ( RedisException $e ) {
-                       $this->throwRedisException( $conn, $e );
-               }
-       }
-
-       /**
-        * @see JobQueue::doBatchPush()
-        * @param array $jobs
-        * @param $flags
-        * @return bool
-        * @throws JobQueueError
-        */
-       protected function doBatchPush( array $jobs, $flags ) {
-               // Convert the jobs into field maps (de-duplicated against each other)
-               $items = array(); // (job ID => job fields map)
-               foreach ( $jobs as $job ) {
-                       $item = $this->getNewJobFields( $job );
-                       if ( strlen( $item['sha1'] ) ) { // hash identifier => de-duplicate
-                               $items[$item['sha1']] = $item;
-                       } else {
-                               $items[$item['uuid']] = $item;
-                       }
-               }
-
-               if ( !count( $items ) ) {
-                       return true; // nothing to do
-               }
-
-               $conn = $this->getConnection();
-               try {
-                       // Actually push the non-duplicate jobs into the queue...
-                       if ( $flags & self::QOS_ATOMIC ) {
-                               $batches = array( $items ); // all or nothing
-                       } else {
-                               $batches = array_chunk( $items, 500 ); // avoid tying up the server
-                       }
-                       $failed = 0;
-                       $pushed = 0;
-                       foreach ( $batches as $itemBatch ) {
-                               $added = $this->pushBlobs( $conn, $itemBatch );
-                               if ( is_int( $added ) ) {
-                                       $pushed += $added;
-                               } else {
-                                       $failed += count( $itemBatch );
-                               }
-                       }
-                       if ( $failed > 0 ) {
-                               wfDebugLog( 'JobQueueRedis', "Could not insert {$failed} {$this->type} job(s)." );
-
-                               return false;
-                       }
-                       JobQueue::incrStats( 'job-insert', $this->type, count( $items ) );
-                       JobQueue::incrStats( 'job-insert-duplicate', $this->type,
-                               count( $items ) - $failed - $pushed );
-               } catch ( RedisException $e ) {
-                       $this->throwRedisException( $conn, $e );
-               }
-
-               return true;
-       }
-
-       /**
-        * @param RedisConnRef $conn
-        * @param array $items List of results from JobQueueRedis::getNewJobFields()
-        * @return int Number of jobs inserted (duplicates are ignored)
-        * @throws RedisException
-        */
-       protected function pushBlobs( RedisConnRef $conn, array $items ) {
-               $args = array(); // ([id, sha1, rtime, blob [, id, sha1, rtime, blob ... ] ] )
-               foreach ( $items as $item ) {
-                       $args[] = (string)$item['uuid'];
-                       $args[] = (string)$item['sha1'];
-                       $args[] = (string)$item['rtimestamp'];
-                       $args[] = (string)$this->serialize( $item );
-               }
-               static $script =
-<<<LUA
-               local kUnclaimed, kSha1ById, kIdBySha1, kDelayed, kData = unpack(KEYS)
-               if #ARGV % 4 ~= 0 then return redis.error_reply('Unmatched arguments') end
-               local pushed = 0
-               for i = 1,#ARGV,4 do
-                       local id,sha1,rtimestamp,blob = ARGV[i],ARGV[i+1],ARGV[i+2],ARGV[i+3]
-                       if sha1 == '' or redis.call('hExists',kIdBySha1,sha1) == 0 then
-                               if 1*rtimestamp > 0 then
-                                       -- Insert into delayed queue (release time as score)
-                                       redis.call('zAdd',kDelayed,rtimestamp,id)
-                               else
-                                       -- Insert into unclaimed queue
-                                       redis.call('lPush',kUnclaimed,id)
-                               end
-                               if sha1 ~= '' then
-                                       redis.call('hSet',kSha1ById,id,sha1)
-                                       redis.call('hSet',kIdBySha1,sha1,id)
-                               end
-                               redis.call('hSet',kData,id,blob)
-                               pushed = pushed + 1
-                       end
-               end
-               return pushed
-LUA;
-               return $conn->luaEval( $script,
-                       array_merge(
-                               array(
-                                       $this->getQueueKey( 'l-unclaimed' ), # KEYS[1]
-                                       $this->getQueueKey( 'h-sha1ById' ), # KEYS[2]
-                                       $this->getQueueKey( 'h-idBySha1' ), # KEYS[3]
-                                       $this->getQueueKey( 'z-delayed' ), # KEYS[4]
-                                       $this->getQueueKey( 'h-data' ), # KEYS[5]
-                               ),
-                               $args
-                       ),
-                       5 # number of first argument(s) that are keys
-               );
-       }
-
-       /**
-        * @see JobQueue::doPop()
-        * @return Job|bool
-        * @throws JobQueueError
-        */
-       protected function doPop() {
-               $job = false;
-
-               // Push ready delayed jobs into the queue every 10 jobs to spread the load.
-               // This is also done as a periodic task, but we don't want too much done at once.
-               if ( $this->checkDelay && mt_rand( 0, 9 ) == 0 ) {
-                       $this->recyclePruneAndUndelayJobs();
-               }
-
-               $conn = $this->getConnection();
-               try {
-                       do {
-                               if ( $this->claimTTL > 0 ) {
-                                       // Keep the claimed job list down for high-traffic queues
-                                       if ( mt_rand( 0, 99 ) == 0 ) {
-                                               $this->recyclePruneAndUndelayJobs();
-                                       }
-                                       $blob = $this->popAndAcquireBlob( $conn );
-                               } else {
-                                       $blob = $this->popAndDeleteBlob( $conn );
-                               }
-                               if ( $blob === false ) {
-                                       break; // no jobs; nothing to do
-                               }
-
-                               JobQueue::incrStats( 'job-pop', $this->type );
-                               $item = $this->unserialize( $blob );
-                               if ( $item === false ) {
-                                       wfDebugLog( 'JobQueueRedis', "Could not unserialize {$this->type} job." );
-                                       continue;
-                               }
-
-                               // If $item is invalid, recyclePruneAndUndelayJobs() will cleanup as needed
-                               $job = $this->getJobFromFields( $item ); // may be false
-                       } while ( !$job ); // job may be false if invalid
-               } catch ( RedisException $e ) {
-                       $this->throwRedisException( $conn, $e );
-               }
-
-               return $job;
-       }
-
-       /**
-        * @param RedisConnRef $conn
-        * @return array serialized string or false
-        * @throws RedisException
-        */
-       protected function popAndDeleteBlob( RedisConnRef $conn ) {
-               static $script =
-<<<LUA
-               local kUnclaimed, kSha1ById, kIdBySha1, kData = unpack(KEYS)
-               -- Pop an item off the queue
-               local id = redis.call('rpop',kUnclaimed)
-               if not id then return false end
-               -- Get the job data and remove it
-               local item = redis.call('hGet',kData,id)
-               redis.call('hDel',kData,id)
-               -- Allow new duplicates of this job
-               local sha1 = redis.call('hGet',kSha1ById,id)
-               if sha1 then redis.call('hDel',kIdBySha1,sha1) end
-               redis.call('hDel',kSha1ById,id)
-               -- Return the job data
-               return item
-LUA;
-               return $conn->luaEval( $script,
-                       array(
-                               $this->getQueueKey( 'l-unclaimed' ), # KEYS[1]
-                               $this->getQueueKey( 'h-sha1ById' ), # KEYS[2]
-                               $this->getQueueKey( 'h-idBySha1' ), # KEYS[3]
-                               $this->getQueueKey( 'h-data' ), # KEYS[4]
-                       ),
-                       4 # number of first argument(s) that are keys
-               );
-       }
-
-       /**
-        * @param RedisConnRef $conn
-        * @return array serialized string or false
-        * @throws RedisException
-        */
-       protected function popAndAcquireBlob( RedisConnRef $conn ) {
-               static $script =
-<<<LUA
-               local kUnclaimed, kSha1ById, kIdBySha1, kClaimed, kAttempts, kData = unpack(KEYS)
-               -- Pop an item off the queue
-               local id = redis.call('rPop',kUnclaimed)
-               if not id then return false end
-               -- Allow new duplicates of this job
-               local sha1 = redis.call('hGet',kSha1ById,id)
-               if sha1 then redis.call('hDel',kIdBySha1,sha1) end
-               redis.call('hDel',kSha1ById,id)
-               -- Mark the jobs as claimed and return it
-               redis.call('zAdd',kClaimed,ARGV[1],id)
-               redis.call('hIncrBy',kAttempts,id,1)
-               return redis.call('hGet',kData,id)
-LUA;
-               return $conn->luaEval( $script,
-                       array(
-                               $this->getQueueKey( 'l-unclaimed' ), # KEYS[1]
-                               $this->getQueueKey( 'h-sha1ById' ), # KEYS[2]
-                               $this->getQueueKey( 'h-idBySha1' ), # KEYS[3]
-                               $this->getQueueKey( 'z-claimed' ), # KEYS[4]
-                               $this->getQueueKey( 'h-attempts' ), # KEYS[5]
-                               $this->getQueueKey( 'h-data' ), # KEYS[6]
-                               time(), # ARGV[1] (injected to be replication-safe)
-                       ),
-                       6 # number of first argument(s) that are keys
-               );
-       }
-
-       /**
-        * @see JobQueue::doAck()
-        * @param Job $job
-        * @return Job|bool
-        * @throws MWException|JobQueueError
-        */
-       protected function doAck( Job $job ) {
-               if ( !isset( $job->metadata['uuid'] ) ) {
-                       throw new MWException( "Job of type '{$job->getType()}' has no UUID." );
-               }
-               if ( $this->claimTTL > 0 ) {
-                       $conn = $this->getConnection();
-                       try {
-                               static $script =
-<<<LUA
-                               local kClaimed, kAttempts, kData = unpack(KEYS)
-                               -- Unmark the job as claimed
-                               redis.call('zRem',kClaimed,ARGV[1])
-                               redis.call('hDel',kAttempts,ARGV[1])
-                               -- Delete the job data itself
-                               return redis.call('hDel',kData,ARGV[1])
-LUA;
-                               $res = $conn->luaEval( $script,
-                                       array(
-                                               $this->getQueueKey( 'z-claimed' ), # KEYS[1]
-                                               $this->getQueueKey( 'h-attempts' ), # KEYS[2]
-                                               $this->getQueueKey( 'h-data' ), # KEYS[3]
-                                               $job->metadata['uuid'] # ARGV[1]
-                                       ),
-                                       3 # number of first argument(s) that are keys
-                               );
-
-                               if ( !$res ) {
-                                       wfDebugLog( 'JobQueueRedis', "Could not acknowledge {$this->type} job." );
-
-                                       return false;
-                               }
-                       } catch ( RedisException $e ) {
-                               $this->throwRedisException( $conn, $e );
-                       }
-               }
-
-               return true;
-       }
-
-       /**
-        * @see JobQueue::doDeduplicateRootJob()
-        * @param Job $job
-        * @return bool
-        * @throws MWException|JobQueueError
-        */
-       protected function doDeduplicateRootJob( Job $job ) {
-               if ( !$job->hasRootJobParams() ) {
-                       throw new MWException( "Cannot register root job; missing parameters." );
-               }
-               $params = $job->getRootJobParams();
-
-               $key = $this->getRootJobCacheKey( $params['rootJobSignature'] );
-
-               $conn = $this->getConnection();
-               try {
-                       $timestamp = $conn->get( $key ); // current last timestamp of this job
-                       if ( $timestamp && $timestamp >= $params['rootJobTimestamp'] ) {
-                               return true; // a newer version of this root job was enqueued
-                       }
-
-                       // Update the timestamp of the last root job started at the location...
-                       return $conn->set( $key, $params['rootJobTimestamp'], self::ROOTJOB_TTL ); // 2 weeks
-               } catch ( RedisException $e ) {
-                       $this->throwRedisException( $conn, $e );
-               }
-       }
-
-       /**
-        * @see JobQueue::doIsRootJobOldDuplicate()
-        * @param Job $job
-        * @return bool
-        * @throws JobQueueError
-        */
-       protected function doIsRootJobOldDuplicate( Job $job ) {
-               if ( !$job->hasRootJobParams() ) {
-                       return false; // job has no de-deplication info
-               }
-               $params = $job->getRootJobParams();
-
-               $conn = $this->getConnection();
-               try {
-                       // Get the last time this root job was enqueued
-                       $timestamp = $conn->get( $this->getRootJobCacheKey( $params['rootJobSignature'] ) );
-               } catch ( RedisException $e ) {
-                       $this->throwRedisException( $conn, $e );
-               }
-
-               // Check if a new root job was started at the location after this one's...
-               return ( $timestamp && $timestamp > $params['rootJobTimestamp'] );
-       }
-
-       /**
-        * @see JobQueue::doDelete()
-        * @return bool
-        * @throws JobQueueError
-        */
-       protected function doDelete() {
-               static $props = array( 'l-unclaimed', 'z-claimed', 'z-abandoned',
-                       'z-delayed', 'h-idBySha1', 'h-sha1ById', 'h-attempts', 'h-data' );
-
-               $conn = $this->getConnection();
-               try {
-                       $keys = array();
-                       foreach ( $props as $prop ) {
-                               $keys[] = $this->getQueueKey( $prop );
-                       }
-
-                       return ( $conn->delete( $keys ) !== false );
-               } catch ( RedisException $e ) {
-                       $this->throwRedisException( $conn, $e );
-               }
-       }
-
-       /**
-        * @see JobQueue::getAllQueuedJobs()
-        * @return Iterator
-        */
-       public function getAllQueuedJobs() {
-               $conn = $this->getConnection();
-               try {
-                       $that = $this;
-
-                       return new MappedIterator(
-                               $conn->lRange( $this->getQueueKey( 'l-unclaimed' ), 0, -1 ),
-                               function ( $uid ) use ( $that, $conn ) {
-                                       return $that->getJobFromUidInternal( $uid, $conn );
-                               },
-                               array( 'accept' => function ( $job ) {
-                                       return is_object( $job );
-                               } )
-                       );
-               } catch ( RedisException $e ) {
-                       $this->throwRedisException( $conn, $e );
-               }
-       }
-
-       /**
-        * @see JobQueue::getAllQueuedJobs()
-        * @return Iterator
-        */
-       public function getAllDelayedJobs() {
-               $conn = $this->getConnection();
-               try {
-                       $that = $this;
-
-                       return new MappedIterator( // delayed jobs
-                               $conn->zRange( $this->getQueueKey( 'z-delayed' ), 0, -1 ),
-                               function ( $uid ) use ( $that, $conn ) {
-                                       return $that->getJobFromUidInternal( $uid, $conn );
-                               },
-                               array( 'accept' => function ( $job ) {
-                                       return is_object( $job );
-                               } )
-                       );
-               } catch ( RedisException $e ) {
-                       $this->throwRedisException( $conn, $e );
-               }
-       }
-
-       public function getCoalesceLocationInternal() {
-               return "RedisServer:" . $this->server;
-       }
-
-       protected function doGetSiblingQueuesWithJobs( array $types ) {
-               return array_keys( array_filter( $this->doGetSiblingQueueSizes( $types ) ) );
-       }
-
-       protected function doGetSiblingQueueSizes( array $types ) {
-               $sizes = array(); // (type => size)
-               $types = array_values( $types ); // reindex
-               $conn = $this->getConnection();
-               try {
-                       $conn->multi( Redis::PIPELINE );
-                       foreach ( $types as $type ) {
-                               $conn->lSize( $this->getQueueKey( 'l-unclaimed', $type ) );
-                       }
-                       $res = $conn->exec();
-                       if ( is_array( $res ) ) {
-                               foreach ( $res as $i => $size ) {
-                                       $sizes[$types[$i]] = $size;
-                               }
-                       }
-               } catch ( RedisException $e ) {
-                       $this->throwRedisException( $conn, $e );
-               }
-
-               return $sizes;
-       }
-
-       /**
-        * This function should not be called outside JobQueueRedis
-        *
-        * @param $uid string
-        * @param $conn RedisConnRef
-        * @return Job|bool Returns false if the job does not exist
-        * @throws MWException|JobQueueError
-        */
-       public function getJobFromUidInternal( $uid, RedisConnRef $conn ) {
-               try {
-                       $data = $conn->hGet( $this->getQueueKey( 'h-data' ), $uid );
-                       if ( $data === false ) {
-                               return false; // not found
-                       }
-                       $item = $this->unserialize( $conn->hGet( $this->getQueueKey( 'h-data' ), $uid ) );
-                       if ( !is_array( $item ) ) { // this shouldn't happen
-                               throw new MWException( "Could not find job with ID '$uid'." );
-                       }
-                       $title = Title::makeTitle( $item['namespace'], $item['title'] );
-                       $job = Job::factory( $item['type'], $title, $item['params'] );
-                       $job->metadata['uuid'] = $item['uuid'];
-
-                       return $job;
-               } catch ( RedisException $e ) {
-                       $this->throwRedisException( $conn, $e );
-               }
-       }
-
-       /**
-        * Recycle or destroy any jobs that have been claimed for too long
-        * and release any ready delayed jobs into the queue
-        *
-        * @return int Number of jobs recycled/deleted/undelayed
-        * @throws MWException|JobQueueError
-        */
-       public function recyclePruneAndUndelayJobs() {
-               $count = 0;
-               // For each job item that can be retried, we need to add it back to the
-               // main queue and remove it from the list of currenty claimed job items.
-               // For those that cannot, they are marked as dead and kept around for
-               // investigation and manual job restoration but are eventually deleted.
-               $conn = $this->getConnection();
-               try {
-                       $now = time();
-                       static $script =
-<<<LUA
-                       local kClaimed, kAttempts, kUnclaimed, kData, kAbandoned, kDelayed = unpack(KEYS)
-                       local released,abandoned,pruned,undelayed = 0,0,0,0
-                       -- Get all non-dead jobs that have an expired claim on them.
-                       -- The score for each item is the last claim timestamp (UNIX).
-                       local staleClaims = redis.call('zRangeByScore',kClaimed,0,ARGV[1])
-                       for k,id in ipairs(staleClaims) do
-                               local timestamp = redis.call('zScore',kClaimed,id)
-                               local attempts = redis.call('hGet',kAttempts,id)
-                               if attempts < ARGV[3] then
-                                       -- Claim expired and retries left: re-enqueue the job
-                                       redis.call('lPush',kUnclaimed,id)
-                                       redis.call('hIncrBy',kAttempts,id,1)
-                                       released = released + 1
-                               else
-                                       -- Claim expired and no retries left: mark the job as dead
-                                       redis.call('zAdd',kAbandoned,timestamp,id)
-                                       abandoned = abandoned + 1
-                               end
-                               redis.call('zRem',kClaimed,id)
-                       end
-                       -- Get all of the dead jobs that have been marked as dead for too long.
-                       -- The score for each item is the last claim timestamp (UNIX).
-                       local deadClaims = redis.call('zRangeByScore',kAbandoned,0,ARGV[2])
-                       for k,id in ipairs(deadClaims) do
-                               -- Stale and out of retries: remove any traces of the job
-                               redis.call('zRem',kAbandoned,id)
-                               redis.call('hDel',kAttempts,id)
-                               redis.call('hDel',kData,id)
-                               pruned = pruned + 1
-                       end
-                       -- Get the list of ready delayed jobs, sorted by readiness (UNIX timestamp)
-                       local ids = redis.call('zRangeByScore',kDelayed,0,ARGV[4])
-                       -- Migrate the jobs from the "delayed" set to the "unclaimed" list
-                       for k,id in ipairs(ids) do
-                               redis.call('lPush',kUnclaimed,id)
-                               redis.call('zRem',kDelayed,id)
-                       end
-                       undelayed = #ids
-                       return {released,abandoned,pruned,undelayed}
-LUA;
-                       $res = $conn->luaEval( $script,
-                               array(
-                                       $this->getQueueKey( 'z-claimed' ), # KEYS[1]
-                                       $this->getQueueKey( 'h-attempts' ), # KEYS[2]
-                                       $this->getQueueKey( 'l-unclaimed' ), # KEYS[3]
-                                       $this->getQueueKey( 'h-data' ), # KEYS[4]
-                                       $this->getQueueKey( 'z-abandoned' ), # KEYS[5]
-                                       $this->getQueueKey( 'z-delayed' ), # KEYS[6]
-                                       $now - $this->claimTTL, # ARGV[1]
-                                       $now - self::MAX_AGE_PRUNE, # ARGV[2]
-                                       $this->maxTries, # ARGV[3]
-                                       $now # ARGV[4]
-                               ),
-                               6 # number of first argument(s) that are keys
-                       );
-                       if ( $res ) {
-                               list( $released, $abandoned, $pruned, $undelayed ) = $res;
-                               $count += $released + $pruned + $undelayed;
-                               JobQueue::incrStats( 'job-recycle', $this->type, $released );
-                               JobQueue::incrStats( 'job-abandon', $this->type, $abandoned );
-                       }
-               } catch ( RedisException $e ) {
-                       $this->throwRedisException( $conn, $e );
-               }
-
-               return $count;
-       }
-
-       /**
-        * @return array
-        */
-       protected function doGetPeriodicTasks() {
-               $periods = array( 3600 ); // standard cleanup (useful on config change)
-               if ( $this->claimTTL > 0 ) {
-                       $periods[] = ceil( $this->claimTTL / 2 ); // avoid bad timing
-               }
-               if ( $this->checkDelay ) {
-                       $periods[] = 300; // 5 minutes
-               }
-               $period = min( $periods );
-               $period = max( $period, 30 ); // sanity
-               // Support override for faster testing
-               if ( $this->maximumPeriodicTaskSeconds !== null ) {
-                       $period = min( $period, $this->maximumPeriodicTaskSeconds );
-               }
-               return array(
-                       'recyclePruneAndUndelayJobs' => array(
-                               'callback' => array( $this, 'recyclePruneAndUndelayJobs' ),
-                               'period'   => $period,
-                       )
-               );
-       }
-
-       /**
-        * @param IJobSpecification $job
-        * @return array
-        */
-       protected function getNewJobFields( IJobSpecification $job ) {
-               return array(
-                       // Fields that describe the nature of the job
-                       'type' => $job->getType(),
-                       'namespace' => $job->getTitle()->getNamespace(),
-                       'title' => $job->getTitle()->getDBkey(),
-                       'params' => $job->getParams(),
-                       // Some jobs cannot run until a "release timestamp"
-                       'rtimestamp' => $job->getReleaseTimestamp() ?: 0,
-                       // Additional job metadata
-                       'uuid' => UIDGenerator::newRawUUIDv4( UIDGenerator::QUICK_RAND ),
-                       'sha1' => $job->ignoreDuplicates()
-                               ? wfBaseConvert( sha1( serialize( $job->getDeduplicationInfo() ) ), 16, 36, 31 )
-                               : '',
-                       'timestamp' => time() // UNIX timestamp
-               );
-       }
-
-       /**
-        * @param $fields array
-        * @return Job|bool
-        */
-       protected function getJobFromFields( array $fields ) {
-               $title = Title::makeTitleSafe( $fields['namespace'], $fields['title'] );
-               if ( $title ) {
-                       $job = Job::factory( $fields['type'], $title, $fields['params'] );
-                       $job->metadata['uuid'] = $fields['uuid'];
-
-                       return $job;
-               }
-
-               return false;
-       }
-
-       /**
-        * @param array $fields
-        * @return string Serialized and possibly compressed version of $fields
-        */
-       protected function serialize( array $fields ) {
-               $blob = serialize( $fields );
-               if ( $this->compression === 'gzip'
-                       && strlen( $blob ) >= 1024
-                       && function_exists( 'gzdeflate' )
-               ) {
-                       $object = (object)array( 'blob' => gzdeflate( $blob ), 'enc' => 'gzip' );
-                       $blobz = serialize( $object );
-
-                       return ( strlen( $blobz ) < strlen( $blob ) ) ? $blobz : $blob;
-               } else {
-                       return $blob;
-               }
-       }
-
-       /**
-        * @param string $blob
-        * @return array|bool Unserialized version of $blob or false
-        */
-       protected function unserialize( $blob ) {
-               $fields = unserialize( $blob );
-               if ( is_object( $fields ) ) {
-                       if ( $fields->enc === 'gzip' && function_exists( 'gzinflate' ) ) {
-                               $fields = unserialize( gzinflate( $fields->blob ) );
-                       } else {
-                               $fields = false;
-                       }
-               }
-
-               return is_array( $fields ) ? $fields : false;
-       }
-
-       /**
-        * Get a connection to the server that handles all sub-queues for this queue
-        *
-        * @return RedisConnRef
-        * @throws JobQueueConnectionError
-        */
-       protected function getConnection() {
-               $conn = $this->redisPool->getConnection( $this->server );
-               if ( !$conn ) {
-                       throw new JobQueueConnectionError( "Unable to connect to redis server." );
-               }
-
-               return $conn;
-       }
-
-       /**
-        * @param $conn RedisConnRef
-        * @param $e RedisException
-        * @throws JobQueueError
-        */
-       protected function throwRedisException( RedisConnRef $conn, $e ) {
-               $this->redisPool->handleError( $conn, $e );
-               throw new JobQueueError( "Redis server error: {$e->getMessage()}\n" );
-       }
-
-       /**
-        * @param $prop string
-        * @param $type string|null
-        * @return string
-        */
-       private function getQueueKey( $prop, $type = null ) {
-               $type = is_string( $type ) ? $type : $this->type;
-               list( $db, $prefix ) = wfSplitWikiID( $this->wiki );
-               if ( strlen( $this->key ) ) { // namespaced queue (for testing)
-                       return wfForeignMemcKey( $db, $prefix, 'jobqueue', $type, $this->key, $prop );
-               } else {
-                       return wfForeignMemcKey( $db, $prefix, 'jobqueue', $type, $prop );
-               }
-       }
-
-       /**
-        * @param $key string
-        * @return void
-        */
-       public function setTestingPrefix( $key ) {
-               $this->key = $key;
-       }
-}
diff --git a/includes/job/JobSpecification.php b/includes/job/JobSpecification.php
deleted file mode 100644 (file)
index e074e5c..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-<?php
-/**
- * Job queue task description base code.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup JobQueue
- */
-
-/**
- * Job queue task description interface
- *
- * @ingroup JobQueue
- * @since 1.23
- */
-interface IJobSpecification {
-       /**
-        * @return string Job type
-        */
-       public function getType();
-
-       /**
-        * @return array
-        */
-       public function getParams();
-
-       /**
-        * @return int|null UNIX timestamp to delay running this job until, otherwise null
-        */
-       public function getReleaseTimestamp();
-
-       /**
-        * @return bool Whether only one of each identical set of jobs should be run
-        */
-       public function ignoreDuplicates();
-
-       /**
-        * Subclasses may need to override this to make duplication detection work.
-        * The resulting map conveys everything that makes the job unique. This is
-        * only checked if ignoreDuplicates() returns true, meaning that duplicate
-        * jobs are supposed to be ignored.
-        *
-        * @return array Map of key/values
-        */
-       public function getDeduplicationInfo();
-
-       /**
-        * @return Title Descriptive title (this can simply be informative)
-        */
-       public function getTitle();
-}
-
-/**
- * Job queue task description base code
- *
- * Example usage:
- * <code>
- * $job = new JobSpecification(
- *             'null',
- *             array( 'lives' => 1, 'usleep' => 100, 'pi' => 3.141569 ),
- *             array( 'removeDuplicates' => 1 ),
- *             Title::makeTitle( NS_SPECIAL, 'nullity' )
- * );
- * JobQueueGroup::singleton()->push( $job )
- * </code>
- *
- * @ingroup JobQueue
- * @since 1.23
- */
-class JobSpecification implements IJobSpecification {
-       /** @var string */
-       protected $type;
-
-       /** @var array Array of job parameters or false if none */
-       protected $params;
-
-       /** @var Title */
-       protected $title;
-
-       /** @var bool Expensive jobs may set this to true */
-       protected $ignoreDuplicates;
-
-       /**
-        * @param string $type
-        * @param array $params Map of key/values
-        * @param array $opts Map of key/values
-        * @param Title $title Optional descriptive title
-        */
-       public function __construct(
-               $type, array $params, array $opts = array(), Title $title = null
-       ) {
-               $this->validateParams( $params );
-
-               $this->type = $type;
-               $this->params = $params;
-               $this->title = $title ?: Title::newMainPage();
-               $this->ignoreDuplicates = !empty( $opts['removeDuplicates'] );
-       }
-
-       /**
-        * @param array $params
-        */
-       protected function validateParams( array $params ) {
-               foreach ( $params as $p => $v ) {
-                       if ( is_array( $v ) ) {
-                               $this->validateParams( $v );
-                       } elseif ( !is_scalar( $v ) && $v !== null ) {
-                               throw new UnexpectedValueException( 'Job parameters are not JSON serializable.' );
-                       }
-               }
-       }
-
-       /**
-        * @return string
-        */
-       public function getType() {
-               return $this->type;
-       }
-
-       /**
-        * @return Title
-        */
-       public function getTitle() {
-               return $this->title;
-       }
-
-       /**
-        * @return array
-        */
-       public function getParams() {
-               return $this->params;
-       }
-
-       /**
-        * @return int|null UNIX timestamp to delay running this job until, otherwise null
-        */
-       public function getReleaseTimestamp() {
-               return isset( $this->params['jobReleaseTimestamp'] )
-                       ? wfTimestampOrNull( TS_UNIX, $this->params['jobReleaseTimestamp'] )
-                       : null;
-       }
-
-       /**
-        * @return bool Whether only one of each identical set of jobs should be run
-        */
-       public function ignoreDuplicates() {
-               return $this->ignoreDuplicates;
-       }
-
-       /**
-        * Subclasses may need to override this to make duplication detection work.
-        * The resulting map conveys everything that makes the job unique. This is
-        * only checked if ignoreDuplicates() returns true, meaning that duplicate
-        * jobs are supposed to be ignored.
-        *
-        * @return array Map of key/values
-        */
-       public function getDeduplicationInfo() {
-               $info = array(
-                       'type' => $this->getType(),
-                       'namespace' => $this->getTitle()->getNamespace(),
-                       'title' => $this->getTitle()->getDBkey(),
-                       'params' => $this->getParams()
-               );
-               if ( is_array( $info['params'] ) ) {
-                       // Identical jobs with different "root" jobs should count as duplicates
-                       unset( $info['params']['rootJobSignature'] );
-                       unset( $info['params']['rootJobTimestamp'] );
-                       // Likewise for jobs with different delay times
-                       unset( $info['params']['jobReleaseTimestamp'] );
-               }
-
-               return $info;
-       }
-}
diff --git a/includes/job/README b/includes/job/README
deleted file mode 100644 (file)
index c11d5a7..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*!
-\ingroup JobQueue
-\page jobqueue_design Job queue design
-
-Notes on the Job queuing system architecture.
-
-\section intro Introduction
-
-The data model consist of the following main components:
-* The Job object represents a particular deferred task that happens in the
-  background. All jobs subclass the Job object and put the main logic in the
-  function called run().
-* The JobQueue object represents a particular queue of jobs of a certain type.
-  For example there may be a queue for email jobs and a queue for squid purge
-  jobs.
-
-\section jobqueue Job queues
-
-Each job type has its own queue and is associated to a storage medium. One
-queue might save its jobs in redis while another one uses would use a database.
-
-Storage medium are defined in a queue class. Before using it, you must
-define in $wgJobTypeConf a mapping of the job type to a queue class.
-
-The factory class JobQueueGroup provides helper functions:
-- getting the queue for a given job
-- route new job insertions to the proper queue
-
-The following queue classes are available:
-* JobQueueDB (stores jobs in the `job` table in a database)
-* JobQueueRedis (stores jobs in a redis server)
-
-All queue classes support some basic operations (though some may be no-ops):
-* enqueueing a batch of jobs
-* dequeueing a single job
-* acknowledging a job is completed
-* checking if the queue is empty
-
-Some queue classes (like JobQueueDB) may dequeue jobs in random order while other
-queues might dequeue jobs in exact FIFO order. Callers should thus not assume jobs
-are executed in FIFO order.
-
-Also note that not all queue classes will have the same reliability guarantees.
-In-memory queues may lose data when restarted depending on snapshot and journal
-settings (including journal fsync() frequency).  Some queue types may totally remove
-jobs when dequeued while leaving the ack() function as a no-op; if a job is
-dequeued by a job runner, which crashes before completion, the job will be
-lost. Some jobs, like purging squid caches after a template change, may not
-require durable queues, whereas other jobs might be more important.
-
-\section aggregator Job queue aggregator
-
-The aggregators are used by nextJobDB.php, which is a script that will return a
-random ready queue (on any wiki in the farm) that can be used with runJobs.php.
-This can be used in conjunction with any scripts that handle wiki farm job queues.
-Note that $wgLocalDatabases defines what wikis are in the wiki farm.
-
-Since each job type has its own queue, and wiki-farms may have many wikis,
-there might be a large number of queues to keep track of. To avoid wasting
-large amounts of time polling empty queues, aggregators exists to keep track
-of which queues are ready.
-
-The following queue aggregator classes are available:
-* JobQueueAggregatorMemc (uses $wgMemc to track ready queues)
-* JobQueueAggregatorRedis (uses a redis server to track ready queues)
-
-Some aggregators cache data for a few minutes while others may be always up to date.
-This can be an important factor for jobs that need a low pickup time (or latency).
-
-\section jobs Jobs
-
-Callers should also try to make jobs maintain correctness when executed twice.
-This is useful for queues that actually implement ack(), since they may recycle
-dequeued but un-acknowledged jobs back into the queue to be attempted again. If
-a runner dequeues a job, runs it, but then crashes before calling ack(), the
-job may be returned to the queue and run a second time. Jobs like cache purging can
-happen several times without any correctness problems. However, a pathological case
-would be if a bug causes the problem to systematically keep repeating. For example,
-a job may always throw a DB error at the end of run(). This problem is trickier to
-solve and more obnoxious for things like email jobs, for example. For such jobs,
-it might be useful to use a queue that does not retry jobs.
diff --git a/includes/job/aggregator/JobQueueAggregator.php b/includes/job/aggregator/JobQueueAggregator.php
deleted file mode 100644 (file)
index 8600eed..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-<?php
-/**
- * Job queue aggregator code.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @author Aaron Schulz
- */
-
-/**
- * Class to handle tracking information about all queues
- *
- * @ingroup JobQueue
- * @since 1.21
- */
-abstract class JobQueueAggregator {
-       /** @var JobQueueAggregator */
-       protected static $instance = null;
-
-       /**
-        * @param array $params
-        */
-       protected function __construct( array $params ) {
-       }
-
-       /**
-        * @throws MWException
-        * @return JobQueueAggregator
-        */
-       final public static function singleton() {
-               global $wgJobQueueAggregator;
-
-               if ( !isset( self::$instance ) ) {
-                       $class = $wgJobQueueAggregator['class'];
-                       $obj = new $class( $wgJobQueueAggregator );
-                       if ( !( $obj instanceof JobQueueAggregator ) ) {
-                               throw new MWException( "Class '$class' is not a JobQueueAggregator class." );
-                       }
-                       self::$instance = $obj;
-               }
-
-               return self::$instance;
-       }
-
-       /**
-        * Destroy the singleton instance
-        *
-        * @return void
-        */
-       final public static function destroySingleton() {
-               self::$instance = null;
-       }
-
-       /**
-        * Mark a queue as being empty
-        *
-        * @param string $wiki
-        * @param string $type
-        * @return bool Success
-        */
-       final public function notifyQueueEmpty( $wiki, $type ) {
-               wfProfileIn( __METHOD__ );
-               $ok = $this->doNotifyQueueEmpty( $wiki, $type );
-               wfProfileOut( __METHOD__ );
-
-               return $ok;
-       }
-
-       /**
-        * @see JobQueueAggregator::notifyQueueEmpty()
-        */
-       abstract protected function doNotifyQueueEmpty( $wiki, $type );
-
-       /**
-        * Mark a queue as being non-empty
-        *
-        * @param string $wiki
-        * @param string $type
-        * @return bool Success
-        */
-       final public function notifyQueueNonEmpty( $wiki, $type ) {
-               wfProfileIn( __METHOD__ );
-               $ok = $this->doNotifyQueueNonEmpty( $wiki, $type );
-               wfProfileOut( __METHOD__ );
-
-               return $ok;
-       }
-
-       /**
-        * @see JobQueueAggregator::notifyQueueNonEmpty()
-        */
-       abstract protected function doNotifyQueueNonEmpty( $wiki, $type );
-
-       /**
-        * Get the list of all of the queues with jobs
-        *
-        * @return array (job type => (list of wiki IDs))
-        */
-       final public function getAllReadyWikiQueues() {
-               wfProfileIn( __METHOD__ );
-               $res = $this->doGetAllReadyWikiQueues();
-               wfProfileOut( __METHOD__ );
-
-               return $res;
-       }
-
-       /**
-        * @see JobQueueAggregator::getAllReadyWikiQueues()
-        */
-       abstract protected function doGetAllReadyWikiQueues();
-
-       /**
-        * Purge all of the aggregator information
-        *
-        * @return bool Success
-        */
-       final public function purge() {
-               wfProfileIn( __METHOD__ );
-               $res = $this->doPurge();
-               wfProfileOut( __METHOD__ );
-
-               return $res;
-       }
-
-       /**
-        * @see JobQueueAggregator::purge()
-        */
-       abstract protected function doPurge();
-
-       /**
-        * Get all databases that have a pending job.
-        * This poll all the queues and is this expensive.
-        *
-        * @return array (job type => (list of wiki IDs))
-        */
-       protected function findPendingWikiQueues() {
-               global $wgLocalDatabases;
-
-               $pendingDBs = array(); // (job type => (db list))
-               foreach ( $wgLocalDatabases as $db ) {
-                       foreach ( JobQueueGroup::singleton( $db )->getQueuesWithJobs() as $type ) {
-                               $pendingDBs[$type][] = $db;
-                       }
-               }
-
-               return $pendingDBs;
-       }
-}
diff --git a/includes/job/aggregator/JobQueueAggregatorMemc.php b/includes/job/aggregator/JobQueueAggregatorMemc.php
deleted file mode 100644 (file)
index d733a42..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-<?php
-/**
- * Job queue aggregator code that uses BagOStuff.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @author Aaron Schulz
- */
-
-/**
- * Class to handle tracking information about all queues using BagOStuff
- *
- * @ingroup JobQueue
- * @since 1.21
- */
-class JobQueueAggregatorMemc extends JobQueueAggregator {
-       /** @var BagOStuff */
-       protected $cache;
-
-       protected $cacheTTL; // integer; seconds
-
-       /**
-        * @params include:
-        *   - objectCache : Name of an object cache registered in $wgObjectCaches.
-        *                   This defaults to the one specified by $wgMainCacheType.
-        *   - cacheTTL    : Seconds to cache the aggregate data before regenerating.
-        * @param array $params
-        */
-       protected function __construct( array $params ) {
-               parent::__construct( $params );
-               $this->cache = isset( $params['objectCache'] )
-                       ? wfGetCache( $params['objectCache'] )
-                       : wfGetMainCache();
-               $this->cacheTTL = isset( $params['cacheTTL'] ) ? $params['cacheTTL'] : 180; // 3 min
-       }
-
-       /**
-        * @see JobQueueAggregator::doNotifyQueueEmpty()
-        */
-       protected function doNotifyQueueEmpty( $wiki, $type ) {
-               $key = $this->getReadyQueueCacheKey();
-               // Delist the queue from the "ready queue" list
-               if ( $this->cache->add( "$key:lock", 1, 60 ) ) { // lock
-                       $curInfo = $this->cache->get( $key );
-                       if ( is_array( $curInfo ) && isset( $curInfo['pendingDBs'][$type] ) ) {
-                               if ( in_array( $wiki, $curInfo['pendingDBs'][$type] ) ) {
-                                       $curInfo['pendingDBs'][$type] = array_diff(
-                                               $curInfo['pendingDBs'][$type], array( $wiki ) );
-                                       $this->cache->set( $key, $curInfo );
-                               }
-                       }
-                       $this->cache->delete( "$key:lock" ); // unlock
-               }
-
-               return true;
-       }
-
-       /**
-        * @see JobQueueAggregator::doNotifyQueueNonEmpty()
-        */
-       protected function doNotifyQueueNonEmpty( $wiki, $type ) {
-               return true; // updated periodically
-       }
-
-       /**
-        * @see JobQueueAggregator::doAllGetReadyWikiQueues()
-        */
-       protected function doGetAllReadyWikiQueues() {
-               $key = $this->getReadyQueueCacheKey();
-               // If the cache entry wasn't present, is stale, or in .1% of cases otherwise,
-               // regenerate the cache. Use any available stale cache if another process is
-               // currently regenerating the pending DB information.
-               $pendingDbInfo = $this->cache->get( $key );
-               if ( !is_array( $pendingDbInfo )
-                       || ( time() - $pendingDbInfo['timestamp'] ) > $this->cacheTTL
-                       || mt_rand( 0, 999 ) == 0
-               ) {
-                       if ( $this->cache->add( "$key:rebuild", 1, 1800 ) ) { // lock
-                               $pendingDbInfo = array(
-                                       'pendingDBs' => $this->findPendingWikiQueues(),
-                                       'timestamp' => time()
-                               );
-                               for ( $attempts = 1; $attempts <= 25; ++$attempts ) {
-                                       if ( $this->cache->add( "$key:lock", 1, 60 ) ) { // lock
-                                               $this->cache->set( $key, $pendingDbInfo );
-                                               $this->cache->delete( "$key:lock" ); // unlock
-                                               break;
-                                       }
-                               }
-                               $this->cache->delete( "$key:rebuild" ); // unlock
-                       }
-               }
-
-               return is_array( $pendingDbInfo )
-                       ? $pendingDbInfo['pendingDBs']
-                       : array(); // cache is both empty and locked
-       }
-
-       /**
-        * @see JobQueueAggregator::doPurge()
-        */
-       protected function doPurge() {
-               return $this->cache->delete( $this->getReadyQueueCacheKey() );
-       }
-
-       /**
-        * @return string
-        */
-       private function getReadyQueueCacheKey() {
-               return "jobqueue:aggregator:ready-queues:v1"; // global
-       }
-}
diff --git a/includes/job/aggregator/JobQueueAggregatorRedis.php b/includes/job/aggregator/JobQueueAggregatorRedis.php
deleted file mode 100644 (file)
index 2aec3c9..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-<?php
-/**
- * Job queue aggregator code that uses PhpRedis.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @author Aaron Schulz
- */
-
-/**
- * Class to handle tracking information about all queues using PhpRedis
- *
- * @ingroup JobQueue
- * @ingroup Redis
- * @since 1.21
- */
-class JobQueueAggregatorRedis extends JobQueueAggregator {
-       /** @var RedisConnectionPool */
-       protected $redisPool;
-
-       /** @var array List of Redis server addresses */
-       protected $servers;
-
-       /**
-        * @params include:
-        *   - redisConfig  : An array of parameters to RedisConnectionPool::__construct().
-        *   - redisServers : Array of server entries, the first being the primary and the
-        *                    others being fallback servers. Each entry is either a hostname/port
-        *                    combination or the absolute path of a UNIX socket.
-        *                    If a hostname is specified but no port, the standard port number
-        *                    6379 will be used. Required.
-        * @param array $params
-        */
-       protected function __construct( array $params ) {
-               parent::__construct( $params );
-               $this->servers = isset( $params['redisServers'] )
-                       ? $params['redisServers']
-                       : array( $params['redisServer'] ); // b/c
-               $this->redisPool = RedisConnectionPool::singleton( $params['redisConfig'] );
-       }
-
-       protected function doNotifyQueueEmpty( $wiki, $type ) {
-               $conn = $this->getConnection();
-               if ( !$conn ) {
-                       return false;
-               }
-               try {
-                       $conn->hDel( $this->getReadyQueueKey(), $this->encQueueName( $type, $wiki ) );
-
-                       return true;
-               } catch ( RedisException $e ) {
-                       $this->handleException( $conn, $e );
-
-                       return false;
-               }
-       }
-
-       protected function doNotifyQueueNonEmpty( $wiki, $type ) {
-               $conn = $this->getConnection();
-               if ( !$conn ) {
-                       return false;
-               }
-               try {
-                       $conn->hSet( $this->getReadyQueueKey(), $this->encQueueName( $type, $wiki ), time() );
-
-                       return true;
-               } catch ( RedisException $e ) {
-                       $this->handleException( $conn, $e );
-
-                       return false;
-               }
-       }
-
-       protected function doGetAllReadyWikiQueues() {
-               $conn = $this->getConnection();
-               if ( !$conn ) {
-                       return array();
-               }
-               try {
-                       $conn->multi( Redis::PIPELINE );
-                       $conn->exists( $this->getReadyQueueKey() );
-                       $conn->hGetAll( $this->getReadyQueueKey() );
-                       list( $exists, $map ) = $conn->exec();
-
-                       if ( $exists ) { // cache hit
-                               $pendingDBs = array(); // (type => list of wikis)
-                               foreach ( $map as $key => $time ) {
-                                       list( $type, $wiki ) = $this->dencQueueName( $key );
-                                       $pendingDBs[$type][] = $wiki;
-                               }
-                       } else { // cache miss
-                               // Avoid duplicated effort
-                               $rand = wfRandomString( 32 );
-                               $conn->multi( Redis::MULTI );
-                               $conn->setex( "{$rand}:lock", 3600, 1 );
-                               $conn->renamenx( "{$rand}:lock", $this->getReadyQueueKey() . ":lock" );
-                               if ( $conn->exec() !== array( true, true ) ) { // lock
-                                       $conn->delete( "{$rand}:lock" );
-                                       return array(); // already in progress
-                               }
-
-                               $pendingDBs = $this->findPendingWikiQueues(); // (type => list of wikis)
-
-                               $conn->delete( $this->getReadyQueueKey() . ":lock" ); // unlock
-
-                               $now = time();
-                               $map = array();
-                               foreach ( $pendingDBs as $type => $wikis ) {
-                                       foreach ( $wikis as $wiki ) {
-                                               $map[$this->encQueueName( $type, $wiki )] = $now;
-                                       }
-                               }
-                               $conn->hMSet( $this->getReadyQueueKey(), $map );
-                       }
-
-                       return $pendingDBs;
-               } catch ( RedisException $e ) {
-                       $this->handleException( $conn, $e );
-
-                       return array();
-               }
-       }
-
-       protected function doPurge() {
-               $conn = $this->getConnection();
-               if ( !$conn ) {
-                       return false;
-               }
-               try {
-                       $conn->delete( $this->getReadyQueueKey() );
-               } catch ( RedisException $e ) {
-                       $this->handleException( $conn, $e );
-
-                       return false;
-               }
-
-               return true;
-       }
-
-       /**
-        * Get a connection to the server that handles all sub-queues for this queue
-        *
-        * @return RedisConnRef|bool Returns false on failure
-        * @throws MWException
-        */
-       protected function getConnection() {
-               $conn = false;
-               foreach ( $this->servers as $server ) {
-                       $conn = $this->redisPool->getConnection( $server );
-                       if ( $conn ) {
-                               break;
-                       }
-               }
-
-               return $conn;
-       }
-
-       /**
-        * @param RedisConnRef $conn
-        * @param RedisException $e
-        * @return void
-        */
-       protected function handleException( RedisConnRef $conn, $e ) {
-               $this->redisPool->handleError( $conn, $e );
-       }
-
-       /**
-        * @return string
-        */
-       private function getReadyQueueKey() {
-               return "jobqueue:aggregator:h-ready-queues:v1"; // global
-       }
-
-       /**
-        * @param string $type
-        * @param string $wiki
-        * @return string
-        */
-       private function encQueueName( $type, $wiki ) {
-               return rawurlencode( $type ) . '/' . rawurlencode( $wiki );
-       }
-
-       /**
-        * @param string $name
-        * @return string
-        */
-       private function dencQueueName( $name ) {
-               list( $type, $wiki ) = explode( '/', $name, 2 );
-
-               return array( rawurldecode( $type ), rawurldecode( $wiki ) );
-       }
-}
diff --git a/includes/job/jobs/AssembleUploadChunksJob.php b/includes/job/jobs/AssembleUploadChunksJob.php
deleted file mode 100644 (file)
index 19b0558..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php
-/**
- * Assemble the segments of a chunked upload.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Upload
- */
-
-/**
- * Assemble the segments of a chunked upload.
- *
- * @ingroup Upload
- */
-class AssembleUploadChunksJob extends Job {
-       public function __construct( $title, $params ) {
-               parent::__construct( 'AssembleUploadChunks', $title, $params );
-               $this->removeDuplicates = true;
-       }
-
-       public function run() {
-               $scope = RequestContext::importScopedSession( $this->params['session'] );
-               $context = RequestContext::getMain();
-               try {
-                       $user = $context->getUser();
-                       if ( !$user->isLoggedIn() ) {
-                               $this->setLastError( "Could not load the author user from session." );
-
-                               return false;
-                       }
-
-                       if ( count( $_SESSION ) === 0 ) {
-                               // Empty session probably indicates that we didn't associate
-                               // with the session correctly. Note that being able to load
-                               // the user does not necessarily mean the session was loaded.
-                               // Most likely cause by suhosin.session.encrypt = On.
-                               $this->setLastError( "Error associating with user session. " .
-                                       "Try setting suhosin.session.encrypt = Off" );
-
-                               return false;
-                       }
-
-                       UploadBase::setSessionStatus(
-                               $this->params['filekey'],
-                               array( 'result' => 'Poll', 'stage' => 'assembling', 'status' => Status::newGood() )
-                       );
-
-                       $upload = new UploadFromChunks( $user );
-                       $upload->continueChunks(
-                               $this->params['filename'],
-                               $this->params['filekey'],
-                               $context->getRequest()
-                       );
-
-                       // Combine all of the chunks into a local file and upload that to a new stash file
-                       $status = $upload->concatenateChunks();
-                       if ( !$status->isGood() ) {
-                               UploadBase::setSessionStatus(
-                                       $this->params['filekey'],
-                                       array( 'result' => 'Failure', 'stage' => 'assembling', 'status' => $status )
-                               );
-                               $this->setLastError( $status->getWikiText() );
-
-                               return false;
-                       }
-
-                       // We have a new filekey for the fully concatenated file
-                       $newFileKey = $upload->getLocalFile()->getFileKey();
-
-                       // Remove the old stash file row and first chunk file
-                       $upload->stash->removeFileNoAuth( $this->params['filekey'] );
-
-                       // Build the image info array while we have the local reference handy
-                       $apiMain = new ApiMain(); // dummy object (XXX)
-                       $imageInfo = $upload->getImageInfo( $apiMain->getResult() );
-
-                       // Cleanup any temporary local file
-                       $upload->cleanupTempFile();
-
-                       // Cache the info so the user doesn't have to wait forever to get the final info
-                       UploadBase::setSessionStatus(
-                               $this->params['filekey'],
-                               array(
-                                       'result' => 'Success',
-                                       'stage' => 'assembling',
-                                       'filekey' => $newFileKey,
-                                       'imageinfo' => $imageInfo,
-                                       'status' => Status::newGood()
-                               )
-                       );
-               } catch ( MWException $e ) {
-                       UploadBase::setSessionStatus(
-                               $this->params['filekey'],
-                               array(
-                                       'result' => 'Failure',
-                                       'stage' => 'assembling',
-                                       'status' => Status::newFatal( 'api-error-stashfailed' )
-                               )
-                       );
-                       $this->setLastError( get_class( $e ) . ": " . $e->getText() );
-
-                       return false;
-               }
-
-               return true;
-       }
-
-       public function getDeduplicationInfo() {
-               $info = parent::getDeduplicationInfo();
-               if ( is_array( $info['params'] ) ) {
-                       $info['params'] = array( 'filekey' => $info['params']['filekey'] );
-               }
-
-               return $info;
-       }
-
-       public function allowRetries() {
-               return false;
-       }
-}
diff --git a/includes/job/jobs/DoubleRedirectJob.php b/includes/job/jobs/DoubleRedirectJob.php
deleted file mode 100644 (file)
index 94b56ef..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-<?php
-/**
- * Job to fix double redirects after moving a page.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup JobQueue
- */
-
-/**
- * Job to fix double redirects after moving a page
- *
- * @ingroup JobQueue
- */
-class DoubleRedirectJob extends Job {
-       /** @var string Reason for the change, 'maintenance' or 'move'. Suffix fo
-        *    message key 'double-redirect-fixed-'.
-        */
-       private $reason;
-
-       /** @var Title The title which has changed, redirects pointing to this
-        *    title are fixed
-        */
-       private $redirTitle;
-
-       /** @var User */
-       private static $user;
-
-       /**
-        * Insert jobs into the job queue to fix redirects to the given title
-        * @param string $reason the reason for the fix, see message
-        *   "double-redirect-fixed-<reason>"
-        * @param $redirTitle Title: the title which has changed, redirects
-        *   pointing to this title are fixed
-        * @param bool $destTitle Not used
-        */
-       public static function fixRedirects( $reason, $redirTitle, $destTitle = false ) {
-               # Need to use the master to get the redirect table updated in the same transaction
-               $dbw = wfGetDB( DB_MASTER );
-               $res = $dbw->select(
-                       array( 'redirect', 'page' ),
-                       array( 'page_namespace', 'page_title' ),
-                       array(
-                               'page_id = rd_from',
-                               'rd_namespace' => $redirTitle->getNamespace(),
-                               'rd_title' => $redirTitle->getDBkey()
-                       ), __METHOD__ );
-               if ( !$res->numRows() ) {
-                       return;
-               }
-               $jobs = array();
-               foreach ( $res as $row ) {
-                       $title = Title::makeTitle( $row->page_namespace, $row->page_title );
-                       if ( !$title ) {
-                               continue;
-                       }
-
-                       $jobs[] = new self( $title, array(
-                               'reason' => $reason,
-                               'redirTitle' => $redirTitle->getPrefixedDBkey() ) );
-                       # Avoid excessive memory usage
-                       if ( count( $jobs ) > 10000 ) {
-                               JobQueueGroup::singleton()->push( $jobs );
-                               $jobs = array();
-                       }
-               }
-               JobQueueGroup::singleton()->push( $jobs );
-       }
-
-       /**
-        * @param Title $title
-        * @param array|bool $params
-        * @param int $id
-        */
-       function __construct( $title, $params = false ) {
-               parent::__construct( 'fixDoubleRedirect', $title, $params );
-               $this->reason = $params['reason'];
-               $this->redirTitle = Title::newFromText( $params['redirTitle'] );
-       }
-
-       /**
-        * @return bool
-        */
-       function run() {
-               if ( !$this->redirTitle ) {
-                       $this->setLastError( 'Invalid title' );
-
-                       return false;
-               }
-
-               $targetRev = Revision::newFromTitle( $this->title, false, Revision::READ_LATEST );
-               if ( !$targetRev ) {
-                       wfDebug( __METHOD__ . ": target redirect already deleted, ignoring\n" );
-
-                       return true;
-               }
-               $content = $targetRev->getContent();
-               $currentDest = $content ? $content->getRedirectTarget() : null;
-               if ( !$currentDest || !$currentDest->equals( $this->redirTitle ) ) {
-                       wfDebug( __METHOD__ . ": Redirect has changed since the job was queued\n" );
-
-                       return true;
-               }
-
-               // Check for a suppression tag (used e.g. in periodically archived discussions)
-               $mw = MagicWord::get( 'staticredirect' );
-               if ( $content->matchMagicWord( $mw ) ) {
-                       wfDebug( __METHOD__ . ": skipping: suppressed with __STATICREDIRECT__\n" );
-
-                       return true;
-               }
-
-               // Find the current final destination
-               $newTitle = self::getFinalDestination( $this->redirTitle );
-               if ( !$newTitle ) {
-                       wfDebug( __METHOD__ .
-                               ": skipping: single redirect, circular redirect or invalid redirect destination\n" );
-
-                       return true;
-               }
-               if ( $newTitle->equals( $this->redirTitle ) ) {
-                       // The redirect is already right, no need to change it
-                       // This can happen if the page was moved back (say after vandalism)
-                       wfDebug( __METHOD__ . " : skipping, already good\n" );
-               }
-
-               // Preserve fragment (bug 14904)
-               $newTitle = Title::makeTitle( $newTitle->getNamespace(), $newTitle->getDBkey(),
-                       $currentDest->getFragment(), $newTitle->getInterwiki() );
-
-               // Fix the text
-               $newContent = $content->updateRedirect( $newTitle );
-
-               if ( $newContent->equals( $content ) ) {
-                       $this->setLastError( 'Content unchanged???' );
-
-                       return false;
-               }
-
-               $user = $this->getUser();
-               if ( !$user ) {
-                       $this->setLastError( 'Invalid user' );
-
-                       return false;
-               }
-
-               // Save it
-               global $wgUser;
-               $oldUser = $wgUser;
-               $wgUser = $user;
-               $article = WikiPage::factory( $this->title );
-
-               // Messages: double-redirect-fixed-move, double-redirect-fixed-maintenance
-               $reason = wfMessage( 'double-redirect-fixed-' . $this->reason,
-                       $this->redirTitle->getPrefixedText(), $newTitle->getPrefixedText()
-               )->inContentLanguage()->text();
-               $article->doEditContent( $newContent, $reason, EDIT_UPDATE | EDIT_SUPPRESS_RC, false, $user );
-               $wgUser = $oldUser;
-
-               return true;
-       }
-
-       /**
-        * Get the final destination of a redirect
-        *
-        * @param $title Title
-        *
-        * @return bool if the specified title is not a redirect, or if it is a circular redirect
-        */
-       public static function getFinalDestination( $title ) {
-               $dbw = wfGetDB( DB_MASTER );
-
-               // Circular redirect check
-               $seenTitles = array();
-               $dest = false;
-
-               while ( true ) {
-                       $titleText = $title->getPrefixedDBkey();
-                       if ( isset( $seenTitles[$titleText] ) ) {
-                               wfDebug( __METHOD__, "Circular redirect detected, aborting\n" );
-
-                               return false;
-                       }
-                       $seenTitles[$titleText] = true;
-
-                       if ( $title->isExternal() ) {
-                               // If the target is interwiki, we have to break early (bug 40352).
-                               // Otherwise it will look up a row in the local page table
-                               // with the namespace/page of the interwiki target which can cause
-                               // unexpected results (e.g. X -> foo:Bar -> Bar -> .. )
-                               break;
-                       }
-
-                       $row = $dbw->selectRow(
-                               array( 'redirect', 'page' ),
-                               array( 'rd_namespace', 'rd_title', 'rd_interwiki' ),
-                               array(
-                                       'rd_from=page_id',
-                                       'page_namespace' => $title->getNamespace(),
-                                       'page_title' => $title->getDBkey()
-                               ), __METHOD__ );
-                       if ( !$row ) {
-                               # No redirect from here, chain terminates
-                               break;
-                       } else {
-                               $dest = $title = Title::makeTitle(
-                                       $row->rd_namespace,
-                                       $row->rd_title,
-                                       '',
-                                       $row->rd_interwiki
-                               );
-                       }
-               }
-
-               return $dest;
-       }
-
-       /**
-        * Get a user object for doing edits, from a request-lifetime cache
-        * False will be returned if the user name specified in the
-        * 'double-redirect-fixer' message is invalid.
-        *
-        * @return User|bool
-        */
-       function getUser() {
-               if ( !self::$user ) {
-                       $username = wfMessage( 'double-redirect-fixer' )->inContentLanguage()->text();
-                       self::$user = User::newFromName( $username );
-                       # User::newFromName() can return false on a badly configured wiki.
-                       if ( self::$user && !self::$user->isLoggedIn() ) {
-                               self::$user->addToDatabase();
-                       }
-               }
-
-               return self::$user;
-       }
-}
diff --git a/includes/job/jobs/DuplicateJob.php b/includes/job/jobs/DuplicateJob.php
deleted file mode 100644 (file)
index b0a6ef7..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/**
- * No-op job that does nothing.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Cache
- */
-
-/**
- * No-op job that does nothing. Used to represent duplicates.
- *
- * @ingroup JobQueue
- */
-final class DuplicateJob extends Job {
-       /**
-        * Callers should use DuplicateJob::newFromJob() instead
-        *
-        * @param Title $title
-        * @param array $params job parameters
-        */
-       function __construct( $title, $params ) {
-               parent::__construct( 'duplicate', $title, $params );
-       }
-
-       /**
-        * Get a duplicate no-op version of a job
-        *
-        * @param Job $job
-        * @return Job
-        */
-       public static function newFromJob( Job $job ) {
-               $djob = new self( $job->getTitle(), $job->getParams() );
-               $djob->command = $job->getType();
-               $djob->params = is_array( $djob->params ) ? $djob->params : array();
-               $djob->params = array( 'isDuplicate' => true ) + $djob->params;
-               $djob->metadata = $job->metadata;
-
-               return $djob;
-       }
-
-       public function run() {
-               return true;
-       }
-}
diff --git a/includes/job/jobs/EmaillingJob.php b/includes/job/jobs/EmaillingJob.php
deleted file mode 100644 (file)
index df8ae63..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-/**
- * Old job for notification emails.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup JobQueue
- */
-
-/**
- * Old job used for sending single notification emails;
- * kept for backwards-compatibility
- *
- * @ingroup JobQueue
- */
-class EmaillingJob extends Job {
-       function __construct( $title, $params ) {
-               parent::__construct( 'sendMail', Title::newMainPage(), $params );
-       }
-
-       function run() {
-               $status = UserMailer::send(
-                       $this->params['to'],
-                       $this->params['from'],
-                       $this->params['subj'],
-                       $this->params['body'],
-                       $this->params['replyto']
-               );
-
-               return $status->isOK();
-       }
-}
diff --git a/includes/job/jobs/EnotifNotifyJob.php b/includes/job/jobs/EnotifNotifyJob.php
deleted file mode 100644 (file)
index 1ed99a5..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-/**
- * Job for notification emails.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup JobQueue
- */
-
-/**
- * Job for email notification mails
- *
- * @ingroup JobQueue
- */
-class EnotifNotifyJob extends Job {
-       function __construct( $title, $params ) {
-               parent::__construct( 'enotifNotify', $title, $params );
-       }
-
-       function run() {
-               $enotif = new EmailNotification();
-               // Get the user from ID (rename safe). Anons are 0, so defer to name.
-               if ( isset( $this->params['editorID'] ) && $this->params['editorID'] ) {
-                       $editor = User::newFromId( $this->params['editorID'] );
-               // B/C, only the name might be given.
-               } else {
-                       # @todo FIXME: newFromName could return false on a badly configured wiki.
-                       $editor = User::newFromName( $this->params['editor'], false );
-               }
-               $enotif->actuallyNotifyOnPageChange(
-                       $editor,
-                       $this->title,
-                       $this->params['timestamp'],
-                       $this->params['summary'],
-                       $this->params['minorEdit'],
-                       $this->params['oldid'],
-                       $this->params['watchers'],
-                       $this->params['pageStatus']
-               );
-
-               return true;
-       }
-}
diff --git a/includes/job/jobs/HTMLCacheUpdateJob.php b/includes/job/jobs/HTMLCacheUpdateJob.php
deleted file mode 100644 (file)
index a7c5dc0..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-<?php
-/**
- * HTML cache invalidation of all pages linking to a given title.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Cache
- */
-
-/**
- * Job to purge the cache for all pages that link to or use another page or file
- *
- * This job comes in a few variants:
- *   - a) Recursive jobs to purge caches for backlink pages for a given title.
- *        These jobs have have (recursive:true,table:<table>) set.
- *   - b) Jobs to purge caches for a set of titles (the job title is ignored).
- *           These jobs have have (pages:(<page ID>:(<namespace>,<title>),...) set.
- *
- * @ingroup JobQueue
- */
-class HTMLCacheUpdateJob extends Job {
-       function __construct( $title, $params = '' ) {
-               parent::__construct( 'htmlCacheUpdate', $title, $params );
-               // Base backlink purge jobs can be de-duplicated
-               $this->removeDuplicates = ( !isset( $params['range'] ) && !isset( $params['pages'] ) );
-       }
-
-       function run() {
-               global $wgUpdateRowsPerJob, $wgUpdateRowsPerQuery, $wgMaxBacklinksInvalidate;
-
-               static $expected = array( 'recursive', 'pages' ); // new jobs have one of these
-
-               $oldRangeJob = false;
-               if ( !array_intersect( array_keys( $this->params ), $expected ) ) {
-                       // B/C for older job params formats that lack these fields:
-                       // a) base jobs with just ("table") and b) range jobs with ("table","start","end")
-                       if ( isset( $this->params['start'] ) && isset( $this->params['end'] ) ) {
-                               $oldRangeJob = true;
-                       } else {
-                               $this->params['recursive'] = true; // base job
-                       }
-               }
-
-               // Job to purge all (or a range of) backlink pages for a page
-               if ( !empty( $this->params['recursive'] ) ) {
-                       // @TODO: try to use delayed jobs if possible?
-                       if ( !isset( $this->params['range'] ) && $wgMaxBacklinksInvalidate !== false ) {
-                               $numRows = $this->title->getBacklinkCache()->getNumLinks(
-                                       $this->params['table'], $wgMaxBacklinksInvalidate );
-                               if ( $numRows > $wgMaxBacklinksInvalidate ) {
-                                       return true;
-                               }
-                       }
-                       // Convert this into no more than $wgUpdateRowsPerJob HTMLCacheUpdateJob per-title
-                       // jobs and possibly a recursive HTMLCacheUpdateJob job for the rest of the backlinks
-                       $jobs = BacklinkJobUtils::partitionBacklinkJob(
-                               $this,
-                               $wgUpdateRowsPerJob,
-                               $wgUpdateRowsPerQuery, // jobs-per-title
-                               // Carry over information for de-duplication
-                               array( 'params' => $this->getRootJobParams() )
-                       );
-                       JobQueueGroup::singleton()->push( $jobs );
-               // Job to purge pages for for a set of titles
-               } elseif ( isset( $this->params['pages'] ) ) {
-                       $this->invalidateTitles( $this->params['pages'] );
-               // B/C for job to purge a range of backlink pages for a given page
-               } elseif ( $oldRangeJob ) {
-                       $titleArray = $this->title->getBacklinkCache()->getLinks(
-                               $this->params['table'], $this->params['start'], $this->params['end'] );
-
-                       $pages = array(); // same format BacklinkJobUtils uses
-                       foreach ( $titleArray as $tl ) {
-                               $pages[$tl->getArticleId()] = array( $tl->getNamespace(), $tl->getDbKey() );
-                       }
-
-                       $jobs = array();
-                       foreach ( array_chunk( $pages, $wgUpdateRowsPerJob ) as $pageChunk ) {
-                               $jobs[] = new HTMLCacheUpdateJob( $this->title,
-                                       array(
-                                               'table' => $this->params['table'],
-                                               'pages' => $pageChunk
-                                       ) + $this->getRootJobParams() // carry over information for de-duplication
-                               );
-                       }
-                       JobQueueGroup::singleton()->push( $jobs );
-               }
-
-               return true;
-       }
-
-       /**
-        * @param array $pages Map of (page ID => (namespace, DB key)) entries
-        */
-       protected function invalidateTitles( array $pages ) {
-               global $wgUpdateRowsPerQuery, $wgUseFileCache, $wgUseSquid;
-
-               // Get all page IDs in this query into an array
-               $pageIds = array_keys( $pages );
-               if ( !$pageIds ) {
-                       return;
-               }
-
-               $dbw = wfGetDB( DB_MASTER );
-
-               // The page_touched field will need to be bumped for these pages.
-               // Only bump it to the present time if no "rootJobTimestamp" was known.
-               // If it is known, it can be used instead, which avoids invalidating output
-               // that was in fact generated *after* the relevant dependency change time
-               // (e.g. template edit). This is particularily useful since refreshLinks jobs
-               // save back parser output and usually run along side htmlCacheUpdate jobs;
-               // their saved output would be invalidated by using the current timestamp.
-               if ( isset( $this->params['rootJobTimestamp'] ) ) {
-                       $touchTimestamp = $this->params['rootJobTimestamp'];
-               } else {
-                       $touchTimestamp = wfTimestampNow();
-               }
-
-               // Update page_touched (skipping pages already touched since the root job).
-               // Check $wgUpdateRowsPerQuery for sanity; batch jobs are sized by that already.
-               foreach ( array_chunk( $pageIds, $wgUpdateRowsPerQuery ) as $batch ) {
-                       $dbw->update( 'page',
-                               array( 'page_touched' => $dbw->timestamp( $touchTimestamp ) ),
-                               array( 'page_id' => $batch,
-                                       // don't invalidated pages that were already invalidated
-                                       "page_touched < " . $dbw->addQuotes( $dbw->timestamp( $touchTimestamp ) )
-                               ),
-                               __METHOD__
-                       );
-               }
-               // Get the list of affected pages (races only mean something else did the purge)
-               $titleArray = TitleArray::newFromResult( $dbw->select(
-                       'page',
-                       array( 'page_namespace', 'page_title' ),
-                       array( 'page_id' => $pageIds, 'page_touched' => $dbw->timestamp( $touchTimestamp ) ),
-                       __METHOD__
-               ) );
-
-               // Update squid
-               if ( $wgUseSquid ) {
-                       $u = SquidUpdate::newFromTitles( $titleArray );
-                       $u->doUpdate();
-               }
-
-               // Update file cache
-               if ( $wgUseFileCache ) {
-                       foreach ( $titleArray as $title ) {
-                               HTMLFileCache::clearFileCache( $title );
-                       }
-               }
-       }
-
-       public function workItemCount() {
-               return isset( $this->params['pages'] ) ? count( $this->params['pages'] ) : 1;
-       }
-}
diff --git a/includes/job/jobs/NullJob.php b/includes/job/jobs/NullJob.php
deleted file mode 100644 (file)
index b2d6a9a..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-/**
- * Degenerate job that does nothing.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Cache
- */
-
-/**
- * Degenerate job that does nothing, but can optionally replace itself
- * in the queue and/or sleep for a brief time period. These can be used
- * to represent "no-op" jobs or test lock contention and performance.
- *
- * @par Example:
- * Inserting a null job in the configured job queue:
- * @code
- * $ php maintenance/eval.php
- * > $queue = JobQueueGroup::singleton();
- * > $job = new NullJob( Title::newMainPage(), array( 'lives' => 10 ) );
- * > $queue->push( $job );
- * @endcode
- * You can then confirm the job has been enqueued by using the showJobs.php
- * maintenance utility:
- * @code
- * $ php maintenance/showJobs.php --group
- * null: 1 queue; 0 claimed (0 active, 0 abandoned)
- * $
- * @endcode
- *
- * @ingroup JobQueue
- */
-class NullJob extends Job {
-       /**
-        * @param Title $title
-        * @param array $params job parameters (lives, usleep)
-        */
-       function __construct( $title, $params ) {
-               parent::__construct( 'null', $title, $params );
-               if ( !isset( $this->params['lives'] ) ) {
-                       $this->params['lives'] = 1;
-               }
-               if ( !isset( $this->params['usleep'] ) ) {
-                       $this->params['usleep'] = 0;
-               }
-               $this->removeDuplicates = !empty( $this->params['removeDuplicates'] );
-       }
-
-       public function run() {
-               if ( $this->params['usleep'] > 0 ) {
-                       usleep( $this->params['usleep'] );
-               }
-               if ( $this->params['lives'] > 1 ) {
-                       $params = $this->params;
-                       $params['lives']--;
-                       $job = new self( $this->title, $params );
-                       JobQueueGroup::singleton()->push( $job );
-               }
-
-               return true;
-       }
-}
diff --git a/includes/job/jobs/PublishStashedFileJob.php b/includes/job/jobs/PublishStashedFileJob.php
deleted file mode 100644 (file)
index d7667f3..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-<?php
-/**
- * Upload a file from the upload stash into the local file repo.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Upload
- */
-
-/**
- * Upload a file from the upload stash into the local file repo.
- *
- * @ingroup Upload
- */
-class PublishStashedFileJob extends Job {
-       public function __construct( $title, $params ) {
-               parent::__construct( 'PublishStashedFile', $title, $params );
-               $this->removeDuplicates = true;
-       }
-
-       public function run() {
-               $scope = RequestContext::importScopedSession( $this->params['session'] );
-               $context = RequestContext::getMain();
-               try {
-                       $user = $context->getUser();
-                       if ( !$user->isLoggedIn() ) {
-                               $this->setLastError( "Could not load the author user from session." );
-
-                               return false;
-                       }
-
-                       if ( count( $_SESSION ) === 0 ) {
-                               // Empty session probably indicates that we didn't associate
-                               // with the session correctly. Note that being able to load
-                               // the user does not necessarily mean the session was loaded.
-                               // Most likely cause by suhosin.session.encrypt = On.
-                               $this->setLastError( "Error associating with user session. " .
-                                       "Try setting suhosin.session.encrypt = Off" );
-
-                               return false;
-                       }
-
-                       UploadBase::setSessionStatus(
-                               $this->params['filekey'],
-                               array( 'result' => 'Poll', 'stage' => 'publish', 'status' => Status::newGood() )
-                       );
-
-                       $upload = new UploadFromStash( $user );
-                       // @todo initialize() causes a GET, ideally we could frontload the antivirus
-                       // checks and anything else to the stash stage (which includes concatenation and
-                       // the local file is thus already there). That way, instead of GET+PUT, there could
-                       // just be a COPY operation from the stash to the public zone.
-                       $upload->initialize( $this->params['filekey'], $this->params['filename'] );
-
-                       // Check if the local file checks out (this is generally a no-op)
-                       $verification = $upload->verifyUpload();
-                       if ( $verification['status'] !== UploadBase::OK ) {
-                               $status = Status::newFatal( 'verification-error' );
-                               $status->value = array( 'verification' => $verification );
-                               UploadBase::setSessionStatus(
-                                       $this->params['filekey'],
-                                       array( 'result' => 'Failure', 'stage' => 'publish', 'status' => $status )
-                               );
-                               $this->setLastError( "Could not verify upload." );
-
-                               return false;
-                       }
-
-                       // Upload the stashed file to a permanent location
-                       $status = $upload->performUpload(
-                               $this->params['comment'],
-                               $this->params['text'],
-                               $this->params['watch'],
-                               $user
-                       );
-                       if ( !$status->isGood() ) {
-                               UploadBase::setSessionStatus(
-                                       $this->params['filekey'],
-                                       array( 'result' => 'Failure', 'stage' => 'publish', 'status' => $status )
-                               );
-                               $this->setLastError( $status->getWikiText() );
-
-                               return false;
-                       }
-
-                       // Build the image info array while we have the local reference handy
-                       $apiMain = new ApiMain(); // dummy object (XXX)
-                       $imageInfo = $upload->getImageInfo( $apiMain->getResult() );
-
-                       // Cleanup any temporary local file
-                       $upload->cleanupTempFile();
-
-                       // Cache the info so the user doesn't have to wait forever to get the final info
-                       UploadBase::setSessionStatus(
-                               $this->params['filekey'],
-                               array(
-                                       'result' => 'Success',
-                                       'stage' => 'publish',
-                                       'filename' => $upload->getLocalFile()->getName(),
-                                       'imageinfo' => $imageInfo,
-                                       'status' => Status::newGood()
-                               )
-                       );
-               } catch ( MWException $e ) {
-                       UploadBase::setSessionStatus(
-                               $this->params['filekey'],
-                               array(
-                                       'result' => 'Failure',
-                                       'stage' => 'publish',
-                                       'status' => Status::newFatal( 'api-error-publishfailed' )
-                               )
-                       );
-                       $this->setLastError( get_class( $e ) . ": " . $e->getText() );
-
-                       return false;
-               }
-
-               return true;
-       }
-
-       public function getDeduplicationInfo() {
-               $info = parent::getDeduplicationInfo();
-               if ( is_array( $info['params'] ) ) {
-                       $info['params'] = array( 'filekey' => $info['params']['filekey'] );
-               }
-
-               return $info;
-       }
-
-       public function allowRetries() {
-               return false;
-       }
-}
diff --git a/includes/job/jobs/RefreshLinksJob.php b/includes/job/jobs/RefreshLinksJob.php
deleted file mode 100644 (file)
index 3bcb4fc..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-<?php
-/**
- * Job to update link tables for pages
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup JobQueue
- */
-
-/**
- * Job to update link tables for pages
- *
- * This job comes in a few variants:
- *   - a) Recursive jobs to update links for backlink pages for a given title.
- *        These jobs have have (recursive:true,table:<table>) set.
- *   - b) Jobs to update links for a set of pages (the job title is ignored).
- *           These jobs have have (pages:(<page ID>:(<namespace>,<title>),...) set.
- *   - c) Jobs to update links for a single page (the job title)
- *        These jobs need no extra fields set.
- *
- * @ingroup JobQueue
- */
-class RefreshLinksJob extends Job {
-       const PARSE_THRESHOLD_SEC = 1.0;
-
-       function __construct( $title, $params = '' ) {
-               parent::__construct( 'refreshLinks', $title, $params );
-               // Base backlink update jobs and per-title update jobs can be de-duplicated.
-               // If template A changes twice before any jobs run, a clean queue will have:
-               //              (A base, A base)
-               // The second job is ignored by the queue on insertion.
-               // Suppose, many pages use template A, and that template itself uses template B.
-               // An edit to both will first create two base jobs. A clean FIFO queue will have:
-               //              (A base, B base)
-               // When these jobs run, the queue will have per-title and remnant partition jobs:
-               //              (titleX,titleY,titleZ,...,A remnant,titleM,titleN,titleO,...,B remnant)
-               // Some these jobs will be the same, and will automatically be ignored by
-               // the queue upon insertion. Some title jobs will run before the duplicate is
-               // inserted, so the work will still be done twice in those cases. More titles
-               // can be de-duplicated as the remnant jobs continue to be broken down. This
-               // works best when $wgUpdateRowsPerJob, and either the pages have few backlinks
-               // and/or the backlink sets for pages A and B are almost identical.
-               $this->removeDuplicates = !isset( $params['range'] )
-                       && ( !isset( $params['pages'] ) || count( $params['pages'] ) == 1 );
-       }
-
-       function run() {
-               global $wgUpdateRowsPerJob;
-
-               // Job to update all (or a range of) backlink pages for a page
-               if ( !empty( $this->params['recursive'] ) ) {
-                       // Carry over information for de-duplication
-                       $extraParams = $this->getRootJobParams();
-                       // Avoid slave lag when fetching templates.
-                       // When the outermost job is run, we know that the caller that enqueued it must have
-                       // committed the relevant changes to the DB by now. At that point, record the master
-                       // position and pass it along as the job recursively breaks into smaller range jobs.
-                       // Hopefully, when leaf jobs are popped, the slaves will have reached that position.
-                       if ( isset( $this->params['masterPos'] ) ) {
-                               $extraParams['masterPos'] = $this->params['masterPos'];
-                       } elseif ( wfGetLB()->getServerCount() > 1 ) {
-                               $extraParams['masterPos'] = wfGetLB()->getMasterPos();
-                       } else {
-                               $extraParams['masterPos'] = false;
-                       }
-                       // Convert this into no more than $wgUpdateRowsPerJob RefreshLinks per-title
-                       // jobs and possibly a recursive RefreshLinks job for the rest of the backlinks
-                       $jobs = BacklinkJobUtils::partitionBacklinkJob(
-                               $this,
-                               $wgUpdateRowsPerJob,
-                               1, // job-per-title
-                               array( 'params' => $extraParams )
-                       );
-                       JobQueueGroup::singleton()->push( $jobs );
-               // Job to update link tables for for a set of titles
-               } elseif ( isset( $this->params['pages'] ) ) {
-                       foreach ( $this->params['pages'] as $pageId => $nsAndKey ) {
-                               list( $ns, $dbKey ) = $nsAndKey;
-                               $this->runForTitle( Title::makeTitleSafe( $ns, $dbKey ) );
-                       }
-               // Job to update link tables for a given title
-               } else {
-                       $this->runForTitle( $this->title );
-               }
-
-               return true;
-       }
-
-       protected function runForTitle( Title $title = null ) {
-               $linkCache = LinkCache::singleton();
-               $linkCache->clear();
-
-               if ( is_null( $title ) ) {
-                       $this->setLastError( "refreshLinks: Invalid title" );
-                       return false;
-               }
-
-               // Wait for the DB of the current/next slave DB handle to catch up to the master.
-               // This way, we get the correct page_latest for templates or files that just changed
-               // milliseconds ago, having triggered this job to begin with.
-               if ( isset( $this->params['masterPos'] ) && $this->params['masterPos'] !== false ) {
-                       wfGetLB()->waitFor( $this->params['masterPos'] );
-               }
-
-               $page = WikiPage::factory( $title );
-
-               // Fetch the current revision...
-               $revision = Revision::newFromTitle( $title, false, Revision::READ_NORMAL );
-               if ( !$revision ) {
-                       $this->setLastError( "refreshLinks: Article not found {$title->getPrefixedDBkey()}" );
-                       return false; // XXX: what if it was just deleted?
-               }
-               $content = $revision->getContent( Revision::RAW );
-               if ( !$content ) {
-                       // If there is no content, pretend the content is empty
-                       $content = $revision->getContentHandler()->makeEmptyContent();
-               }
-
-               $parserOutput = false;
-               $parserOptions = $page->makeParserOptions( 'canonical' );
-               // If page_touched changed after this root job (with a good slave lag skew factor),
-               // then it is likely that any views of the pages already resulted in re-parses which
-               // are now in cache. This can be reused to avoid expensive parsing in some cases.
-               if ( isset( $this->params['rootJobTimestamp'] ) ) {
-                       $skewedTimestamp = wfTimestamp( TS_UNIX, $this->params['rootJobTimestamp'] ) + 5;
-                       if ( $page->getLinksTimestamp() > wfTimestamp( TS_MW, $skewedTimestamp ) ) {
-                               // Something already updated the backlinks since this job was made
-                               return true;
-                       }
-                       if ( $page->getTouched() > wfTimestamp( TS_MW, $skewedTimestamp ) ) {
-                               $parserOutput = ParserCache::singleton()->getDirty( $page, $parserOptions );
-                               if ( $parserOutput && $parserOutput->getCacheTime() <= $skewedTimestamp ) {
-                                       $parserOutput = false; // too stale
-                               }
-                       }
-               }
-               // Fetch the current revision and parse it if necessary...
-               if ( $parserOutput == false ) {
-                       $start = microtime( true );
-                       // Revision ID must be passed to the parser output to get revision variables correct
-                       $parserOutput = $content->getParserOutput(
-                               $title, $revision->getId(), $parserOptions, false );
-                       $ellapsed = microtime( true ) - $start;
-                       // If it took a long time to render, then save this back to the cache to avoid
-                       // wasted CPU by other apaches or job runners. We don't want to always save to
-                       // cache as this cause cause high cache I/O and LRU churn when a template changes.
-                       if ( $ellapsed >= self::PARSE_THRESHOLD_SEC
-                               && $page->isParserCacheUsed( $parserOptions, $revision->getId() )
-                               && $parserOutput->isCacheable()
-                       ) {
-                               $ctime = wfTimestamp( TS_MW, (int)$start ); // cache time
-                               ParserCache::singleton()->save( $parserOutput, $page, $parserOptions, $ctime );
-                       }
-               }
-
-               $updates = $content->getSecondaryDataUpdates( $title, null, false, $parserOutput );
-               DataUpdate::runUpdates( $updates );
-
-               InfoAction::invalidateCache( $title );
-
-               return true;
-       }
-
-       public function getDeduplicationInfo() {
-               $info = parent::getDeduplicationInfo();
-               if ( is_array( $info['params'] ) ) {
-                       // Don't let highly unique "masterPos" values ruin duplicate detection
-                       unset( $info['params']['masterPos'] );
-                       // For per-pages jobs, the job title is that of the template that changed
-                       // (or similar), so remove that since it ruins duplicate detection
-                       if ( isset( $info['pages'] ) ) {
-                               unset( $info['namespace'] );
-                               unset( $info['title'] );
-                       }
-               }
-
-               return $info;
-       }
-
-       public function workItemCount() {
-               return isset( $this->params['pages'] ) ? count( $this->params['pages'] ) : 1;
-       }
-}
diff --git a/includes/job/jobs/RefreshLinksJob2.php b/includes/job/jobs/RefreshLinksJob2.php
deleted file mode 100644 (file)
index 77e3b3f..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-<?php
-/**
- * Job to update links for a given title.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup JobQueue
- */
-
-/**
- * Background job to update links for titles in certain backlink range by page ID.
- * Newer version for high use templates. This is deprecated by RefreshLinksPartitionJob.
- *
- * @ingroup JobQueue
- * @deprecated 1.23
- */
-class RefreshLinksJob2 extends Job {
-       function __construct( $title, $params ) {
-               parent::__construct( 'refreshLinks2', $title, $params );
-               // Base jobs for large templates can easily be de-duplicated
-               $this->removeDuplicates = !isset( $params['start'] ) && !isset( $params['end'] );
-       }
-
-       /**
-        * Run a refreshLinks2 job
-        * @return boolean success
-        */
-       function run() {
-               global $wgUpdateRowsPerJob;
-
-               $linkCache = LinkCache::singleton();
-               $linkCache->clear();
-
-               if ( is_null( $this->title ) ) {
-                       $this->error = "refreshLinks2: Invalid title";
-                       return false;
-               }
-
-               // Back compat for pre-r94435 jobs
-               $table = isset( $this->params['table'] ) ? $this->params['table'] : 'templatelinks';
-
-               // Avoid slave lag when fetching templates.
-               // When the outermost job is run, we know that the caller that enqueued it must have
-               // committed the relevant changes to the DB by now. At that point, record the master
-               // position and pass it along as the job recursively breaks into smaller range jobs.
-               // Hopefully, when leaf jobs are popped, the slaves will have reached that position.
-               if ( isset( $this->params['masterPos'] ) ) {
-                       $masterPos = $this->params['masterPos'];
-               } elseif ( wfGetLB()->getServerCount() > 1 ) {
-                       $masterPos = wfGetLB()->getMasterPos();
-               } else {
-                       $masterPos = false;
-               }
-
-               $tbc = $this->title->getBacklinkCache();
-
-               $jobs = array(); // jobs to insert
-               if ( isset( $this->params['start'] ) && isset( $this->params['end'] ) ) {
-                       # This is a partition job to trigger the insertion of leaf jobs...
-                       $jobs = array_merge( $jobs, $this->getSingleTitleJobs( $table, $masterPos ) );
-               } else {
-                       # This is a base job to trigger the insertion of partitioned jobs...
-                       if ( $tbc->getNumLinks( $table, $wgUpdateRowsPerJob + 1 ) <= $wgUpdateRowsPerJob ) {
-                               # Just directly insert the single per-title jobs
-                               $jobs = array_merge( $jobs, $this->getSingleTitleJobs( $table, $masterPos ) );
-                       } else {
-                               # Insert the partition jobs to make per-title jobs
-                               foreach ( $tbc->partition( $table, $wgUpdateRowsPerJob ) as $batch ) {
-                                       list( $start, $end ) = $batch;
-                                       $jobs[] = new RefreshLinksJob2( $this->title,
-                                               array(
-                                                       'table' => $table,
-                                                       'start' => $start,
-                                                       'end' => $end,
-                                                       'masterPos' => $masterPos,
-                                               ) + $this->getRootJobParams() // carry over information for de-duplication
-                                       );
-                               }
-                       }
-               }
-
-               if ( count( $jobs ) ) {
-                       JobQueueGroup::singleton()->push( $jobs );
-               }
-
-               return true;
-       }
-
-       /**
-        * @param $table string
-        * @param $masterPos mixed
-        * @return Array
-        */
-       protected function getSingleTitleJobs( $table, $masterPos ) {
-               # The "start"/"end" fields are not set for the base jobs
-               $start = isset( $this->params['start'] ) ? $this->params['start'] : false;
-               $end = isset( $this->params['end'] ) ? $this->params['end'] : false;
-               $titles = $this->title->getBacklinkCache()->getLinks( $table, $start, $end );
-               # Convert into single page refresh links jobs.
-               # This handles well when in sapi mode and is useful in any case for job
-               # de-duplication. If many pages use template A, and that template itself
-               # uses template B, then an edit to both will create many duplicate jobs.
-               # Roughly speaking, for each page, one of the "RefreshLinksJob" jobs will
-               # get run first, and when it does, it will remove the duplicates. Of course,
-               # one page could have its job popped when the other page's job is still
-               # buried within the logic of a refreshLinks2 job.
-               $jobs = array();
-               foreach ( $titles as $title ) {
-                       $jobs[] = new RefreshLinksJob( $title,
-                               array( 'masterPos' => $masterPos ) + $this->getRootJobParams()
-                       ); // carry over information for de-duplication
-               }
-               return $jobs;
-       }
-
-       /**
-        * @return Array
-        */
-       public function getDeduplicationInfo() {
-               $info = parent::getDeduplicationInfo();
-               // Don't let highly unique "masterPos" values ruin duplicate detection
-               if ( is_array( $info['params'] ) ) {
-                       unset( $info['params']['masterPos'] );
-               }
-               return $info;
-       }
-}
diff --git a/includes/job/jobs/UploadFromUrlJob.php b/includes/job/jobs/UploadFromUrlJob.php
deleted file mode 100644 (file)
index 2cdac57..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-<?php
-/**
- * Job for asynchronous upload-by-url.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup JobQueue
- */
-
-/**
- * Job for asynchronous upload-by-url.
- *
- * This job is in fact an interface to UploadFromUrl, which is designed such
- * that it does not require any globals. If it does, fix it elsewhere, do not
- * add globals in here.
- *
- * @ingroup JobQueue
- */
-class UploadFromUrlJob extends Job {
-       const SESSION_KEYNAME = 'wsUploadFromUrlJobData';
-
-       /** @var UploadFromUrl */
-       public $upload;
-
-       /** @var User */
-       protected $user;
-
-       public function __construct( $title, $params ) {
-               parent::__construct( 'uploadFromUrl', $title, $params );
-       }
-
-       public function run() {
-               global $wgCopyUploadAsyncTimeout;
-               # Initialize this object and the upload object
-               $this->upload = new UploadFromUrl();
-               $this->upload->initialize(
-                       $this->title->getText(),
-                       $this->params['url'],
-                       false
-               );
-               $this->user = User::newFromName( $this->params['userName'] );
-
-               # Fetch the file
-               $opts = array();
-               if ( $wgCopyUploadAsyncTimeout ) {
-                       $opts['timeout'] = $wgCopyUploadAsyncTimeout;
-               }
-               $status = $this->upload->fetchFile( $opts );
-               if ( !$status->isOk() ) {
-                       $this->leaveMessage( $status );
-
-                       return true;
-               }
-
-               # Verify upload
-               $result = $this->upload->verifyUpload();
-               if ( $result['status'] != UploadBase::OK ) {
-                       $status = $this->upload->convertVerifyErrorToStatus( $result );
-                       $this->leaveMessage( $status );
-
-                       return true;
-               }
-
-               # Check warnings
-               if ( !$this->params['ignoreWarnings'] ) {
-                       $warnings = $this->upload->checkWarnings();
-                       if ( $warnings ) {
-
-                               # Stash the upload
-                               $key = $this->upload->stashFile();
-
-                               // @todo FIXME: This has been broken for a while.
-                               // User::leaveUserMessage() does not exist.
-                               if ( $this->params['leaveMessage'] ) {
-                                       $this->user->leaveUserMessage(
-                                               wfMessage( 'upload-warning-subj' )->text(),
-                                               wfMessage( 'upload-warning-msg',
-                                                       $key,
-                                                       $this->params['url'] )->text()
-                                       );
-                               } else {
-                                       wfSetupSession( $this->params['sessionId'] );
-                                       $this->storeResultInSession( 'Warning',
-                                               'warnings', $warnings );
-                                       session_write_close();
-                               }
-
-                               return true;
-                       }
-               }
-
-               # Perform the upload
-               $status = $this->upload->performUpload(
-                       $this->params['comment'],
-                       $this->params['pageText'],
-                       $this->params['watch'],
-                       $this->user
-               );
-               $this->leaveMessage( $status );
-
-               return true;
-       }
-
-       /**
-        * Leave a message on the user talk page or in the session according to
-        * $params['leaveMessage'].
-        *
-        * @param Status $status
-        */
-       protected function leaveMessage( $status ) {
-               if ( $this->params['leaveMessage'] ) {
-                       if ( $status->isGood() ) {
-                               // @todo FIXME: user->leaveUserMessage does not exist.
-                               $this->user->leaveUserMessage( wfMessage( 'upload-success-subj' )->text(),
-                                       wfMessage( 'upload-success-msg',
-                                               $this->upload->getTitle()->getText(),
-                                               $this->params['url']
-                                       )->text() );
-                       } else {
-                               // @todo FIXME: user->leaveUserMessage does not exist.
-                               $this->user->leaveUserMessage( wfMessage( 'upload-failure-subj' )->text(),
-                                       wfMessage( 'upload-failure-msg',
-                                               $status->getWikiText(),
-                                               $this->params['url']
-                                       )->text() );
-                       }
-               } else {
-                       wfSetupSession( $this->params['sessionId'] );
-                       if ( $status->isOk() ) {
-                               $this->storeResultInSession( 'Success',
-                                       'filename', $this->upload->getLocalFile()->getName() );
-                       } else {
-                               $this->storeResultInSession( 'Failure',
-                                       'errors', $status->getErrorsArray() );
-                       }
-                       session_write_close();
-               }
-       }
-
-       /**
-        * Store a result in the session data. Note that the caller is responsible
-        * for appropriate session_start and session_write_close calls.
-        *
-        * @param string $result the result (Success|Warning|Failure)
-        * @param string $dataKey the key of the extra data
-        * @param mixed $dataValue The extra data itself
-        */
-       protected function storeResultInSession( $result, $dataKey, $dataValue ) {
-               $session =& self::getSessionData( $this->params['sessionKey'] );
-               $session['result'] = $result;
-               $session[$dataKey] = $dataValue;
-       }
-
-       /**
-        * Initialize the session data. Sets the intial result to queued.
-        */
-       public function initializeSessionData() {
-               $session =& self::getSessionData( $this->params['sessionKey'] );
-               $$session['result'] = 'Queued';
-       }
-
-       /**
-        * @param $key
-        * @return mixed
-        */
-       public static function &getSessionData( $key ) {
-               if ( !isset( $_SESSION[self::SESSION_KEYNAME][$key] ) ) {
-                       $_SESSION[self::SESSION_KEYNAME][$key] = array();
-               }
-
-               return $_SESSION[self::SESSION_KEYNAME][$key];
-       }
-}
diff --git a/includes/job/utils/BacklinkJobUtils.php b/includes/job/utils/BacklinkJobUtils.php
deleted file mode 100644 (file)
index c8e5df6..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php
-/**
- * Job to update links for a given title.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup JobQueue
- * @author Aaron Schulz
- */
-
-/**
- * Class with Backlink related Job helper methods
- *
- * @ingroup JobQueue
- * @since 1.23
- */
-class BacklinkJobUtils {
-       /**
-        * Break down $job into approximately ($bSize/$cSize) leaf jobs and a single partition
-        * job that covers the remaining backlink range (if needed). Jobs for the first $bSize
-        * titles are collated ($cSize per job) into leaf jobs to do actual work. All the
-        * resulting jobs are of the same class as $job. No partition job is returned if the
-        * range covered by $job was less than $bSize, as the leaf jobs have full coverage.
-        *
-        * The leaf jobs have the 'pages' param set to a (<page ID>:(<namespace>,<DB key>),...)
-        * map so that the run() function knows what pages to act on. The leaf jobs will keep
-        * the same job title as the parent job (e.g. $job).
-        *
-        * The partition jobs have the 'range' parameter set to a map of the format
-        * (start:<integer>, end:<integer>, batchSize:<integer>, subranges:((<start>,<end>),...)),
-        * the 'table' parameter set to that of $job, and the 'recursive' parameter set to true.
-        * This method can be called on the resulting job to repeat the process again.
-        *
-        * The job provided ($job) must have the 'recursive' parameter set to true and the 'table'
-        * parameter must be set to a backlink table. The job title will be used as the title to
-        * find backlinks for. Any 'range' parameter must follow the same format as mentioned above.
-        * This should be managed by recursive calls to this method.
-        *
-        * The first jobs return are always the leaf jobs. This lets the caller use push() to
-        * put them directly into the queue and works well if the queue is FIFO. In such a queue,
-        * the leaf jobs have to get finished first before anything can resolve the next partition
-        * job, which keeps the queue very small.
-        *
-        * $opts includes:
-        *   - params : extra job parameters to include in each job
-        *
-        * @param Job $job
-        * @param int $bSize BacklinkCache partition size; usually $wgUpdateRowsPerJob
-        * @param int $cSize Max titles per leaf job; Usually 1 or a modest value
-        * @param array $opts Optional parameter map
-        * @return Job[] List of Job objects
-        */
-       public static function partitionBacklinkJob( Job $job, $bSize, $cSize, $opts = array() ) {
-               $class = get_class( $job );
-               $title = $job->getTitle();
-               $params = $job->getParams();
-
-               if ( isset( $params['pages'] ) || empty( $params['recursive'] ) ) {
-                       $ranges = array(); // sanity; this is a leaf node
-                       wfWarn( __METHOD__ . " called on {$job->getType()} leaf job (explosive recursion)." );
-               } elseif ( isset( $params['range'] ) ) {
-                       // This is a range job to trigger the insertion of partitioned/title jobs...
-                       $ranges = $params['range']['subranges'];
-                       $realBSize = $params['range']['batchSize'];
-               } else {
-                       // This is a base job to trigger the insertion of partitioned jobs...
-                       $ranges = $title->getBacklinkCache()->partition( $params['table'], $bSize );
-                       $realBSize = $bSize;
-               }
-
-               $extraParams = isset( $opts['params'] ) ? $opts['params'] : array();
-
-               $jobs = array();
-               // Combine the first range (of size $bSize) backlinks into leaf jobs
-               if ( isset( $ranges[0] ) ) {
-                       list( $start, $end ) = $ranges[0];
-                       $titles = $title->getBacklinkCache()->getLinks( $params['table'], $start, $end );
-                       foreach ( array_chunk( iterator_to_array( $titles ), $cSize ) as $titleBatch ) {
-                               $pages = array();
-                               foreach ( $titleBatch as $tl ) {
-                                       $pages[$tl->getArticleId()] = array( $tl->getNamespace(), $tl->getDBKey() );
-                               }
-                               $jobs[] = new $class(
-                                       $title, // maintain parent job title
-                                       array( 'pages' => $pages ) + $extraParams
-                               );
-                       }
-               }
-               // Take all of the remaining ranges and build a partition job from it
-               if ( isset( $ranges[1] ) ) {
-                       $jobs[] = new $class(
-                               $title, // maintain parent job title
-                               array(
-                                       'recursive'     => true,
-                                       'table'         => $params['table'],
-                                       'range'         => array(
-                                               'start'     => $ranges[1][0],
-                                               'end'       => $ranges[count( $ranges ) - 1][1],
-                                               'batchSize' => $realBSize,
-                                               'subranges' => array_slice( $ranges, 1 )
-                                       ),
-                               ) + $extraParams
-                       );
-               }
-
-               return $jobs;
-       }
-}
diff --git a/includes/jobqueue/Job.php b/includes/jobqueue/Job.php
new file mode 100644 (file)
index 0000000..5fc1e06
--- /dev/null
@@ -0,0 +1,330 @@
+<?php
+/**
+ * Job queue task base code.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @defgroup JobQueue JobQueue
+ */
+
+/**
+ * Class to both describe a background job and handle jobs.
+ * The queue aspects of this class are now deprecated.
+ * Using the class to push jobs onto queues is deprecated (use JobSpecification).
+ *
+ * @ingroup JobQueue
+ */
+abstract class Job implements IJobSpecification {
+       /** @var string */
+       public $command;
+
+       /** @var array|bool Array of job parameters or false if none */
+       public $params;
+
+       /** @var array Additional queue metadata */
+       public $metadata = array();
+
+       /** @var Title */
+       protected $title;
+
+       /** @var bool Expensive jobs may set this to true */
+       protected $removeDuplicates;
+
+       /** @var string Text for error that occurred last */
+       protected $error;
+
+       /*-------------------------------------------------------------------------
+        * Abstract functions
+        *------------------------------------------------------------------------*/
+
+       /**
+        * Run the job
+        * @return bool Success
+        */
+       abstract public function run();
+
+       /*-------------------------------------------------------------------------
+        * Static functions
+        *------------------------------------------------------------------------*/
+
+       /**
+        * Create the appropriate object to handle a specific job
+        *
+        * @param string $command Job command
+        * @param Title $title Associated title
+        * @param array|bool $params Job parameters
+        * @throws MWException
+        * @return Job
+        */
+       public static function factory( $command, Title $title, $params = false ) {
+               global $wgJobClasses;
+               if ( isset( $wgJobClasses[$command] ) ) {
+                       $class = $wgJobClasses[$command];
+
+                       return new $class( $title, $params );
+               }
+               throw new MWException( "Invalid job command `{$command}`" );
+       }
+
+       /**
+        * Batch-insert a group of jobs into the queue.
+        * This will be wrapped in a transaction with a forced commit.
+        *
+        * This may add duplicate at insert time, but they will be
+        * removed later on, when the first one is popped.
+        *
+        * @param array $jobs of Job objects
+        * @return bool
+        * @deprecated since 1.21
+        */
+       public static function batchInsert( $jobs ) {
+               return JobQueueGroup::singleton()->push( $jobs );
+       }
+
+       /**
+        * Insert a group of jobs into the queue.
+        *
+        * Same as batchInsert() but does not commit and can thus
+        * be rolled-back as part of a larger transaction. However,
+        * large batches of jobs can cause slave lag.
+        *
+        * @param array $jobs of Job objects
+        * @return bool
+        * @deprecated since 1.21
+        */
+       public static function safeBatchInsert( $jobs ) {
+               return JobQueueGroup::singleton()->push( $jobs, JobQueue::QOS_ATOMIC );
+       }
+
+       /**
+        * Pop a job of a certain type.  This tries less hard than pop() to
+        * actually find a job; it may be adversely affected by concurrent job
+        * runners.
+        *
+        * @param $type string
+        * @return Job|bool Returns false if there are no jobs
+        * @deprecated since 1.21
+        */
+       public static function pop_type( $type ) {
+               return JobQueueGroup::singleton()->get( $type )->pop();
+       }
+
+       /**
+        * Pop a job off the front of the queue.
+        * This is subject to $wgJobTypesExcludedFromDefaultQueue.
+        *
+        * @return Job|bool False if there are no jobs
+        * @deprecated since 1.21
+        */
+       public static function pop() {
+               return JobQueueGroup::singleton()->pop();
+       }
+
+       /*-------------------------------------------------------------------------
+        * Non-static functions
+        *------------------------------------------------------------------------*/
+
+       /**
+        * @param $command
+        * @param $title
+        * @param $params array|bool
+        */
+       public function __construct( $command, $title, $params = false ) {
+               $this->command = $command;
+               $this->title = $title;
+               $this->params = $params;
+
+               // expensive jobs may set this to true
+               $this->removeDuplicates = false;
+       }
+
+       /**
+        * @return string
+        */
+       public function getType() {
+               return $this->command;
+       }
+
+       /**
+        * @return Title
+        */
+       public function getTitle() {
+               return $this->title;
+       }
+
+       /**
+        * @return array
+        */
+       public function getParams() {
+               return $this->params;
+       }
+
+       /**
+        * @return int|null UNIX timestamp to delay running this job until, otherwise null
+        * @since 1.22
+        */
+       public function getReleaseTimestamp() {
+               return isset( $this->params['jobReleaseTimestamp'] )
+                       ? wfTimestampOrNull( TS_UNIX, $this->params['jobReleaseTimestamp'] )
+                       : null;
+       }
+
+       /**
+        * @return bool Whether only one of each identical set of jobs should be run
+        */
+       public function ignoreDuplicates() {
+               return $this->removeDuplicates;
+       }
+
+       /**
+        * @return bool Whether this job can be retried on failure by job runners
+        * @since 1.21
+        */
+       public function allowRetries() {
+               return true;
+       }
+
+       /**
+        * @return integer Number of actually "work items" handled in this job
+        * @see $wgJobBackoffThrottling
+        * @since 1.23
+        */
+       public function workItemCount() {
+               return 1;
+       }
+
+       /**
+        * Subclasses may need to override this to make duplication detection work.
+        * The resulting map conveys everything that makes the job unique. This is
+        * only checked if ignoreDuplicates() returns true, meaning that duplicate
+        * jobs are supposed to be ignored.
+        *
+        * @return array Map of key/values
+        * @since 1.21
+        */
+       public function getDeduplicationInfo() {
+               $info = array(
+                       'type' => $this->getType(),
+                       'namespace' => $this->getTitle()->getNamespace(),
+                       'title' => $this->getTitle()->getDBkey(),
+                       'params' => $this->getParams()
+               );
+               if ( is_array( $info['params'] ) ) {
+                       // Identical jobs with different "root" jobs should count as duplicates
+                       unset( $info['params']['rootJobSignature'] );
+                       unset( $info['params']['rootJobTimestamp'] );
+                       // Likewise for jobs with different delay times
+                       unset( $info['params']['jobReleaseTimestamp'] );
+               }
+
+               return $info;
+       }
+
+       /**
+        * @see JobQueue::deduplicateRootJob()
+        * @param string $key A key that identifies the task
+        * @return array Map of:
+        *   - rootJobSignature : hash (e.g. SHA1) that identifies the task
+        *   - rootJobTimestamp : TS_MW timestamp of this instance of the task
+        * @since 1.21
+        */
+       public static function newRootJobParams( $key ) {
+               return array(
+                       'rootJobSignature' => sha1( $key ),
+                       'rootJobTimestamp' => wfTimestampNow()
+               );
+       }
+
+       /**
+        * @see JobQueue::deduplicateRootJob()
+        * @return array
+        * @since 1.21
+        */
+       public function getRootJobParams() {
+               return array(
+                       'rootJobSignature' => isset( $this->params['rootJobSignature'] )
+                               ? $this->params['rootJobSignature']
+                               : null,
+                       'rootJobTimestamp' => isset( $this->params['rootJobTimestamp'] )
+                               ? $this->params['rootJobTimestamp']
+                               : null
+               );
+       }
+
+       /**
+        * @see JobQueue::deduplicateRootJob()
+        * @return bool
+        * @since 1.22
+        */
+       public function hasRootJobParams() {
+               return isset( $this->params['rootJobSignature'] )
+                       && isset( $this->params['rootJobTimestamp'] );
+       }
+
+       /**
+        * Insert a single job into the queue.
+        * @return bool true on success
+        * @deprecated since 1.21
+        */
+       public function insert() {
+               return JobQueueGroup::singleton()->push( $this );
+       }
+
+       /**
+        * @return string
+        */
+       public function toString() {
+               $paramString = '';
+               if ( $this->params ) {
+                       foreach ( $this->params as $key => $value ) {
+                               if ( $paramString != '' ) {
+                                       $paramString .= ' ';
+                               }
+                               if ( is_array( $value ) ) {
+                                       $value = "array(" . count( $value ) . ")";
+                               } elseif ( is_object( $value ) && !method_exists( $value, '__toString' ) ) {
+                                       $value = "object(" . get_class( $value ) . ")";
+                               }
+                               $value = (string)$value;
+                               if ( mb_strlen( $value ) > 1024 ) {
+                                       $value = "string(" . mb_strlen( $value ) . ")";
+                               }
+
+                               $paramString .= "$key=$value";
+                       }
+               }
+
+               if ( is_object( $this->title ) ) {
+                       $s = "{$this->command} " . $this->title->getPrefixedDBkey();
+                       if ( $paramString !== '' ) {
+                               $s .= ' ' . $paramString;
+                       }
+
+                       return $s;
+               } else {
+                       return "{$this->command} $paramString";
+               }
+       }
+
+       protected function setLastError( $error ) {
+               $this->error = $error;
+       }
+
+       public function getLastError() {
+               return $this->error;
+       }
+}
diff --git a/includes/jobqueue/JobQueue.php b/includes/jobqueue/JobQueue.php
new file mode 100644 (file)
index 0000000..a537861
--- /dev/null
@@ -0,0 +1,745 @@
+<?php
+/**
+ * Job queue base code.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @defgroup JobQueue JobQueue
+ * @author Aaron Schulz
+ */
+
+/**
+ * Class to handle enqueueing and running of background jobs
+ *
+ * @ingroup JobQueue
+ * @since 1.21
+ */
+abstract class JobQueue {
+       /** @var string Wiki ID */
+       protected $wiki;
+
+       /** @var string Job type */
+       protected $type;
+
+       /** @var string Job priority for pop() */
+       protected $order;
+
+       /** @var int Time to live in seconds */
+       protected $claimTTL;
+
+       /** @var int Maximum number of times to try a job */
+       protected $maxTries;
+
+       /** @var bool Allow delayed jobs */
+       protected $checkDelay;
+
+       /** @var BagOStuff */
+       protected $dupCache;
+
+       const QOS_ATOMIC = 1; // integer; "all-or-nothing" job insertions
+
+       const ROOTJOB_TTL = 2419200; // integer; seconds to remember root jobs (28 days)
+
+       /**
+        * @param array $params
+        * @throws MWException
+        */
+       protected function __construct( array $params ) {
+               $this->wiki = $params['wiki'];
+               $this->type = $params['type'];
+               $this->claimTTL = isset( $params['claimTTL'] ) ? $params['claimTTL'] : 0;
+               $this->maxTries = isset( $params['maxTries'] ) ? $params['maxTries'] : 3;
+               if ( isset( $params['order'] ) && $params['order'] !== 'any' ) {
+                       $this->order = $params['order'];
+               } else {
+                       $this->order = $this->optimalOrder();
+               }
+               if ( !in_array( $this->order, $this->supportedOrders() ) ) {
+                       throw new MWException( __CLASS__ . " does not support '{$this->order}' order." );
+               }
+               $this->checkDelay = !empty( $params['checkDelay'] );
+               if ( $this->checkDelay && !$this->supportsDelayedJobs() ) {
+                       throw new MWException( __CLASS__ . " does not support delayed jobs." );
+               }
+               $this->dupCache = wfGetCache( CACHE_ANYTHING );
+       }
+
+       /**
+        * Get a job queue object of the specified type.
+        * $params includes:
+        *   - class      : What job class to use (determines job type)
+        *   - wiki       : wiki ID of the wiki the jobs are for (defaults to current wiki)
+        *   - type       : The name of the job types this queue handles
+        *   - order      : Order that pop() selects jobs, one of "fifo", "timestamp" or "random".
+        *                  If "fifo" is used, the queue will effectively be FIFO. Note that job
+        *                  completion will not appear to be exactly FIFO if there are multiple
+        *                  job runners since jobs can take different times to finish once popped.
+        *                  If "timestamp" is used, the queue will at least be loosely ordered
+        *                  by timestamp, allowing for some jobs to be popped off out of order.
+        *                  If "random" is used, pop() will pick jobs in random order.
+        *                  Note that it may only be weakly random (e.g. a lottery of the oldest X).
+        *                  If "any" is choosen, the queue will use whatever order is the fastest.
+        *                  This might be useful for improving concurrency for job acquisition.
+        *   - claimTTL   : If supported, the queue will recycle jobs that have been popped
+        *                  but not acknowledged as completed after this many seconds. Recycling
+        *                  of jobs simple means re-inserting them into the queue. Jobs can be
+        *                  attempted up to three times before being discarded.
+        *   - checkDelay : If supported, respect Job::getReleaseTimestamp() in the push functions.
+        *                  This lets delayed jobs wait in a staging area until a given timestamp is
+        *                  reached, at which point they will enter the queue. If this is not enabled
+        *                  or not supported, an exception will be thrown on delayed job insertion.
+        *
+        * Queue classes should throw an exception if they do not support the options given.
+        *
+        * @param array $params
+        * @return JobQueue
+        * @throws MWException
+        */
+       final public static function factory( array $params ) {
+               $class = $params['class'];
+               if ( !class_exists( $class ) ) {
+                       throw new MWException( "Invalid job queue class '$class'." );
+               }
+               $obj = new $class( $params );
+               if ( !( $obj instanceof self ) ) {
+                       throw new MWException( "Class '$class' is not a " . __CLASS__ . " class." );
+               }
+
+               return $obj;
+       }
+
+       /**
+        * @return string Wiki ID
+        */
+       final public function getWiki() {
+               return $this->wiki;
+       }
+
+       /**
+        * @return string Job type that this queue handles
+        */
+       final public function getType() {
+               return $this->type;
+       }
+
+       /**
+        * @return string One of (random, timestamp, fifo, undefined)
+        */
+       final public function getOrder() {
+               return $this->order;
+       }
+
+       /**
+        * @return bool Whether delayed jobs are enabled
+        * @since 1.22
+        */
+       final public function delayedJobsEnabled() {
+               return $this->checkDelay;
+       }
+
+       /**
+        * Get the allowed queue orders for configuration validation
+        *
+        * @return array Subset of (random, timestamp, fifo, undefined)
+        */
+       abstract protected function supportedOrders();
+
+       /**
+        * Get the default queue order to use if configuration does not specify one
+        *
+        * @return string One of (random, timestamp, fifo, undefined)
+        */
+       abstract protected function optimalOrder();
+
+       /**
+        * Find out if delayed jobs are supported for configuration validation
+        *
+        * @return bool Whether delayed jobs are supported
+        */
+       protected function supportsDelayedJobs() {
+               return false; // not implemented
+       }
+
+       /**
+        * Quickly check if the queue has no available (unacquired, non-delayed) jobs.
+        * Queue classes should use caching if they are any slower without memcached.
+        *
+        * If caching is used, this might return false when there are actually no jobs.
+        * If pop() is called and returns false then it should correct the cache. Also,
+        * calling flushCaches() first prevents this. However, this affect is typically
+        * not distinguishable from the race condition between isEmpty() and pop().
+        *
+        * @return bool
+        * @throws JobQueueError
+        */
+       final public function isEmpty() {
+               wfProfileIn( __METHOD__ );
+               $res = $this->doIsEmpty();
+               wfProfileOut( __METHOD__ );
+
+               return $res;
+       }
+
+       /**
+        * @see JobQueue::isEmpty()
+        * @return bool
+        */
+       abstract protected function doIsEmpty();
+
+       /**
+        * Get the number of available (unacquired, non-delayed) jobs in the queue.
+        * Queue classes should use caching if they are any slower without memcached.
+        *
+        * If caching is used, this number might be out of date for a minute.
+        *
+        * @return int
+        * @throws JobQueueError
+        */
+       final public function getSize() {
+               wfProfileIn( __METHOD__ );
+               $res = $this->doGetSize();
+               wfProfileOut( __METHOD__ );
+
+               return $res;
+       }
+
+       /**
+        * @see JobQueue::getSize()
+        * @return int
+        */
+       abstract protected function doGetSize();
+
+       /**
+        * Get the number of acquired jobs (these are temporarily out of the queue).
+        * Queue classes should use caching if they are any slower without memcached.
+        *
+        * If caching is used, this number might be out of date for a minute.
+        *
+        * @return int
+        * @throws JobQueueError
+        */
+       final public function getAcquiredCount() {
+               wfProfileIn( __METHOD__ );
+               $res = $this->doGetAcquiredCount();
+               wfProfileOut( __METHOD__ );
+
+               return $res;
+       }
+
+       /**
+        * @see JobQueue::getAcquiredCount()
+        * @return int
+        */
+       abstract protected function doGetAcquiredCount();
+
+       /**
+        * Get the number of delayed jobs (these are temporarily out of the queue).
+        * Queue classes should use caching if they are any slower without memcached.
+        *
+        * If caching is used, this number might be out of date for a minute.
+        *
+        * @return int
+        * @throws JobQueueError
+        * @since 1.22
+        */
+       final public function getDelayedCount() {
+               wfProfileIn( __METHOD__ );
+               $res = $this->doGetDelayedCount();
+               wfProfileOut( __METHOD__ );
+
+               return $res;
+       }
+
+       /**
+        * @see JobQueue::getDelayedCount()
+        * @return int
+        */
+       protected function doGetDelayedCount() {
+               return 0; // not implemented
+       }
+
+       /**
+        * Get the number of acquired jobs that can no longer be attempted.
+        * Queue classes should use caching if they are any slower without memcached.
+        *
+        * If caching is used, this number might be out of date for a minute.
+        *
+        * @return int
+        * @throws JobQueueError
+        */
+       final public function getAbandonedCount() {
+               wfProfileIn( __METHOD__ );
+               $res = $this->doGetAbandonedCount();
+               wfProfileOut( __METHOD__ );
+
+               return $res;
+       }
+
+       /**
+        * @see JobQueue::getAbandonedCount()
+        * @return int
+        */
+       protected function doGetAbandonedCount() {
+               return 0; // not implemented
+       }
+
+       /**
+        * Push one or more jobs into the queue.
+        * This does not require $wgJobClasses to be set for the given job type.
+        * Outside callers should use JobQueueGroup::push() instead of this function.
+        *
+        * @param Job|array $jobs A single job or an array of Jobs
+        * @param int $flags Bitfield (supports JobQueue::QOS_ATOMIC)
+        * @return bool Returns false on failure
+        * @throws JobQueueError
+        */
+       final public function push( $jobs, $flags = 0 ) {
+               return $this->batchPush( is_array( $jobs ) ? $jobs : array( $jobs ), $flags );
+       }
+
+       /**
+        * Push a batch of jobs into the queue.
+        * This does not require $wgJobClasses to be set for the given job type.
+        * Outside callers should use JobQueueGroup::push() instead of this function.
+        *
+        * @param array $jobs List of Jobs
+        * @param int $flags Bitfield (supports JobQueue::QOS_ATOMIC)
+        * @throws MWException
+        * @return bool Returns false on failure
+        */
+       final public function batchPush( array $jobs, $flags = 0 ) {
+               if ( !count( $jobs ) ) {
+                       return true; // nothing to do
+               }
+
+               foreach ( $jobs as $job ) {
+                       if ( $job->getType() !== $this->type ) {
+                               throw new MWException(
+                                       "Got '{$job->getType()}' job; expected a '{$this->type}' job." );
+                       } elseif ( $job->getReleaseTimestamp() && !$this->checkDelay ) {
+                               throw new MWException(
+                                       "Got delayed '{$job->getType()}' job; delays are not supported." );
+                       }
+               }
+
+               wfProfileIn( __METHOD__ );
+               $ok = $this->doBatchPush( $jobs, $flags );
+               wfProfileOut( __METHOD__ );
+
+               return $ok;
+       }
+
+       /**
+        * @see JobQueue::batchPush()
+        * @param array $jobs
+        * @param $flags
+        * @return bool
+        */
+       abstract protected function doBatchPush( array $jobs, $flags );
+
+       /**
+        * Pop a job off of the queue.
+        * This requires $wgJobClasses to be set for the given job type.
+        * Outside callers should use JobQueueGroup::pop() instead of this function.
+        *
+        * @throws MWException
+        * @return Job|bool Returns false if there are no jobs
+        */
+       final public function pop() {
+               global $wgJobClasses;
+
+               if ( $this->wiki !== wfWikiID() ) {
+                       throw new MWException( "Cannot pop '{$this->type}' job off foreign wiki queue." );
+               } elseif ( !isset( $wgJobClasses[$this->type] ) ) {
+                       // Do not pop jobs if there is no class for the queue type
+                       throw new MWException( "Unrecognized job type '{$this->type}'." );
+               }
+
+               wfProfileIn( __METHOD__ );
+               $job = $this->doPop();
+               wfProfileOut( __METHOD__ );
+
+               // Flag this job as an old duplicate based on its "root" job...
+               try {
+                       if ( $job && $this->isRootJobOldDuplicate( $job ) ) {
+                               JobQueue::incrStats( 'job-pop-duplicate', $this->type );
+                               $job = DuplicateJob::newFromJob( $job ); // convert to a no-op
+                       }
+               } catch ( MWException $e ) {
+                       // don't lose jobs over this
+               }
+
+               return $job;
+       }
+
+       /**
+        * @see JobQueue::pop()
+        * @return Job
+        */
+       abstract protected function doPop();
+
+       /**
+        * Acknowledge that a job was completed.
+        *
+        * This does nothing for certain queue classes or if "claimTTL" is not set.
+        * Outside callers should use JobQueueGroup::ack() instead of this function.
+        *
+        * @param Job $job
+        * @throws MWException
+        * @return bool
+        */
+       final public function ack( Job $job ) {
+               if ( $job->getType() !== $this->type ) {
+                       throw new MWException( "Got '{$job->getType()}' job; expected '{$this->type}'." );
+               }
+               wfProfileIn( __METHOD__ );
+               $ok = $this->doAck( $job );
+               wfProfileOut( __METHOD__ );
+
+               return $ok;
+       }
+
+       /**
+        * @see JobQueue::ack()
+        * @param Job $job
+        * @return bool
+        */
+       abstract protected function doAck( Job $job );
+
+       /**
+        * Register the "root job" of a given job into the queue for de-duplication.
+        * This should only be called right *after* all the new jobs have been inserted.
+        * This is used to turn older, duplicate, job entries into no-ops. The root job
+        * information will remain in the registry until it simply falls out of cache.
+        *
+        * This requires that $job has two special fields in the "params" array:
+        *   - rootJobSignature : hash (e.g. SHA1) that identifies the task
+        *   - rootJobTimestamp : TS_MW timestamp of this instance of the task
+        *
+        * A "root job" is a conceptual job that consist of potentially many smaller jobs
+        * that are actually inserted into the queue. For example, "refreshLinks" jobs are
+        * spawned when a template is edited. One can think of the task as "update links
+        * of pages that use template X" and an instance of that task as a "root job".
+        * However, what actually goes into the queue are range and leaf job subtypes.
+        * Since these jobs include things like page ID ranges and DB master positions,
+        * and can morph into smaller jobs recursively, simple duplicate detection
+        * for individual jobs being identical (like that of job_sha1) is not useful.
+        *
+        * In the case of "refreshLinks", if these jobs are still in the queue when the template
+        * is edited again, we want all of these old refreshLinks jobs for that template to become
+        * no-ops. This can greatly reduce server load, since refreshLinks jobs involves parsing.
+        * Essentially, the new batch of jobs belong to a new "root job" and the older ones to a
+        * previous "root job" for the same task of "update links of pages that use template X".
+        *
+        * This does nothing for certain queue classes.
+        *
+        * @param Job $job
+        * @throws MWException
+        * @return bool
+        */
+       final public function deduplicateRootJob( Job $job ) {
+               if ( $job->getType() !== $this->type ) {
+                       throw new MWException( "Got '{$job->getType()}' job; expected '{$this->type}'." );
+               }
+               wfProfileIn( __METHOD__ );
+               $ok = $this->doDeduplicateRootJob( $job );
+               wfProfileOut( __METHOD__ );
+
+               return $ok;
+       }
+
+       /**
+        * @see JobQueue::deduplicateRootJob()
+        * @param Job $job
+        * @throws MWException
+        * @return bool
+        */
+       protected function doDeduplicateRootJob( Job $job ) {
+               if ( !$job->hasRootJobParams() ) {
+                       throw new MWException( "Cannot register root job; missing parameters." );
+               }
+               $params = $job->getRootJobParams();
+
+               $key = $this->getRootJobCacheKey( $params['rootJobSignature'] );
+               // Callers should call batchInsert() and then this function so that if the insert
+               // fails, the de-duplication registration will be aborted. Since the insert is
+               // deferred till "transaction idle", do the same here, so that the ordering is
+               // maintained. Having only the de-duplication registration succeed would cause
+               // jobs to become no-ops without any actual jobs that made them redundant.
+               $timestamp = $this->dupCache->get( $key ); // current last timestamp of this job
+               if ( $timestamp && $timestamp >= $params['rootJobTimestamp'] ) {
+                       return true; // a newer version of this root job was enqueued
+               }
+
+               // Update the timestamp of the last root job started at the location...
+               return $this->dupCache->set( $key, $params['rootJobTimestamp'], JobQueueDB::ROOTJOB_TTL );
+       }
+
+       /**
+        * Check if the "root" job of a given job has been superseded by a newer one
+        *
+        * @param Job $job
+        * @throws MWException
+        * @return bool
+        */
+       final protected function isRootJobOldDuplicate( Job $job ) {
+               if ( $job->getType() !== $this->type ) {
+                       throw new MWException( "Got '{$job->getType()}' job; expected '{$this->type}'." );
+               }
+               wfProfileIn( __METHOD__ );
+               $isDuplicate = $this->doIsRootJobOldDuplicate( $job );
+               wfProfileOut( __METHOD__ );
+
+               return $isDuplicate;
+       }
+
+       /**
+        * @see JobQueue::isRootJobOldDuplicate()
+        * @param Job $job
+        * @return bool
+        */
+       protected function doIsRootJobOldDuplicate( Job $job ) {
+               if ( !$job->hasRootJobParams() ) {
+                       return false; // job has no de-deplication info
+               }
+               $params = $job->getRootJobParams();
+
+               $key = $this->getRootJobCacheKey( $params['rootJobSignature'] );
+               // Get the last time this root job was enqueued
+               $timestamp = $this->dupCache->get( $key );
+
+               // Check if a new root job was started at the location after this one's...
+               return ( $timestamp && $timestamp > $params['rootJobTimestamp'] );
+       }
+
+       /**
+        * @param string $signature Hash identifier of the root job
+        * @return string
+        */
+       protected function getRootJobCacheKey( $signature ) {
+               list( $db, $prefix ) = wfSplitWikiID( $this->wiki );
+
+               return wfForeignMemcKey( $db, $prefix, 'jobqueue', $this->type, 'rootjob', $signature );
+       }
+
+       /**
+        * Deleted all unclaimed and delayed jobs from the queue
+        *
+        * @return bool Success
+        * @throws JobQueueError
+        * @since 1.22
+        */
+       final public function delete() {
+               wfProfileIn( __METHOD__ );
+               $res = $this->doDelete();
+               wfProfileOut( __METHOD__ );
+
+               return $res;
+       }
+
+       /**
+        * @see JobQueue::delete()
+        * @throws MWException
+        * @return bool Success
+        */
+       protected function doDelete() {
+               throw new MWException( "This method is not implemented." );
+       }
+
+       /**
+        * Wait for any slaves or backup servers to catch up.
+        *
+        * This does nothing for certain queue classes.
+        *
+        * @return void
+        * @throws JobQueueError
+        */
+       final public function waitForBackups() {
+               wfProfileIn( __METHOD__ );
+               $this->doWaitForBackups();
+               wfProfileOut( __METHOD__ );
+       }
+
+       /**
+        * @see JobQueue::waitForBackups()
+        * @return void
+        */
+       protected function doWaitForBackups() {
+       }
+
+       /**
+        * Return a map of task names to task definition maps.
+        * A "task" is a fast periodic queue maintenance action.
+        * Mutually exclusive tasks must implement their own locking in the callback.
+        *
+        * Each task value is an associative array with:
+        *   - name     : the name of the task
+        *   - callback : a PHP callable that performs the task
+        *   - period   : the period in seconds corresponding to the task frequency
+        *
+        * @return array
+        */
+       final public function getPeriodicTasks() {
+               $tasks = $this->doGetPeriodicTasks();
+               foreach ( $tasks as $name => &$def ) {
+                       $def['name'] = $name;
+               }
+
+               return $tasks;
+       }
+
+       /**
+        * @see JobQueue::getPeriodicTasks()
+        * @return array
+        */
+       protected function doGetPeriodicTasks() {
+               return array();
+       }
+
+       /**
+        * Clear any process and persistent caches
+        *
+        * @return void
+        */
+       final public function flushCaches() {
+               wfProfileIn( __METHOD__ );
+               $this->doFlushCaches();
+               wfProfileOut( __METHOD__ );
+       }
+
+       /**
+        * @see JobQueue::flushCaches()
+        * @return void
+        */
+       protected function doFlushCaches() {
+       }
+
+       /**
+        * Get an iterator to traverse over all available jobs in this queue.
+        * This does not include jobs that are currently acquired or delayed.
+        * Note: results may be stale if the queue is concurrently modified.
+        *
+        * @return Iterator
+        * @throws JobQueueError
+        */
+       abstract public function getAllQueuedJobs();
+
+       /**
+        * Get an iterator to traverse over all delayed jobs in this queue.
+        * Note: results may be stale if the queue is concurrently modified.
+        *
+        * @return Iterator
+        * @throws JobQueueError
+        * @since 1.22
+        */
+       public function getAllDelayedJobs() {
+               return new ArrayIterator( array() ); // not implemented
+       }
+
+       /**
+        * Do not use this function outside of JobQueue/JobQueueGroup
+        *
+        * @return string
+        * @since 1.22
+        */
+       public function getCoalesceLocationInternal() {
+               return null;
+       }
+
+       /**
+        * Check whether each of the given queues are empty.
+        * This is used for batching checks for queues stored at the same place.
+        *
+        * @param array $types List of queues types
+        * @return array|null (list of non-empty queue types) or null if unsupported
+        * @throws MWException
+        * @since 1.22
+        */
+       final public function getSiblingQueuesWithJobs( array $types ) {
+               $section = new ProfileSection( __METHOD__ );
+
+               return $this->doGetSiblingQueuesWithJobs( $types );
+       }
+
+       /**
+        * @see JobQueue::getSiblingQueuesWithJobs()
+        * @param array $types List of queues types
+        * @return array|null (list of queue types) or null if unsupported
+        */
+       protected function doGetSiblingQueuesWithJobs( array $types ) {
+               return null; // not supported
+       }
+
+       /**
+        * Check the size of each of the given queues.
+        * For queues not served by the same store as this one, 0 is returned.
+        * This is used for batching checks for queues stored at the same place.
+        *
+        * @param array $types List of queues types
+        * @return array|null (job type => whether queue is empty) or null if unsupported
+        * @throws MWException
+        * @since 1.22
+        */
+       final public function getSiblingQueueSizes( array $types ) {
+               $section = new ProfileSection( __METHOD__ );
+
+               return $this->doGetSiblingQueueSizes( $types );
+       }
+
+       /**
+        * @see JobQueue::getSiblingQueuesSize()
+        * @param array $types List of queues types
+        * @return array|null (list of queue types) or null if unsupported
+        */
+       protected function doGetSiblingQueueSizes( array $types ) {
+               return null; // not supported
+       }
+
+       /**
+        * Call wfIncrStats() for the queue overall and for the queue type
+        *
+        * @param string $key Event type
+        * @param string $type Job type
+        * @param int $delta
+        * @since 1.22
+        */
+       public static function incrStats( $key, $type, $delta = 1 ) {
+               wfIncrStats( $key, $delta );
+               wfIncrStats( "{$key}-{$type}", $delta );
+       }
+
+       /**
+        * Namespace the queue with a key to isolate it for testing
+        *
+        * @param string $key
+        * @return void
+        * @throws MWException
+        */
+       public function setTestingPrefix( $key ) {
+               throw new MWException( "Queue namespacing not supported for this queue type." );
+       }
+}
+
+/**
+ * @ingroup JobQueue
+ * @since 1.22
+ */
+class JobQueueError extends MWException {
+}
+
+class JobQueueConnectionError extends JobQueueError {
+}
diff --git a/includes/jobqueue/JobQueueDB.php b/includes/jobqueue/JobQueueDB.php
new file mode 100644 (file)
index 0000000..6097d31
--- /dev/null
@@ -0,0 +1,848 @@
+<?php
+/**
+ * Database-backed job queue code.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @author Aaron Schulz
+ */
+
+/**
+ * Class to handle job queues stored in the DB
+ *
+ * @ingroup JobQueue
+ * @since 1.21
+ */
+class JobQueueDB extends JobQueue {
+       const CACHE_TTL_SHORT = 30; // integer; seconds to cache info without re-validating
+       const CACHE_TTL_LONG = 300; // integer; seconds to cache info that is kept up to date
+       const MAX_AGE_PRUNE = 604800; // integer; seconds a job can live once claimed
+       const MAX_JOB_RANDOM = 2147483647; // integer; 2^31 - 1, used for job_random
+       const MAX_OFFSET = 255; // integer; maximum number of rows to skip
+
+       /** @var BagOStuff */
+       protected $cache;
+
+       /** @var bool|string Name of an external DB cluster. False if not set */
+       protected $cluster = false;
+
+       /**
+        * Additional parameters include:
+        *   - cluster : The name of an external cluster registered via LBFactory.
+        *               If not specified, the primary DB cluster for the wiki will be used.
+        *               This can be overridden with a custom cluster so that DB handles will
+        *               be retrieved via LBFactory::getExternalLB() and getConnection().
+        * @param array $params
+        */
+       protected function __construct( array $params ) {
+               global $wgMemc;
+
+               parent::__construct( $params );
+
+               $this->cluster = isset( $params['cluster'] ) ? $params['cluster'] : false;
+               // Make sure that we don't use the SQL cache, which would be harmful
+               $this->cache = ( $wgMemc instanceof SqlBagOStuff ) ? new EmptyBagOStuff() : $wgMemc;
+       }
+
+       protected function supportedOrders() {
+               return array( 'random', 'timestamp', 'fifo' );
+       }
+
+       protected function optimalOrder() {
+               return 'random';
+       }
+
+       /**
+        * @see JobQueue::doIsEmpty()
+        * @return bool
+        */
+       protected function doIsEmpty() {
+               $key = $this->getCacheKey( 'empty' );
+
+               $isEmpty = $this->cache->get( $key );
+               if ( $isEmpty === 'true' ) {
+                       return true;
+               } elseif ( $isEmpty === 'false' ) {
+                       return false;
+               }
+
+               $dbr = $this->getSlaveDB();
+               try {
+                       $found = $dbr->selectField( // unclaimed job
+                               'job', '1', array( 'job_cmd' => $this->type, 'job_token' => '' ), __METHOD__
+                       );
+               } catch ( DBError $e ) {
+                       $this->throwDBException( $e );
+               }
+               $this->cache->add( $key, $found ? 'false' : 'true', self::CACHE_TTL_LONG );
+
+               return !$found;
+       }
+
+       /**
+        * @see JobQueue::doGetSize()
+        * @return int
+        */
+       protected function doGetSize() {
+               $key = $this->getCacheKey( 'size' );
+
+               $size = $this->cache->get( $key );
+               if ( is_int( $size ) ) {
+                       return $size;
+               }
+
+               try {
+                       $dbr = $this->getSlaveDB();
+                       $size = (int)$dbr->selectField( 'job', 'COUNT(*)',
+                               array( 'job_cmd' => $this->type, 'job_token' => '' ),
+                               __METHOD__
+                       );
+               } catch ( DBError $e ) {
+                       $this->throwDBException( $e );
+               }
+               $this->cache->set( $key, $size, self::CACHE_TTL_SHORT );
+
+               return $size;
+       }
+
+       /**
+        * @see JobQueue::doGetAcquiredCount()
+        * @return int
+        */
+       protected function doGetAcquiredCount() {
+               if ( $this->claimTTL <= 0 ) {
+                       return 0; // no acknowledgements
+               }
+
+               $key = $this->getCacheKey( 'acquiredcount' );
+
+               $count = $this->cache->get( $key );
+               if ( is_int( $count ) ) {
+                       return $count;
+               }
+
+               $dbr = $this->getSlaveDB();
+               try {
+                       $count = (int)$dbr->selectField( 'job', 'COUNT(*)',
+                               array( 'job_cmd' => $this->type, "job_token != {$dbr->addQuotes( '' )}" ),
+                               __METHOD__
+                       );
+               } catch ( DBError $e ) {
+                       $this->throwDBException( $e );
+               }
+               $this->cache->set( $key, $count, self::CACHE_TTL_SHORT );
+
+               return $count;
+       }
+
+       /**
+        * @see JobQueue::doGetAbandonedCount()
+        * @return int
+        * @throws MWException
+        */
+       protected function doGetAbandonedCount() {
+               global $wgMemc;
+
+               if ( $this->claimTTL <= 0 ) {
+                       return 0; // no acknowledgements
+               }
+
+               $key = $this->getCacheKey( 'abandonedcount' );
+
+               $count = $wgMemc->get( $key );
+               if ( is_int( $count ) ) {
+                       return $count;
+               }
+
+               $dbr = $this->getSlaveDB();
+               try {
+                       $count = (int)$dbr->selectField( 'job', 'COUNT(*)',
+                               array(
+                                       'job_cmd' => $this->type,
+                                       "job_token != {$dbr->addQuotes( '' )}",
+                                       "job_attempts >= " . $dbr->addQuotes( $this->maxTries )
+                               ),
+                               __METHOD__
+                       );
+               } catch ( DBError $e ) {
+                       $this->throwDBException( $e );
+               }
+               $wgMemc->set( $key, $count, self::CACHE_TTL_SHORT );
+
+               return $count;
+       }
+
+       /**
+        * @see JobQueue::doBatchPush()
+        * @param array $jobs
+        * @param $flags
+        * @throws DBError|Exception
+        * @return bool
+        */
+       protected function doBatchPush( array $jobs, $flags ) {
+               $dbw = $this->getMasterDB();
+
+               $that = $this;
+               $method = __METHOD__;
+               $dbw->onTransactionIdle(
+                       function () use ( $dbw, $that, $jobs, $flags, $method ) {
+                               $that->doBatchPushInternal( $dbw, $jobs, $flags, $method );
+                       }
+               );
+
+               return true;
+       }
+
+       /**
+        * This function should *not* be called outside of JobQueueDB
+        *
+        * @param IDatabase $dbw
+        * @param array $jobs
+        * @param int $flags
+        * @param string $method
+        * @throws DBError
+        * @return bool
+        */
+       public function doBatchPushInternal( IDatabase $dbw, array $jobs, $flags, $method ) {
+               if ( !count( $jobs ) ) {
+                       return true;
+               }
+
+               $rowSet = array(); // (sha1 => job) map for jobs that are de-duplicated
+               $rowList = array(); // list of jobs for jobs that are are not de-duplicated
+               foreach ( $jobs as $job ) {
+                       $row = $this->insertFields( $job );
+                       if ( $job->ignoreDuplicates() ) {
+                               $rowSet[$row['job_sha1']] = $row;
+                       } else {
+                               $rowList[] = $row;
+                       }
+               }
+
+               if ( $flags & self::QOS_ATOMIC ) {
+                       $dbw->begin( $method ); // wrap all the job additions in one transaction
+               }
+               try {
+                       // Strip out any duplicate jobs that are already in the queue...
+                       if ( count( $rowSet ) ) {
+                               $res = $dbw->select( 'job', 'job_sha1',
+                                       array(
+                                               // No job_type condition since it's part of the job_sha1 hash
+                                               'job_sha1' => array_keys( $rowSet ),
+                                               'job_token' => '' // unclaimed
+                                       ),
+                                       $method
+                               );
+                               foreach ( $res as $row ) {
+                                       wfDebug( "Job with hash '{$row->job_sha1}' is a duplicate.\n" );
+                                       unset( $rowSet[$row->job_sha1] ); // already enqueued
+                               }
+                       }
+                       // Build the full list of job rows to insert
+                       $rows = array_merge( $rowList, array_values( $rowSet ) );
+                       // Insert the job rows in chunks to avoid slave lag...
+                       foreach ( array_chunk( $rows, 50 ) as $rowBatch ) {
+                               $dbw->insert( 'job', $rowBatch, $method );
+                       }
+                       JobQueue::incrStats( 'job-insert', $this->type, count( $rows ) );
+                       JobQueue::incrStats(
+                               'job-insert-duplicate',
+                               $this->type,
+                               count( $rowSet ) + count( $rowList ) - count( $rows )
+                       );
+               } catch ( DBError $e ) {
+                       if ( $flags & self::QOS_ATOMIC ) {
+                               $dbw->rollback( $method );
+                       }
+                       throw $e;
+               }
+               if ( $flags & self::QOS_ATOMIC ) {
+                       $dbw->commit( $method );
+               }
+
+               $this->cache->set( $this->getCacheKey( 'empty' ), 'false', JobQueueDB::CACHE_TTL_LONG );
+
+               return true;
+       }
+
+       /**
+        * @see JobQueue::doPop()
+        * @return Job|bool
+        */
+       protected function doPop() {
+               if ( $this->cache->get( $this->getCacheKey( 'empty' ) ) === 'true' ) {
+                       return false; // queue is empty
+               }
+
+               $dbw = $this->getMasterDB();
+               try {
+                       $dbw->commit( __METHOD__, 'flush' ); // flush existing transaction
+                       $autoTrx = $dbw->getFlag( DBO_TRX ); // get current setting
+                       $dbw->clearFlag( DBO_TRX ); // make each query its own transaction
+                       $scopedReset = new ScopedCallback( function () use ( $dbw, $autoTrx ) {
+                               $dbw->setFlag( $autoTrx ? DBO_TRX : 0 ); // restore old setting
+                       } );
+
+                       $uuid = wfRandomString( 32 ); // pop attempt
+                       $job = false; // job popped off
+                       do { // retry when our row is invalid or deleted as a duplicate
+                               // Try to reserve a row in the DB...
+                               if ( in_array( $this->order, array( 'fifo', 'timestamp' ) ) ) {
+                                       $row = $this->claimOldest( $uuid );
+                               } else { // random first
+                                       $rand = mt_rand( 0, self::MAX_JOB_RANDOM ); // encourage concurrent UPDATEs
+                                       $gte = (bool)mt_rand( 0, 1 ); // find rows with rand before/after $rand
+                                       $row = $this->claimRandom( $uuid, $rand, $gte );
+                               }
+                               // Check if we found a row to reserve...
+                               if ( !$row ) {
+                                       $this->cache->set( $this->getCacheKey( 'empty' ), 'true', self::CACHE_TTL_LONG );
+                                       break; // nothing to do
+                               }
+                               JobQueue::incrStats( 'job-pop', $this->type );
+                               // Get the job object from the row...
+                               $title = Title::makeTitleSafe( $row->job_namespace, $row->job_title );
+                               if ( !$title ) {
+                                       $dbw->delete( 'job', array( 'job_id' => $row->job_id ), __METHOD__ );
+                                       wfDebug( "Row has invalid title '{$row->job_title}'." );
+                                       continue; // try again
+                               }
+                               $job = Job::factory( $row->job_cmd, $title,
+                                       self::extractBlob( $row->job_params ), $row->job_id );
+                               $job->metadata['id'] = $row->job_id;
+                               break; // done
+                       } while ( true );
+               } catch ( DBError $e ) {
+                       $this->throwDBException( $e );
+               }
+
+               return $job;
+       }
+
+       /**
+        * Reserve a row with a single UPDATE without holding row locks over RTTs...
+        *
+        * @param string $uuid 32 char hex string
+        * @param $rand integer Random unsigned integer (31 bits)
+        * @param bool $gte Search for job_random >= $random (otherwise job_random <= $random)
+        * @return stdClass|bool Row|false
+        */
+       protected function claimRandom( $uuid, $rand, $gte ) {
+               $dbw = $this->getMasterDB();
+               // Check cache to see if the queue has <= OFFSET items
+               $tinyQueue = $this->cache->get( $this->getCacheKey( 'small' ) );
+
+               $row = false; // the row acquired
+               $invertedDirection = false; // whether one job_random direction was already scanned
+               // This uses a replication safe method for acquiring jobs. One could use UPDATE+LIMIT
+               // instead, but that either uses ORDER BY (in which case it deadlocks in MySQL) or is
+               // not replication safe. Due to http://bugs.mysql.com/bug.php?id=6980, subqueries cannot
+               // be used here with MySQL.
+               do {
+                       if ( $tinyQueue ) { // queue has <= MAX_OFFSET rows
+                               // For small queues, using OFFSET will overshoot and return no rows more often.
+                               // Instead, this uses job_random to pick a row (possibly checking both directions).
+                               $ineq = $gte ? '>=' : '<=';
+                               $dir = $gte ? 'ASC' : 'DESC';
+                               $row = $dbw->selectRow( 'job', self::selectFields(), // find a random job
+                                       array(
+                                               'job_cmd' => $this->type,
+                                               'job_token' => '', // unclaimed
+                                               "job_random {$ineq} {$dbw->addQuotes( $rand )}" ),
+                                       __METHOD__,
+                                       array( 'ORDER BY' => "job_random {$dir}" )
+                               );
+                               if ( !$row && !$invertedDirection ) {
+                                       $gte = !$gte;
+                                       $invertedDirection = true;
+                                       continue; // try the other direction
+                               }
+                       } else { // table *may* have >= MAX_OFFSET rows
+                               // Bug 42614: "ORDER BY job_random" with a job_random inequality causes high CPU
+                               // in MySQL if there are many rows for some reason. This uses a small OFFSET
+                               // instead of job_random for reducing excess claim retries.
+                               $row = $dbw->selectRow( 'job', self::selectFields(), // find a random job
+                                       array(
+                                               'job_cmd' => $this->type,
+                                               'job_token' => '', // unclaimed
+                                       ),
+                                       __METHOD__,
+                                       array( 'OFFSET' => mt_rand( 0, self::MAX_OFFSET ) )
+                               );
+                               if ( !$row ) {
+                                       $tinyQueue = true; // we know the queue must have <= MAX_OFFSET rows
+                                       $this->cache->set( $this->getCacheKey( 'small' ), 1, 30 );
+                                       continue; // use job_random
+                               }
+                       }
+
+                       if ( $row ) { // claim the job
+                               $dbw->update( 'job', // update by PK
+                                       array(
+                                               'job_token' => $uuid,
+                                               'job_token_timestamp' => $dbw->timestamp(),
+                                               'job_attempts = job_attempts+1' ),
+                                       array( 'job_cmd' => $this->type, 'job_id' => $row->job_id, 'job_token' => '' ),
+                                       __METHOD__
+                               );
+                               // This might get raced out by another runner when claiming the previously
+                               // selected row. The use of job_random should minimize this problem, however.
+                               if ( !$dbw->affectedRows() ) {
+                                       $row = false; // raced out
+                               }
+                       } else {
+                               break; // nothing to do
+                       }
+               } while ( !$row );
+
+               return $row;
+       }
+
+       /**
+        * Reserve a row with a single UPDATE without holding row locks over RTTs...
+        *
+        * @param string $uuid 32 char hex string
+        * @return stdClass|bool Row|false
+        */
+       protected function claimOldest( $uuid ) {
+               $dbw = $this->getMasterDB();
+
+               $row = false; // the row acquired
+               do {
+                       if ( $dbw->getType() === 'mysql' ) {
+                               // Per http://bugs.mysql.com/bug.php?id=6980, we can't use subqueries on the
+                               // same table being changed in an UPDATE query in MySQL (gives Error: 1093).
+                               // Oracle and Postgre have no such limitation. However, MySQL offers an
+                               // alternative here by supporting ORDER BY + LIMIT for UPDATE queries.
+                               $dbw->query( "UPDATE {$dbw->tableName( 'job' )} " .
+                                       "SET " .
+                                               "job_token = {$dbw->addQuotes( $uuid ) }, " .
+                                               "job_token_timestamp = {$dbw->addQuotes( $dbw->timestamp() )}, " .
+                                               "job_attempts = job_attempts+1 " .
+                                       "WHERE ( " .
+                                               "job_cmd = {$dbw->addQuotes( $this->type )} " .
+                                               "AND job_token = {$dbw->addQuotes( '' )} " .
+                                       ") ORDER BY job_id ASC LIMIT 1",
+                                       __METHOD__
+                               );
+                       } else {
+                               // Use a subquery to find the job, within an UPDATE to claim it.
+                               // This uses as much of the DB wrapper functions as possible.
+                               $dbw->update( 'job',
+                                       array(
+                                               'job_token' => $uuid,
+                                               'job_token_timestamp' => $dbw->timestamp(),
+                                               'job_attempts = job_attempts+1' ),
+                                       array( 'job_id = (' .
+                                               $dbw->selectSQLText( 'job', 'job_id',
+                                                       array( 'job_cmd' => $this->type, 'job_token' => '' ),
+                                                       __METHOD__,
+                                                       array( 'ORDER BY' => 'job_id ASC', 'LIMIT' => 1 ) ) .
+                                               ')'
+                                       ),
+                                       __METHOD__
+                               );
+                       }
+                       // Fetch any row that we just reserved...
+                       if ( $dbw->affectedRows() ) {
+                               $row = $dbw->selectRow( 'job', self::selectFields(),
+                                       array( 'job_cmd' => $this->type, 'job_token' => $uuid ), __METHOD__
+                               );
+                               if ( !$row ) { // raced out by duplicate job removal
+                                       wfDebug( "Row deleted as duplicate by another process." );
+                               }
+                       } else {
+                               break; // nothing to do
+                       }
+               } while ( !$row );
+
+               return $row;
+       }
+
+       /**
+        * @see JobQueue::doAck()
+        * @param Job $job
+        * @throws MWException
+        * @return Job|bool
+        */
+       protected function doAck( Job $job ) {
+               if ( !isset( $job->metadata['id'] ) ) {
+                       throw new MWException( "Job of type '{$job->getType()}' has no ID." );
+               }
+
+               $dbw = $this->getMasterDB();
+               try {
+                       $dbw->commit( __METHOD__, 'flush' ); // flush existing transaction
+                       $autoTrx = $dbw->getFlag( DBO_TRX ); // get current setting
+                       $dbw->clearFlag( DBO_TRX ); // make each query its own transaction
+                       $scopedReset = new ScopedCallback( function () use ( $dbw, $autoTrx ) {
+                               $dbw->setFlag( $autoTrx ? DBO_TRX : 0 ); // restore old setting
+                       } );
+
+                       // Delete a row with a single DELETE without holding row locks over RTTs...
+                       $dbw->delete( 'job',
+                               array( 'job_cmd' => $this->type, 'job_id' => $job->metadata['id'] ), __METHOD__ );
+               } catch ( DBError $e ) {
+                       $this->throwDBException( $e );
+               }
+
+               return true;
+       }
+
+       /**
+        * @see JobQueue::doDeduplicateRootJob()
+        * @param Job $job
+        * @throws MWException
+        * @return bool
+        */
+       protected function doDeduplicateRootJob( Job $job ) {
+               $params = $job->getParams();
+               if ( !isset( $params['rootJobSignature'] ) ) {
+                       throw new MWException( "Cannot register root job; missing 'rootJobSignature'." );
+               } elseif ( !isset( $params['rootJobTimestamp'] ) ) {
+                       throw new MWException( "Cannot register root job; missing 'rootJobTimestamp'." );
+               }
+               $key = $this->getRootJobCacheKey( $params['rootJobSignature'] );
+               // Callers should call batchInsert() and then this function so that if the insert
+               // fails, the de-duplication registration will be aborted. Since the insert is
+               // deferred till "transaction idle", do the same here, so that the ordering is
+               // maintained. Having only the de-duplication registration succeed would cause
+               // jobs to become no-ops without any actual jobs that made them redundant.
+               $dbw = $this->getMasterDB();
+               $cache = $this->dupCache;
+               $dbw->onTransactionIdle( function () use ( $cache, $params, $key, $dbw ) {
+                       $timestamp = $cache->get( $key ); // current last timestamp of this job
+                       if ( $timestamp && $timestamp >= $params['rootJobTimestamp'] ) {
+                               return true; // a newer version of this root job was enqueued
+                       }
+
+                       // Update the timestamp of the last root job started at the location...
+                       return $cache->set( $key, $params['rootJobTimestamp'], JobQueueDB::ROOTJOB_TTL );
+               } );
+
+               return true;
+       }
+
+       /**
+        * @see JobQueue::doDelete()
+        * @return bool
+        */
+       protected function doDelete() {
+               $dbw = $this->getMasterDB();
+               try {
+                       $dbw->delete( 'job', array( 'job_cmd' => $this->type ) );
+               } catch ( DBError $e ) {
+                       $this->throwDBException( $e );
+               }
+
+               return true;
+       }
+
+       /**
+        * @see JobQueue::doWaitForBackups()
+        * @return void
+        */
+       protected function doWaitForBackups() {
+               wfWaitForSlaves();
+       }
+
+       /**
+        * @return array
+        */
+       protected function doGetPeriodicTasks() {
+               return array(
+                       'recycleAndDeleteStaleJobs' => array(
+                               'callback' => array( $this, 'recycleAndDeleteStaleJobs' ),
+                               'period' => ceil( $this->claimTTL / 2 )
+                       )
+               );
+       }
+
+       /**
+        * @return void
+        */
+       protected function doFlushCaches() {
+               foreach ( array( 'empty', 'size', 'acquiredcount' ) as $type ) {
+                       $this->cache->delete( $this->getCacheKey( $type ) );
+               }
+       }
+
+       /**
+        * @see JobQueue::getAllQueuedJobs()
+        * @return Iterator
+        */
+       public function getAllQueuedJobs() {
+               $dbr = $this->getSlaveDB();
+               try {
+                       return new MappedIterator(
+                               $dbr->select( 'job', self::selectFields(),
+                                       array( 'job_cmd' => $this->getType(), 'job_token' => '' ) ),
+                               function ( $row ) use ( $dbr ) {
+                                       $job = Job::factory(
+                                               $row->job_cmd,
+                                               Title::makeTitle( $row->job_namespace, $row->job_title ),
+                                               strlen( $row->job_params ) ? unserialize( $row->job_params ) : false
+                                       );
+                                       $job->metadata['id'] = $row->job_id;
+                                       return $job;
+                               }
+                       );
+               } catch ( DBError $e ) {
+                       $this->throwDBException( $e );
+               }
+       }
+
+       public function getCoalesceLocationInternal() {
+               return $this->cluster
+                       ? "DBCluster:{$this->cluster}:{$this->wiki}"
+                       : "LBFactory:{$this->wiki}";
+       }
+
+       protected function doGetSiblingQueuesWithJobs( array $types ) {
+               $dbr = $this->getSlaveDB();
+               $res = $dbr->select( 'job', 'DISTINCT job_cmd',
+                       array( 'job_cmd' => $types ), __METHOD__ );
+
+               $types = array();
+               foreach ( $res as $row ) {
+                       $types[] = $row->job_cmd;
+               }
+
+               return $types;
+       }
+
+       protected function doGetSiblingQueueSizes( array $types ) {
+               $dbr = $this->getSlaveDB();
+               $res = $dbr->select( 'job', array( 'job_cmd', 'COUNT(*) AS count' ),
+                       array( 'job_cmd' => $types ), __METHOD__, array( 'GROUP BY' => 'job_cmd' ) );
+
+               $sizes = array();
+               foreach ( $res as $row ) {
+                       $sizes[$row->job_cmd] = (int)$row->count;
+               }
+
+               return $sizes;
+       }
+
+       /**
+        * Recycle or destroy any jobs that have been claimed for too long
+        *
+        * @return int Number of jobs recycled/deleted
+        */
+       public function recycleAndDeleteStaleJobs() {
+               $now = time();
+               $count = 0; // affected rows
+               $dbw = $this->getMasterDB();
+
+               try {
+                       if ( !$dbw->lock( "jobqueue-recycle-{$this->type}", __METHOD__, 1 ) ) {
+                               return $count; // already in progress
+                       }
+
+                       // Remove claims on jobs acquired for too long if enabled...
+                       if ( $this->claimTTL > 0 ) {
+                               $claimCutoff = $dbw->timestamp( $now - $this->claimTTL );
+                               // Get the IDs of jobs that have be claimed but not finished after too long.
+                               // These jobs can be recycled into the queue by expiring the claim. Selecting
+                               // the IDs first means that the UPDATE can be done by primary key (less deadlocks).
+                               $res = $dbw->select( 'job', 'job_id',
+                                       array(
+                                               'job_cmd' => $this->type,
+                                               "job_token != {$dbw->addQuotes( '' )}", // was acquired
+                                               "job_token_timestamp < {$dbw->addQuotes( $claimCutoff )}", // stale
+                                               "job_attempts < {$dbw->addQuotes( $this->maxTries )}" ), // retries left
+                                       __METHOD__
+                               );
+                               $ids = array_map(
+                                       function ( $o ) {
+                                               return $o->job_id;
+                                       }, iterator_to_array( $res )
+                               );
+                               if ( count( $ids ) ) {
+                                       // Reset job_token for these jobs so that other runners will pick them up.
+                                       // Set the timestamp to the current time, as it is useful to now that the job
+                                       // was already tried before (the timestamp becomes the "released" time).
+                                       $dbw->update( 'job',
+                                               array(
+                                                       'job_token' => '',
+                                                       'job_token_timestamp' => $dbw->timestamp( $now ) ), // time of release
+                                               array(
+                                                       'job_id' => $ids ),
+                                               __METHOD__
+                                       );
+                                       $count += $dbw->affectedRows();
+                                       JobQueue::incrStats( 'job-recycle', $this->type, $dbw->affectedRows() );
+                                       $this->cache->set( $this->getCacheKey( 'empty' ), 'false', self::CACHE_TTL_LONG );
+                               }
+                       }
+
+                       // Just destroy any stale jobs...
+                       $pruneCutoff = $dbw->timestamp( $now - self::MAX_AGE_PRUNE );
+                       $conds = array(
+                               'job_cmd' => $this->type,
+                               "job_token != {$dbw->addQuotes( '' )}", // was acquired
+                               "job_token_timestamp < {$dbw->addQuotes( $pruneCutoff )}" // stale
+                       );
+                       if ( $this->claimTTL > 0 ) { // only prune jobs attempted too many times...
+                               $conds[] = "job_attempts >= {$dbw->addQuotes( $this->maxTries )}";
+                       }
+                       // Get the IDs of jobs that are considered stale and should be removed. Selecting
+                       // the IDs first means that the UPDATE can be done by primary key (less deadlocks).
+                       $res = $dbw->select( 'job', 'job_id', $conds, __METHOD__ );
+                       $ids = array_map(
+                               function ( $o ) {
+                                       return $o->job_id;
+                               }, iterator_to_array( $res )
+                       );
+                       if ( count( $ids ) ) {
+                               $dbw->delete( 'job', array( 'job_id' => $ids ), __METHOD__ );
+                               $count += $dbw->affectedRows();
+                               JobQueue::incrStats( 'job-abandon', $this->type, $dbw->affectedRows() );
+                       }
+
+                       $dbw->unlock( "jobqueue-recycle-{$this->type}", __METHOD__ );
+               } catch ( DBError $e ) {
+                       $this->throwDBException( $e );
+               }
+
+               return $count;
+       }
+
+       /**
+        * @param IJobSpecification $job
+        * @return array
+        */
+       protected function insertFields( IJobSpecification $job ) {
+               $dbw = $this->getMasterDB();
+
+               return array(
+                       // Fields that describe the nature of the job
+                       'job_cmd' => $job->getType(),
+                       'job_namespace' => $job->getTitle()->getNamespace(),
+                       'job_title' => $job->getTitle()->getDBkey(),
+                       'job_params' => self::makeBlob( $job->getParams() ),
+                       // Additional job metadata
+                       'job_id' => $dbw->nextSequenceValue( 'job_job_id_seq' ),
+                       'job_timestamp' => $dbw->timestamp(),
+                       'job_sha1' => wfBaseConvert(
+                               sha1( serialize( $job->getDeduplicationInfo() ) ),
+                               16, 36, 31
+                       ),
+                       'job_random' => mt_rand( 0, self::MAX_JOB_RANDOM )
+               );
+       }
+
+       /**
+        * @throws JobQueueConnectionError
+        * @return DBConnRef
+        */
+       protected function getSlaveDB() {
+               try {
+                       return $this->getDB( DB_SLAVE );
+               } catch ( DBConnectionError $e ) {
+                       throw new JobQueueConnectionError( "DBConnectionError:" . $e->getMessage() );
+               }
+       }
+
+       /**
+        * @throws JobQueueConnectionError
+        * @return DBConnRef
+        */
+       protected function getMasterDB() {
+               try {
+                       return $this->getDB( DB_MASTER );
+               } catch ( DBConnectionError $e ) {
+                       throw new JobQueueConnectionError( "DBConnectionError:" . $e->getMessage() );
+               }
+       }
+
+       /**
+        * @param $index integer (DB_SLAVE/DB_MASTER)
+        * @return DBConnRef
+        */
+       protected function getDB( $index ) {
+               $lb = ( $this->cluster !== false )
+                       ? wfGetLBFactory()->getExternalLB( $this->cluster, $this->wiki )
+                       : wfGetLB( $this->wiki );
+
+               return $lb->getConnectionRef( $index, array(), $this->wiki );
+       }
+
+       /**
+        * @param $property
+        * @return string
+        */
+       private function getCacheKey( $property ) {
+               list( $db, $prefix ) = wfSplitWikiID( $this->wiki );
+               $cluster = is_string( $this->cluster ) ? $this->cluster : 'main';
+
+               return wfForeignMemcKey( $db, $prefix, 'jobqueue', $cluster, $this->type, $property );
+       }
+
+       /**
+        * @param $params
+        * @return string
+        */
+       protected static function makeBlob( $params ) {
+               if ( $params !== false ) {
+                       return serialize( $params );
+               } else {
+                       return '';
+               }
+       }
+
+       /**
+        * @param $blob
+        * @return bool|mixed
+        */
+       protected static function extractBlob( $blob ) {
+               if ( (string)$blob !== '' ) {
+                       return unserialize( $blob );
+               } else {
+                       return false;
+               }
+       }
+
+       /**
+        * @param DBError $e
+        * @throws JobQueueError
+        */
+       protected function throwDBException( DBError $e ) {
+               throw new JobQueueError( get_class( $e ) . ": " . $e->getMessage() );
+       }
+
+       /**
+        * Return the list of job fields that should be selected.
+        * @since 1.23
+        * @return array
+        */
+       public static function selectFields() {
+               return array(
+                       'job_id',
+                       'job_cmd',
+                       'job_namespace',
+                       'job_title',
+                       'job_timestamp',
+                       'job_params',
+                       'job_random',
+                       'job_attempts',
+                       'job_token',
+                       'job_token_timestamp',
+                       'job_sha1',
+               );
+       }
+}
diff --git a/includes/jobqueue/JobQueueFederated.php b/includes/jobqueue/JobQueueFederated.php
new file mode 100644 (file)
index 0000000..9502148
--- /dev/null
@@ -0,0 +1,553 @@
+<?php
+/**
+ * Job queue code for federated queues.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @author Aaron Schulz
+ */
+
+/**
+ * Class to handle enqueueing and running of background jobs for federated queues
+ *
+ * This class allows for queues to be partitioned into smaller queues.
+ * A partition is defined by the configuration for a JobQueue instance.
+ * For example, one can set $wgJobTypeConf['refreshLinks'] to point to a
+ * JobQueueFederated instance, which itself would consist of three JobQueueRedis
+ * instances, each using their own redis server. This would allow for the jobs
+ * to be split (evenly or based on weights) accross multiple servers if a single
+ * server becomes impractical or expensive. Different JobQueue classes can be mixed.
+ *
+ * The basic queue configuration (e.g. "order", "claimTTL") of a federated queue
+ * is inherited by the partition queues. Additional configuration defines what
+ * section each wiki is in, what partition queues each section uses (and their weight),
+ * and the JobQueue configuration for each partition. Some sections might only need a
+ * single queue partition, like the sections for groups of small wikis.
+ *
+ * If used for performance, then $wgMainCacheType should be set to memcached/redis.
+ * Note that "fifo" cannot be used for the ordering, since the data is distributed.
+ * One can still use "timestamp" instead, as in "roughly timestamp ordered". Also,
+ * queue classes used by this should ignore down servers (with TTL) to avoid slowness.
+ *
+ * @ingroup JobQueue
+ * @since 1.22
+ */
+class JobQueueFederated extends JobQueue {
+       /** @var array (partition name => weight) reverse sorted by weight */
+       protected $partitionMap = array();
+
+       /** @var array (partition name => JobQueue) reverse sorted by weight */
+       protected $partitionQueues = array();
+
+       /** @var HashRing */
+       protected $partitionPushRing;
+
+       /** @var BagOStuff */
+       protected $cache;
+
+       /** @var int Maximum number of partitions to try */
+       protected $maxPartitionsTry;
+
+       const CACHE_TTL_SHORT = 30; // integer; seconds to cache info without re-validating
+       const CACHE_TTL_LONG = 300; // integer; seconds to cache info that is kept up to date
+
+       /**
+        * @params include:
+        *  - sectionsByWiki      : A map of wiki IDs to section names.
+        *                          Wikis will default to using the section "default".
+        *  - partitionsBySection : Map of section names to maps of (partition name => weight).
+        *                          A section called 'default' must be defined if not all wikis
+        *                          have explicitly defined sections.
+        *  - configByPartition   : Map of queue partition names to configuration arrays.
+        *                          These configuration arrays are passed to JobQueue::factory().
+        *                          The options set here are overriden by those passed to this
+        *                          the federated queue itself (e.g. 'order' and 'claimTTL').
+        *  - partitionsNoPush    : List of partition names that can handle pop() but not push().
+        *                          This can be used to migrate away from a certain partition.
+        *  - maxPartitionsTry    : Maximum number of times to attempt job insertion using
+        *                          different partition queues. This improves availability
+        *                          during failure, at the cost of added latency and somewhat
+        *                          less reliable job de-duplication mechanisms.
+        * @param array $params
+        * @throws MWException
+        */
+       protected function __construct( array $params ) {
+               parent::__construct( $params );
+               $section = isset( $params['sectionsByWiki'][$this->wiki] )
+                       ? $params['sectionsByWiki'][$this->wiki]
+                       : 'default';
+               if ( !isset( $params['partitionsBySection'][$section] ) ) {
+                       throw new MWException( "No configuration for section '$section'." );
+               }
+               $this->maxPartitionsTry = isset( $params['maxPartitionsTry'] )
+                       ? $params['maxPartitionsTry']
+                       : 2;
+               // Get the full partition map
+               $this->partitionMap = $params['partitionsBySection'][$section];
+               arsort( $this->partitionMap, SORT_NUMERIC );
+               // Get the partitions jobs can actually be pushed to
+               $partitionPushMap = $this->partitionMap;
+               if ( isset( $params['partitionsNoPush'] ) ) {
+                       foreach ( $params['partitionsNoPush'] as $partition ) {
+                               unset( $partitionPushMap[$partition] );
+                       }
+               }
+               // Get the config to pass to merge into each partition queue config
+               $baseConfig = $params;
+               foreach ( array( 'class', 'sectionsByWiki', 'maxPartitionsTry',
+                       'partitionsBySection', 'configByPartition', 'partitionsNoPush' ) as $o
+               ) {
+                       unset( $baseConfig[$o] ); // partition queue doesn't care about this
+               }
+               // Get the partition queue objects
+               foreach ( $this->partitionMap as $partition => $w ) {
+                       if ( !isset( $params['configByPartition'][$partition] ) ) {
+                               throw new MWException( "No configuration for partition '$partition'." );
+                       }
+                       $this->partitionQueues[$partition] = JobQueue::factory(
+                               $baseConfig + $params['configByPartition'][$partition] );
+               }
+               // Get the ring of partitions to push jobs into
+               $this->partitionPushRing = new HashRing( $partitionPushMap );
+               // Aggregate cache some per-queue values if there are multiple partition queues
+               $this->cache = count( $this->partitionMap ) > 1 ? wfGetMainCache() : new EmptyBagOStuff();
+       }
+
+       protected function supportedOrders() {
+               // No FIFO due to partitioning, though "rough timestamp order" is supported
+               return array( 'undefined', 'random', 'timestamp' );
+       }
+
+       protected function optimalOrder() {
+               return 'undefined'; // defer to the partitions
+       }
+
+       protected function supportsDelayedJobs() {
+               return true; // defer checks to the partitions
+       }
+
+       protected function doIsEmpty() {
+               $key = $this->getCacheKey( 'empty' );
+
+               $isEmpty = $this->cache->get( $key );
+               if ( $isEmpty === 'true' ) {
+                       return true;
+               } elseif ( $isEmpty === 'false' ) {
+                       return false;
+               }
+
+               $empty = true;
+               $failed = 0;
+               foreach ( $this->partitionQueues as $queue ) {
+                       try {
+                               $empty = $empty && $queue->doIsEmpty();
+                       } catch ( JobQueueError $e ) {
+                               ++$failed;
+                               MWExceptionHandler::logException( $e );
+                       }
+               }
+               $this->throwErrorIfAllPartitionsDown( $failed );
+
+               $this->cache->add( $key, $empty ? 'true' : 'false', self::CACHE_TTL_LONG );
+               return $empty;
+       }
+
+       protected function doGetSize() {
+               return $this->getCrossPartitionSum( 'size', 'doGetSize' );
+       }
+
+       protected function doGetAcquiredCount() {
+               return $this->getCrossPartitionSum( 'acquiredcount', 'doGetAcquiredCount' );
+       }
+
+       protected function doGetDelayedCount() {
+               return $this->getCrossPartitionSum( 'delayedcount', 'doGetDelayedCount' );
+       }
+
+       protected function doGetAbandonedCount() {
+               return $this->getCrossPartitionSum( 'abandonedcount', 'doGetAbandonedCount' );
+       }
+
+       /**
+        * @param string $type
+        * @param string $method
+        * @return int
+        */
+       protected function getCrossPartitionSum( $type, $method ) {
+               $key = $this->getCacheKey( $type );
+
+               $count = $this->cache->get( $key );
+               if ( is_int( $count ) ) {
+                       return $count;
+               }
+
+               $failed = 0;
+               foreach ( $this->partitionQueues as $queue ) {
+                       try {
+                               $count += $queue->$method();
+                       } catch ( JobQueueError $e ) {
+                               ++$failed;
+                               MWExceptionHandler::logException( $e );
+                       }
+               }
+               $this->throwErrorIfAllPartitionsDown( $failed );
+
+               $this->cache->set( $key, $count, self::CACHE_TTL_SHORT );
+
+               return $count;
+       }
+
+       protected function doBatchPush( array $jobs, $flags ) {
+               // Local ring variable that may be changed to point to a new ring on failure
+               $partitionRing = $this->partitionPushRing;
+               // Try to insert the jobs and update $partitionsTry on any failures.
+               // Retry to insert any remaning jobs again, ignoring the bad partitions.
+               $jobsLeft = $jobs;
+               for ( $i = $this->maxPartitionsTry; $i > 0 && count( $jobsLeft ); --$i ) {
+                       $jobsLeft = $this->tryJobInsertions( $jobsLeft, $partitionRing, $flags );
+               }
+               if ( count( $jobsLeft ) ) {
+                       throw new JobQueueError(
+                               "Could not insert job(s), {$this->maxPartitionsTry} partitions tried." );
+               }
+
+               return true;
+       }
+
+       /**
+        * @param array $jobs
+        * @param HashRing $partitionRing
+        * @param int $flags
+        * @throws JobQueueError
+        * @return array List of Job object that could not be inserted
+        */
+       protected function tryJobInsertions( array $jobs, HashRing &$partitionRing, $flags ) {
+               $jobsLeft = array();
+
+               // Because jobs are spread across partitions, per-job de-duplication needs
+               // to use a consistent hash to avoid allowing duplicate jobs per partition.
+               // When inserting a batch of de-duplicated jobs, QOS_ATOMIC is disregarded.
+               $uJobsByPartition = array(); // (partition name => job list)
+               /** @var Job $job */
+               foreach ( $jobs as $key => $job ) {
+                       if ( $job->ignoreDuplicates() ) {
+                               $sha1 = sha1( serialize( $job->getDeduplicationInfo() ) );
+                               $uJobsByPartition[$partitionRing->getLocation( $sha1 )][] = $job;
+                               unset( $jobs[$key] );
+                       }
+               }
+               // Get the batches of jobs that are not de-duplicated
+               if ( $flags & self::QOS_ATOMIC ) {
+                       $nuJobBatches = array( $jobs ); // all or nothing
+               } else {
+                       // Split the jobs into batches and spread them out over servers if there
+                       // are many jobs. This helps keep the partitions even. Otherwise, send all
+                       // the jobs to a single partition queue to avoids the extra connections.
+                       $nuJobBatches = array_chunk( $jobs, 300 );
+               }
+
+               // Insert the de-duplicated jobs into the queues...
+               foreach ( $uJobsByPartition as $partition => $jobBatch ) {
+                       /** @var JobQueue $queue */
+                       $queue = $this->partitionQueues[$partition];
+                       try {
+                               $ok = $queue->doBatchPush( $jobBatch, $flags | self::QOS_ATOMIC );
+                       } catch ( JobQueueError $e ) {
+                               $ok = false;
+                               MWExceptionHandler::logException( $e );
+                       }
+                       if ( $ok ) {
+                               $key = $this->getCacheKey( 'empty' );
+                               $this->cache->set( $key, 'false', JobQueueDB::CACHE_TTL_LONG );
+                       } else {
+                               $partitionRing = $partitionRing->newWithoutLocation( $partition ); // blacklist
+                               if ( !$partitionRing ) {
+                                       throw new JobQueueError( "Could not insert job(s), no partitions available." );
+                               }
+                               $jobsLeft = array_merge( $jobsLeft, $jobBatch ); // not inserted
+                       }
+               }
+
+               // Insert the jobs that are not de-duplicated into the queues...
+               foreach ( $nuJobBatches as $jobBatch ) {
+                       $partition = ArrayUtils::pickRandom( $partitionRing->getLocationWeights() );
+                       $queue = $this->partitionQueues[$partition];
+                       try {
+                               $ok = $queue->doBatchPush( $jobBatch, $flags | self::QOS_ATOMIC );
+                       } catch ( JobQueueError $e ) {
+                               $ok = false;
+                               MWExceptionHandler::logException( $e );
+                       }
+                       if ( $ok ) {
+                               $key = $this->getCacheKey( 'empty' );
+                               $this->cache->set( $key, 'false', JobQueueDB::CACHE_TTL_LONG );
+                       } else {
+                               $partitionRing = $partitionRing->newWithoutLocation( $partition ); // blacklist
+                               if ( !$partitionRing ) {
+                                       throw new JobQueueError( "Could not insert job(s), no partitions available." );
+                               }
+                               $jobsLeft = array_merge( $jobsLeft, $jobBatch ); // not inserted
+                       }
+               }
+
+               return $jobsLeft;
+       }
+
+       protected function doPop() {
+               $key = $this->getCacheKey( 'empty' );
+
+               $isEmpty = $this->cache->get( $key );
+               if ( $isEmpty === 'true' ) {
+                       return false;
+               }
+
+               $partitionsTry = $this->partitionMap; // (partition => weight)
+
+               $failed = 0;
+               while ( count( $partitionsTry ) ) {
+                       $partition = ArrayUtils::pickRandom( $partitionsTry );
+                       if ( $partition === false ) {
+                               break; // all partitions at 0 weight
+                       }
+
+                       /** @var JobQueue $queue */
+                       $queue = $this->partitionQueues[$partition];
+                       try {
+                               $job = $queue->pop();
+                       } catch ( JobQueueError $e ) {
+                               ++$failed;
+                               MWExceptionHandler::logException( $e );
+                               $job = false;
+                       }
+                       if ( $job ) {
+                               $job->metadata['QueuePartition'] = $partition;
+
+                               return $job;
+                       } else {
+                               unset( $partitionsTry[$partition] ); // blacklist partition
+                       }
+               }
+               $this->throwErrorIfAllPartitionsDown( $failed );
+
+               $this->cache->set( $key, 'true', JobQueueDB::CACHE_TTL_LONG );
+
+               return false;
+       }
+
+       protected function doAck( Job $job ) {
+               if ( !isset( $job->metadata['QueuePartition'] ) ) {
+                       throw new MWException( "The given job has no defined partition name." );
+               }
+
+               return $this->partitionQueues[$job->metadata['QueuePartition']]->ack( $job );
+       }
+
+       protected function doIsRootJobOldDuplicate( Job $job ) {
+               $params = $job->getRootJobParams();
+               $partitions = $this->partitionPushRing->getLocations( $params['rootJobSignature'], 2 );
+               try {
+                       return $this->partitionQueues[$partitions[0]]->doIsRootJobOldDuplicate( $job );
+               } catch ( JobQueueError $e ) {
+                       if ( isset( $partitions[1] ) ) { // check fallback partition
+                               return $this->partitionQueues[$partitions[1]]->doIsRootJobOldDuplicate( $job );
+                       }
+               }
+
+               return false;
+       }
+
+       protected function doDeduplicateRootJob( Job $job ) {
+               $params = $job->getRootJobParams();
+               $partitions = $this->partitionPushRing->getLocations( $params['rootJobSignature'], 2 );
+               try {
+                       return $this->partitionQueues[$partitions[0]]->doDeduplicateRootJob( $job );
+               } catch ( JobQueueError $e ) {
+                       if ( isset( $partitions[1] ) ) { // check fallback partition
+                               return $this->partitionQueues[$partitions[1]]->doDeduplicateRootJob( $job );
+                       }
+               }
+
+               return false;
+       }
+
+       protected function doDelete() {
+               $failed = 0;
+               /** @var JobQueue $queue */
+               foreach ( $this->partitionQueues as $queue ) {
+                       try {
+                               $queue->doDelete();
+                       } catch ( JobQueueError $e ) {
+                               ++$failed;
+                               MWExceptionHandler::logException( $e );
+                       }
+               }
+               $this->throwErrorIfAllPartitionsDown( $failed );
+               return true;
+       }
+
+       protected function doWaitForBackups() {
+               $failed = 0;
+               /** @var JobQueue $queue */
+               foreach ( $this->partitionQueues as $queue ) {
+                       try {
+                               $queue->waitForBackups();
+                       } catch ( JobQueueError $e ) {
+                               ++$failed;
+                               MWExceptionHandler::logException( $e );
+                       }
+               }
+               $this->throwErrorIfAllPartitionsDown( $failed );
+       }
+
+       protected function doGetPeriodicTasks() {
+               $tasks = array();
+               /** @var JobQueue $queue */
+               foreach ( $this->partitionQueues as $partition => $queue ) {
+                       foreach ( $queue->getPeriodicTasks() as $task => $def ) {
+                               $tasks["{$partition}:{$task}"] = $def;
+                       }
+               }
+
+               return $tasks;
+       }
+
+       protected function doFlushCaches() {
+               static $types = array(
+                       'empty',
+                       'size',
+                       'acquiredcount',
+                       'delayedcount',
+                       'abandonedcount'
+               );
+
+               foreach ( $types as $type ) {
+                       $this->cache->delete( $this->getCacheKey( $type ) );
+               }
+
+               /** @var JobQueue $queue */
+               foreach ( $this->partitionQueues as $queue ) {
+                       $queue->doFlushCaches();
+               }
+       }
+
+       public function getAllQueuedJobs() {
+               $iterator = new AppendIterator();
+
+               /** @var JobQueue $queue */
+               foreach ( $this->partitionQueues as $queue ) {
+                       $iterator->append( $queue->getAllQueuedJobs() );
+               }
+
+               return $iterator;
+       }
+
+       public function getAllDelayedJobs() {
+               $iterator = new AppendIterator();
+
+               /** @var JobQueue $queue */
+               foreach ( $this->partitionQueues as $queue ) {
+                       $iterator->append( $queue->getAllDelayedJobs() );
+               }
+
+               return $iterator;
+       }
+
+       public function getCoalesceLocationInternal() {
+               return "JobQueueFederated:wiki:{$this->wiki}" .
+                       sha1( serialize( array_keys( $this->partitionMap ) ) );
+       }
+
+       protected function doGetSiblingQueuesWithJobs( array $types ) {
+               $result = array();
+
+               $failed = 0;
+               /** @var JobQueue $queue */
+               foreach ( $this->partitionQueues as $queue ) {
+                       try {
+                               $nonEmpty = $queue->doGetSiblingQueuesWithJobs( $types );
+                               if ( is_array( $nonEmpty ) ) {
+                                       $result = array_unique( array_merge( $result, $nonEmpty ) );
+                               } else {
+                                       return null; // not supported on all partitions; bail
+                               }
+                               if ( count( $result ) == count( $types ) ) {
+                                       break; // short-circuit
+                               }
+                       } catch ( JobQueueError $e ) {
+                               ++$failed;
+                               MWExceptionHandler::logException( $e );
+                       }
+               }
+               $this->throwErrorIfAllPartitionsDown( $failed );
+
+               return array_values( $result );
+       }
+
+       protected function doGetSiblingQueueSizes( array $types ) {
+               $result = array();
+               $failed = 0;
+               /** @var JobQueue $queue */
+               foreach ( $this->partitionQueues as $queue ) {
+                       try {
+                               $sizes = $queue->doGetSiblingQueueSizes( $types );
+                               if ( is_array( $sizes ) ) {
+                                       foreach ( $sizes as $type => $size ) {
+                                               $result[$type] = isset( $result[$type] ) ? $result[$type] + $size : $size;
+                                       }
+                               } else {
+                                       return null; // not supported on all partitions; bail
+                               }
+                       } catch ( JobQueueError $e ) {
+                               ++$failed;
+                               MWExceptionHandler::logException( $e );
+                       }
+               }
+               $this->throwErrorIfAllPartitionsDown( $failed );
+
+               return $result;
+       }
+
+       /**
+        * Throw an error if no partitions available
+        *
+        * @param int $down The number of up partitions down
+        * @return void
+        * @throws JobQueueError
+        */
+       protected function throwErrorIfAllPartitionsDown( $down ) {
+               if ( $down >= count( $this->partitionQueues ) ) {
+                       throw new JobQueueError( 'No queue partitions available.' );
+               }
+       }
+
+       public function setTestingPrefix( $key ) {
+               /** @var JobQueue $queue */
+               foreach ( $this->partitionQueues as $queue ) {
+                       $queue->setTestingPrefix( $key );
+               }
+       }
+
+       /**
+        * @param $property
+        * @return string
+        */
+       private function getCacheKey( $property ) {
+               list( $db, $prefix ) = wfSplitWikiID( $this->wiki );
+
+               return wfForeignMemcKey( $db, $prefix, 'jobqueue', $this->type, $property );
+       }
+}
diff --git a/includes/jobqueue/JobQueueGroup.php b/includes/jobqueue/JobQueueGroup.php
new file mode 100644 (file)
index 0000000..90742ce
--- /dev/null
@@ -0,0 +1,417 @@
+<?php
+/**
+ * Job queue base code.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @author Aaron Schulz
+ */
+
+/**
+ * Class to handle enqueueing of background jobs
+ *
+ * @ingroup JobQueue
+ * @since 1.21
+ */
+class JobQueueGroup {
+       /** @var array */
+       protected static $instances = array();
+
+       /** @var ProcessCacheLRU */
+       protected $cache;
+
+       /** @var string Wiki ID */
+       protected $wiki;
+
+       /** @var array Map of (bucket => (queue => JobQueue, types => list of types) */
+       protected $coalescedQueues;
+
+       const TYPE_DEFAULT = 1; // integer; jobs popped by default
+       const TYPE_ANY = 2; // integer; any job
+
+       const USE_CACHE = 1; // integer; use process or persistent cache
+
+       const PROC_CACHE_TTL = 15; // integer; seconds
+
+       const CACHE_VERSION = 1; // integer; cache version
+
+       /**
+        * @param string $wiki Wiki ID
+        */
+       protected function __construct( $wiki ) {
+               $this->wiki = $wiki;
+               $this->cache = new ProcessCacheLRU( 10 );
+       }
+
+       /**
+        * @param bool|string $wiki Wiki ID
+        * @return JobQueueGroup
+        */
+       public static function singleton( $wiki = false ) {
+               $wiki = ( $wiki === false ) ? wfWikiID() : $wiki;
+               if ( !isset( self::$instances[$wiki] ) ) {
+                       self::$instances[$wiki] = new self( $wiki );
+               }
+
+               return self::$instances[$wiki];
+       }
+
+       /**
+        * Destroy the singleton instances
+        *
+        * @return void
+        */
+       public static function destroySingletons() {
+               self::$instances = array();
+       }
+
+       /**
+        * Get the job queue object for a given queue type
+        *
+        * @param string $type
+        * @return JobQueue
+        */
+       public function get( $type ) {
+               global $wgJobTypeConf;
+
+               $conf = array( 'wiki' => $this->wiki, 'type' => $type );
+               if ( isset( $wgJobTypeConf[$type] ) ) {
+                       $conf = $conf + $wgJobTypeConf[$type];
+               } else {
+                       $conf = $conf + $wgJobTypeConf['default'];
+               }
+
+               return JobQueue::factory( $conf );
+       }
+
+       /**
+        * Insert jobs into the respective queues of with the belong.
+        *
+        * This inserts the jobs into the queue specified by $wgJobTypeConf
+        * and updates the aggregate job queue information cache as needed.
+        *
+        * @param Job|array $jobs A single Job or a list of Jobs
+        * @throws MWException
+        * @return bool
+        */
+       public function push( $jobs ) {
+               $jobs = is_array( $jobs ) ? $jobs : array( $jobs );
+               if ( !count( $jobs ) ) {
+                       return true;
+               }
+
+               $jobsByType = array(); // (job type => list of jobs)
+               foreach ( $jobs as $job ) {
+                       if ( $job instanceof IJobSpecification ) {
+                               $jobsByType[$job->getType()][] = $job;
+                       } else {
+                               throw new MWException( "Attempted to push a non-Job object into a queue." );
+                       }
+               }
+
+               $ok = true;
+               foreach ( $jobsByType as $type => $jobs ) {
+                       if ( $this->get( $type )->push( $jobs ) ) {
+                               JobQueueAggregator::singleton()->notifyQueueNonEmpty( $this->wiki, $type );
+                       } else {
+                               $ok = false;
+                       }
+               }
+
+               if ( $this->cache->has( 'queues-ready', 'list' ) ) {
+                       $list = $this->cache->get( 'queues-ready', 'list' );
+                       if ( count( array_diff( array_keys( $jobsByType ), $list ) ) ) {
+                               $this->cache->clear( 'queues-ready' );
+                       }
+               }
+
+               return $ok;
+       }
+
+       /**
+        * Pop a job off one of the job queues
+        *
+        * This pops a job off a queue as specified by $wgJobTypeConf and
+        * updates the aggregate job queue information cache as needed.
+        *
+        * @param int|string $qtype JobQueueGroup::TYPE_* constant or job type string
+        * @param int $flags Bitfield of JobQueueGroup::USE_* constants
+        * @param array $blacklist List of job types to ignore
+        * @return Job|bool Returns false on failure
+        */
+       public function pop( $qtype = self::TYPE_DEFAULT, $flags = 0, array $blacklist = array() ) {
+               $job = false;
+
+               if ( is_string( $qtype ) ) { // specific job type
+                       if ( !in_array( $qtype, $blacklist ) ) {
+                               $job = $this->get( $qtype )->pop();
+                               if ( !$job ) {
+                                       JobQueueAggregator::singleton()->notifyQueueEmpty( $this->wiki, $qtype );
+                               }
+                       }
+               } else { // any job in the "default" jobs types
+                       if ( $flags & self::USE_CACHE ) {
+                               if ( !$this->cache->has( 'queues-ready', 'list', self::PROC_CACHE_TTL ) ) {
+                                       $this->cache->set( 'queues-ready', 'list', $this->getQueuesWithJobs() );
+                               }
+                               $types = $this->cache->get( 'queues-ready', 'list' );
+                       } else {
+                               $types = $this->getQueuesWithJobs();
+                       }
+
+                       if ( $qtype == self::TYPE_DEFAULT ) {
+                               $types = array_intersect( $types, $this->getDefaultQueueTypes() );
+                       }
+
+                       $types = array_diff( $types, $blacklist ); // avoid selected types
+                       shuffle( $types ); // avoid starvation
+
+                       foreach ( $types as $type ) { // for each queue...
+                               $job = $this->get( $type )->pop();
+                               if ( $job ) { // found
+                                       break;
+                               } else { // not found
+                                       JobQueueAggregator::singleton()->notifyQueueEmpty( $this->wiki, $type );
+                                       $this->cache->clear( 'queues-ready' );
+                               }
+                       }
+               }
+
+               return $job;
+       }
+
+       /**
+        * Acknowledge that a job was completed
+        *
+        * @param Job $job
+        * @return bool
+        */
+       public function ack( Job $job ) {
+               return $this->get( $job->getType() )->ack( $job );
+       }
+
+       /**
+        * Register the "root job" of a given job into the queue for de-duplication.
+        * This should only be called right *after* all the new jobs have been inserted.
+        *
+        * @param Job $job
+        * @return bool
+        */
+       public function deduplicateRootJob( Job $job ) {
+               return $this->get( $job->getType() )->deduplicateRootJob( $job );
+       }
+
+       /**
+        * Wait for any slaves or backup queue servers to catch up.
+        *
+        * This does nothing for certain queue classes.
+        *
+        * @return void
+        * @throws MWException
+        */
+       public function waitForBackups() {
+               global $wgJobTypeConf;
+
+               wfProfileIn( __METHOD__ );
+               // Try to avoid doing this more than once per queue storage medium
+               foreach ( $wgJobTypeConf as $type => $conf ) {
+                       $this->get( $type )->waitForBackups();
+               }
+               wfProfileOut( __METHOD__ );
+       }
+
+       /**
+        * Get the list of queue types
+        *
+        * @return array List of strings
+        */
+       public function getQueueTypes() {
+               return array_keys( $this->getCachedConfigVar( 'wgJobClasses' ) );
+       }
+
+       /**
+        * Get the list of default queue types
+        *
+        * @return array List of strings
+        */
+       public function getDefaultQueueTypes() {
+               global $wgJobTypesExcludedFromDefaultQueue;
+
+               return array_diff( $this->getQueueTypes(), $wgJobTypesExcludedFromDefaultQueue );
+       }
+
+       /**
+        * Get the list of job types that have non-empty queues
+        *
+        * @return array List of job types that have non-empty queues
+        */
+       public function getQueuesWithJobs() {
+               $types = array();
+               foreach ( $this->getCoalescedQueues() as $info ) {
+                       $nonEmpty = $info['queue']->getSiblingQueuesWithJobs( $this->getQueueTypes() );
+                       if ( is_array( $nonEmpty ) ) { // batching features supported
+                               $types = array_merge( $types, $nonEmpty );
+                       } else { // we have to go through the queues in the bucket one-by-one
+                               foreach ( $info['types'] as $type ) {
+                                       if ( !$this->get( $type )->isEmpty() ) {
+                                               $types[] = $type;
+                                       }
+                               }
+                       }
+               }
+
+               return $types;
+       }
+
+       /**
+        * Get the size of the queus for a list of job types
+        *
+        * @return array Map of (job type => size)
+        */
+       public function getQueueSizes() {
+               $sizeMap = array();
+               foreach ( $this->getCoalescedQueues() as $info ) {
+                       $sizes = $info['queue']->getSiblingQueueSizes( $this->getQueueTypes() );
+                       if ( is_array( $sizes ) ) { // batching features supported
+                               $sizeMap = $sizeMap + $sizes;
+                       } else { // we have to go through the queues in the bucket one-by-one
+                               foreach ( $info['types'] as $type ) {
+                                       $sizeMap[$type] = $this->get( $type )->getSize();
+                               }
+                       }
+               }
+
+               return $sizeMap;
+       }
+
+       /**
+        * @return array
+        */
+       protected function getCoalescedQueues() {
+               global $wgJobTypeConf;
+
+               if ( $this->coalescedQueues === null ) {
+                       $this->coalescedQueues = array();
+                       foreach ( $wgJobTypeConf as $type => $conf ) {
+                               $queue = JobQueue::factory(
+                                       array( 'wiki' => $this->wiki, 'type' => 'null' ) + $conf );
+                               $loc = $queue->getCoalesceLocationInternal();
+                               if ( !isset( $this->coalescedQueues[$loc] ) ) {
+                                       $this->coalescedQueues[$loc]['queue'] = $queue;
+                                       $this->coalescedQueues[$loc]['types'] = array();
+                               }
+                               if ( $type === 'default' ) {
+                                       $this->coalescedQueues[$loc]['types'] = array_merge(
+                                               $this->coalescedQueues[$loc]['types'],
+                                               array_diff( $this->getQueueTypes(), array_keys( $wgJobTypeConf ) )
+                                       );
+                               } else {
+                                       $this->coalescedQueues[$loc]['types'][] = $type;
+                               }
+                       }
+               }
+
+               return $this->coalescedQueues;
+       }
+
+       /**
+        * Execute any due periodic queue maintenance tasks for all queues.
+        *
+        * A task is "due" if the time ellapsed since the last run is greater than
+        * the defined run period. Concurrent calls to this function will cause tasks
+        * to be attempted twice, so they may need their own methods of mutual exclusion.
+        *
+        * @return int Number of tasks run
+        */
+       public function executeReadyPeriodicTasks() {
+               global $wgMemc;
+
+               list( $db, $prefix ) = wfSplitWikiID( $this->wiki );
+               $key = wfForeignMemcKey( $db, $prefix, 'jobqueuegroup', 'taskruns', 'v1' );
+               $lastRuns = $wgMemc->get( $key ); // (queue => task => UNIX timestamp)
+
+               $count = 0;
+               $tasksRun = array(); // (queue => task => UNIX timestamp)
+               foreach ( $this->getQueueTypes() as $type ) {
+                       $queue = $this->get( $type );
+                       foreach ( $queue->getPeriodicTasks() as $task => $definition ) {
+                               if ( $definition['period'] <= 0 ) {
+                                       continue; // disabled
+                               } elseif ( !isset( $lastRuns[$type][$task] )
+                                       || $lastRuns[$type][$task] < ( time() - $definition['period'] )
+                               ) {
+                                       try {
+                                               if ( call_user_func( $definition['callback'] ) !== null ) {
+                                                       $tasksRun[$type][$task] = time();
+                                                       ++$count;
+                                               }
+                                       } catch ( JobQueueError $e ) {
+                                               MWExceptionHandler::logException( $e );
+                                       }
+                               }
+                       }
+                       // The tasks may have recycled jobs or release delayed jobs into the queue
+                       if ( isset( $tasksRun[$type] ) && !$queue->isEmpty() ) {
+                               JobQueueAggregator::singleton()->notifyQueueNonEmpty( $this->wiki, $type );
+                       }
+               }
+
+               $wgMemc->merge( $key, function ( $cache, $key, $lastRuns ) use ( $tasksRun ) {
+                       if ( is_array( $lastRuns ) ) {
+                               foreach ( $tasksRun as $type => $tasks ) {
+                                       foreach ( $tasks as $task => $timestamp ) {
+                                               if ( !isset( $lastRuns[$type][$task] )
+                                                       || $timestamp > $lastRuns[$type][$task]
+                                               ) {
+                                                       $lastRuns[$type][$task] = $timestamp;
+                                               }
+                                       }
+                               }
+                       } else {
+                               $lastRuns = $tasksRun;
+                       }
+
+                       return $lastRuns;
+               } );
+
+               return $count;
+       }
+
+       /**
+        * @param $name string
+        * @return mixed
+        */
+       private function getCachedConfigVar( $name ) {
+               global $wgConf, $wgMemc;
+
+               if ( $this->wiki === wfWikiID() ) {
+                       return $GLOBALS[$name]; // common case
+               } else {
+                       list( $db, $prefix ) = wfSplitWikiID( $this->wiki );
+                       $key = wfForeignMemcKey( $db, $prefix, 'configvalue', $name );
+                       $value = $wgMemc->get( $key ); // ('v' => ...) or false
+                       if ( is_array( $value ) ) {
+                               return $value['v'];
+                       } else {
+                               $value = $wgConf->getConfig( $this->wiki, $name );
+                               $wgMemc->set( $key, array( 'v' => $value ), 86400 + mt_rand( 0, 86400 ) );
+
+                               return $value;
+                       }
+               }
+       }
+}
diff --git a/includes/jobqueue/JobQueueRedis.php b/includes/jobqueue/JobQueueRedis.php
new file mode 100644 (file)
index 0000000..c785cb2
--- /dev/null
@@ -0,0 +1,874 @@
+<?php
+/**
+ * Redis-backed job queue code.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @author Aaron Schulz
+ */
+
+/**
+ * Class to handle job queues stored in Redis
+ *
+ * This is faster, less resource intensive, queue that JobQueueDB.
+ * All data for a queue using this class is placed into one redis server.
+ *
+ * There are eight main redis keys used to track jobs:
+ *   - l-unclaimed  : A list of job IDs used for ready unclaimed jobs
+ *   - z-claimed    : A sorted set of (job ID, UNIX timestamp as score) used for job retries
+ *   - z-abandoned  : A sorted set of (job ID, UNIX timestamp as score) used for broken jobs
+ *   - z-delayed    : A sorted set of (job ID, UNIX timestamp as score) used for delayed jobs
+ *   - h-idBySha1   : A hash of (SHA1 => job ID) for unclaimed jobs used for de-duplication
+ *   - h-sha1ById   : A hash of (job ID => SHA1) for unclaimed jobs used for de-duplication
+ *   - h-attempts   : A hash of (job ID => attempt count) used for job claiming/retries
+ *   - h-data       : A hash of (job ID => serialized blobs) for job storage
+ * A job ID can be in only one of z-delayed, l-unclaimed, z-claimed, and z-abandoned.
+ * If an ID appears in any of those lists, it should have a h-data entry for its ID.
+ * If a job has a SHA1 de-duplication value and its ID is in l-unclaimed or z-delayed, then
+ * there should be no other such jobs with that SHA1. Every h-idBySha1 entry has an h-sha1ById
+ * entry and every h-sha1ById must refer to an ID that is l-unclaimed. If a job has its
+ * ID in z-claimed or z-abandoned, then it must also have an h-attempts entry for its ID.
+ *
+ * Additionally, "rootjob:* keys track "root jobs" used for additional de-duplication.
+ * Aside from root job keys, all keys have no expiry, and are only removed when jobs are run.
+ * All the keys are prefixed with the relevant wiki ID information.
+ *
+ * This class requires Redis 2.6 as it makes use Lua scripts for fast atomic operations.
+ * Additionally, it should be noted that redis has different persistence modes, such
+ * as rdb snapshots, journaling, and no persistent. Appropriate configuration should be
+ * made on the servers based on what queues are using it and what tolerance they have.
+ *
+ * @ingroup JobQueue
+ * @ingroup Redis
+ * @since 1.22
+ */
+class JobQueueRedis extends JobQueue {
+       /** @var RedisConnectionPool */
+       protected $redisPool;
+
+       /** @var string Server address */
+       protected $server;
+
+       /** @var string Compression method to use */
+       protected $compression;
+
+       const MAX_AGE_PRUNE = 604800; // integer; seconds a job can live once claimed (7 days)
+
+       /** @var string Key to prefix the queue keys with (used for testing) */
+       protected $key;
+
+       /**
+        * @var null|int maximum seconds between execution of periodic tasks.  Used to speed up
+        * testing but should otherwise be left unset.
+        */
+       protected $maximumPeriodicTaskSeconds;
+
+       /**
+        * @params include:
+        *   - redisConfig : An array of parameters to RedisConnectionPool::__construct().
+        *                   Note that the serializer option is ignored as "none" is always used.
+        *   - redisServer : A hostname/port combination or the absolute path of a UNIX socket.
+        *                   If a hostname is specified but no port, the standard port number
+        *                   6379 will be used. Required.
+        *   - compression : The type of compression to use; one of (none,gzip).
+        *   - maximumPeriodicTaskSeconds : Maximum seconds between check periodic tasks.  Set to
+        *                   force faster execution of periodic tasks for inegration tests that
+        *                   rely on checkDelay.  Without this the integration tests are very very
+        *                   slow.  This really shouldn't be set in production.
+        * @param array $params
+        */
+       public function __construct( array $params ) {
+               parent::__construct( $params );
+               $params['redisConfig']['serializer'] = 'none'; // make it easy to use Lua
+               $this->server = $params['redisServer'];
+               $this->compression = isset( $params['compression'] ) ? $params['compression'] : 'none';
+               $this->redisPool = RedisConnectionPool::singleton( $params['redisConfig'] );
+               $this->maximumPeriodicTaskSeconds = isset( $params['maximumPeriodicTaskSeconds'] ) ?
+                       $params['maximumPeriodicTaskSeconds'] : null;
+       }
+
+       protected function supportedOrders() {
+               return array( 'timestamp', 'fifo' );
+       }
+
+       protected function optimalOrder() {
+               return 'fifo';
+       }
+
+       protected function supportsDelayedJobs() {
+               return true;
+       }
+
+       /**
+        * @see JobQueue::doIsEmpty()
+        * @return bool
+        * @throws MWException
+        */
+       protected function doIsEmpty() {
+               return $this->doGetSize() == 0;
+       }
+
+       /**
+        * @see JobQueue::doGetSize()
+        * @return int
+        * @throws MWException
+        */
+       protected function doGetSize() {
+               $conn = $this->getConnection();
+               try {
+                       return $conn->lSize( $this->getQueueKey( 'l-unclaimed' ) );
+               } catch ( RedisException $e ) {
+                       $this->throwRedisException( $conn, $e );
+               }
+       }
+
+       /**
+        * @see JobQueue::doGetAcquiredCount()
+        * @return int
+        * @throws JobQueueError
+        */
+       protected function doGetAcquiredCount() {
+               if ( $this->claimTTL <= 0 ) {
+                       return 0; // no acknowledgements
+               }
+               $conn = $this->getConnection();
+               try {
+                       $conn->multi( Redis::PIPELINE );
+                       $conn->zSize( $this->getQueueKey( 'z-claimed' ) );
+                       $conn->zSize( $this->getQueueKey( 'z-abandoned' ) );
+
+                       return array_sum( $conn->exec() );
+               } catch ( RedisException $e ) {
+                       $this->throwRedisException( $conn, $e );
+               }
+       }
+
+       /**
+        * @see JobQueue::doGetDelayedCount()
+        * @return int
+        * @throws JobQueueError
+        */
+       protected function doGetDelayedCount() {
+               if ( !$this->checkDelay ) {
+                       return 0; // no delayed jobs
+               }
+               $conn = $this->getConnection();
+               try {
+                       return $conn->zSize( $this->getQueueKey( 'z-delayed' ) );
+               } catch ( RedisException $e ) {
+                       $this->throwRedisException( $conn, $e );
+               }
+       }
+
+       /**
+        * @see JobQueue::doGetAbandonedCount()
+        * @return int
+        * @throws JobQueueError
+        */
+       protected function doGetAbandonedCount() {
+               if ( $this->claimTTL <= 0 ) {
+                       return 0; // no acknowledgements
+               }
+               $conn = $this->getConnection();
+               try {
+                       return $conn->zSize( $this->getQueueKey( 'z-abandoned' ) );
+               } catch ( RedisException $e ) {
+                       $this->throwRedisException( $conn, $e );
+               }
+       }
+
+       /**
+        * @see JobQueue::doBatchPush()
+        * @param array $jobs
+        * @param $flags
+        * @return bool
+        * @throws JobQueueError
+        */
+       protected function doBatchPush( array $jobs, $flags ) {
+               // Convert the jobs into field maps (de-duplicated against each other)
+               $items = array(); // (job ID => job fields map)
+               foreach ( $jobs as $job ) {
+                       $item = $this->getNewJobFields( $job );
+                       if ( strlen( $item['sha1'] ) ) { // hash identifier => de-duplicate
+                               $items[$item['sha1']] = $item;
+                       } else {
+                               $items[$item['uuid']] = $item;
+                       }
+               }
+
+               if ( !count( $items ) ) {
+                       return true; // nothing to do
+               }
+
+               $conn = $this->getConnection();
+               try {
+                       // Actually push the non-duplicate jobs into the queue...
+                       if ( $flags & self::QOS_ATOMIC ) {
+                               $batches = array( $items ); // all or nothing
+                       } else {
+                               $batches = array_chunk( $items, 500 ); // avoid tying up the server
+                       }
+                       $failed = 0;
+                       $pushed = 0;
+                       foreach ( $batches as $itemBatch ) {
+                               $added = $this->pushBlobs( $conn, $itemBatch );
+                               if ( is_int( $added ) ) {
+                                       $pushed += $added;
+                               } else {
+                                       $failed += count( $itemBatch );
+                               }
+                       }
+                       if ( $failed > 0 ) {
+                               wfDebugLog( 'JobQueueRedis', "Could not insert {$failed} {$this->type} job(s)." );
+
+                               return false;
+                       }
+                       JobQueue::incrStats( 'job-insert', $this->type, count( $items ) );
+                       JobQueue::incrStats( 'job-insert-duplicate', $this->type,
+                               count( $items ) - $failed - $pushed );
+               } catch ( RedisException $e ) {
+                       $this->throwRedisException( $conn, $e );
+               }
+
+               return true;
+       }
+
+       /**
+        * @param RedisConnRef $conn
+        * @param array $items List of results from JobQueueRedis::getNewJobFields()
+        * @return int Number of jobs inserted (duplicates are ignored)
+        * @throws RedisException
+        */
+       protected function pushBlobs( RedisConnRef $conn, array $items ) {
+               $args = array(); // ([id, sha1, rtime, blob [, id, sha1, rtime, blob ... ] ] )
+               foreach ( $items as $item ) {
+                       $args[] = (string)$item['uuid'];
+                       $args[] = (string)$item['sha1'];
+                       $args[] = (string)$item['rtimestamp'];
+                       $args[] = (string)$this->serialize( $item );
+               }
+               static $script =
+<<<LUA
+               local kUnclaimed, kSha1ById, kIdBySha1, kDelayed, kData = unpack(KEYS)
+               if #ARGV % 4 ~= 0 then return redis.error_reply('Unmatched arguments') end
+               local pushed = 0
+               for i = 1,#ARGV,4 do
+                       local id,sha1,rtimestamp,blob = ARGV[i],ARGV[i+1],ARGV[i+2],ARGV[i+3]
+                       if sha1 == '' or redis.call('hExists',kIdBySha1,sha1) == 0 then
+                               if 1*rtimestamp > 0 then
+                                       -- Insert into delayed queue (release time as score)
+                                       redis.call('zAdd',kDelayed,rtimestamp,id)
+                               else
+                                       -- Insert into unclaimed queue
+                                       redis.call('lPush',kUnclaimed,id)
+                               end
+                               if sha1 ~= '' then
+                                       redis.call('hSet',kSha1ById,id,sha1)
+                                       redis.call('hSet',kIdBySha1,sha1,id)
+                               end
+                               redis.call('hSet',kData,id,blob)
+                               pushed = pushed + 1
+                       end
+               end
+               return pushed
+LUA;
+               return $conn->luaEval( $script,
+                       array_merge(
+                               array(
+                                       $this->getQueueKey( 'l-unclaimed' ), # KEYS[1]
+                                       $this->getQueueKey( 'h-sha1ById' ), # KEYS[2]
+                                       $this->getQueueKey( 'h-idBySha1' ), # KEYS[3]
+                                       $this->getQueueKey( 'z-delayed' ), # KEYS[4]
+                                       $this->getQueueKey( 'h-data' ), # KEYS[5]
+                               ),
+                               $args
+                       ),
+                       5 # number of first argument(s) that are keys
+               );
+       }
+
+       /**
+        * @see JobQueue::doPop()
+        * @return Job|bool
+        * @throws JobQueueError
+        */
+       protected function doPop() {
+               $job = false;
+
+               // Push ready delayed jobs into the queue every 10 jobs to spread the load.
+               // This is also done as a periodic task, but we don't want too much done at once.
+               if ( $this->checkDelay && mt_rand( 0, 9 ) == 0 ) {
+                       $this->recyclePruneAndUndelayJobs();
+               }
+
+               $conn = $this->getConnection();
+               try {
+                       do {
+                               if ( $this->claimTTL > 0 ) {
+                                       // Keep the claimed job list down for high-traffic queues
+                                       if ( mt_rand( 0, 99 ) == 0 ) {
+                                               $this->recyclePruneAndUndelayJobs();
+                                       }
+                                       $blob = $this->popAndAcquireBlob( $conn );
+                               } else {
+                                       $blob = $this->popAndDeleteBlob( $conn );
+                               }
+                               if ( $blob === false ) {
+                                       break; // no jobs; nothing to do
+                               }
+
+                               JobQueue::incrStats( 'job-pop', $this->type );
+                               $item = $this->unserialize( $blob );
+                               if ( $item === false ) {
+                                       wfDebugLog( 'JobQueueRedis', "Could not unserialize {$this->type} job." );
+                                       continue;
+                               }
+
+                               // If $item is invalid, recyclePruneAndUndelayJobs() will cleanup as needed
+                               $job = $this->getJobFromFields( $item ); // may be false
+                       } while ( !$job ); // job may be false if invalid
+               } catch ( RedisException $e ) {
+                       $this->throwRedisException( $conn, $e );
+               }
+
+               return $job;
+       }
+
+       /**
+        * @param RedisConnRef $conn
+        * @return array serialized string or false
+        * @throws RedisException
+        */
+       protected function popAndDeleteBlob( RedisConnRef $conn ) {
+               static $script =
+<<<LUA
+               local kUnclaimed, kSha1ById, kIdBySha1, kData = unpack(KEYS)
+               -- Pop an item off the queue
+               local id = redis.call('rpop',kUnclaimed)
+               if not id then return false end
+               -- Get the job data and remove it
+               local item = redis.call('hGet',kData,id)
+               redis.call('hDel',kData,id)
+               -- Allow new duplicates of this job
+               local sha1 = redis.call('hGet',kSha1ById,id)
+               if sha1 then redis.call('hDel',kIdBySha1,sha1) end
+               redis.call('hDel',kSha1ById,id)
+               -- Return the job data
+               return item
+LUA;
+               return $conn->luaEval( $script,
+                       array(
+                               $this->getQueueKey( 'l-unclaimed' ), # KEYS[1]
+                               $this->getQueueKey( 'h-sha1ById' ), # KEYS[2]
+                               $this->getQueueKey( 'h-idBySha1' ), # KEYS[3]
+                               $this->getQueueKey( 'h-data' ), # KEYS[4]
+                       ),
+                       4 # number of first argument(s) that are keys
+               );
+       }
+
+       /**
+        * @param RedisConnRef $conn
+        * @return array serialized string or false
+        * @throws RedisException
+        */
+       protected function popAndAcquireBlob( RedisConnRef $conn ) {
+               static $script =
+<<<LUA
+               local kUnclaimed, kSha1ById, kIdBySha1, kClaimed, kAttempts, kData = unpack(KEYS)
+               -- Pop an item off the queue
+               local id = redis.call('rPop',kUnclaimed)
+               if not id then return false end
+               -- Allow new duplicates of this job
+               local sha1 = redis.call('hGet',kSha1ById,id)
+               if sha1 then redis.call('hDel',kIdBySha1,sha1) end
+               redis.call('hDel',kSha1ById,id)
+               -- Mark the jobs as claimed and return it
+               redis.call('zAdd',kClaimed,ARGV[1],id)
+               redis.call('hIncrBy',kAttempts,id,1)
+               return redis.call('hGet',kData,id)
+LUA;
+               return $conn->luaEval( $script,
+                       array(
+                               $this->getQueueKey( 'l-unclaimed' ), # KEYS[1]
+                               $this->getQueueKey( 'h-sha1ById' ), # KEYS[2]
+                               $this->getQueueKey( 'h-idBySha1' ), # KEYS[3]
+                               $this->getQueueKey( 'z-claimed' ), # KEYS[4]
+                               $this->getQueueKey( 'h-attempts' ), # KEYS[5]
+                               $this->getQueueKey( 'h-data' ), # KEYS[6]
+                               time(), # ARGV[1] (injected to be replication-safe)
+                       ),
+                       6 # number of first argument(s) that are keys
+               );
+       }
+
+       /**
+        * @see JobQueue::doAck()
+        * @param Job $job
+        * @return Job|bool
+        * @throws MWException|JobQueueError
+        */
+       protected function doAck( Job $job ) {
+               if ( !isset( $job->metadata['uuid'] ) ) {
+                       throw new MWException( "Job of type '{$job->getType()}' has no UUID." );
+               }
+               if ( $this->claimTTL > 0 ) {
+                       $conn = $this->getConnection();
+                       try {
+                               static $script =
+<<<LUA
+                               local kClaimed, kAttempts, kData = unpack(KEYS)
+                               -- Unmark the job as claimed
+                               redis.call('zRem',kClaimed,ARGV[1])
+                               redis.call('hDel',kAttempts,ARGV[1])
+                               -- Delete the job data itself
+                               return redis.call('hDel',kData,ARGV[1])
+LUA;
+                               $res = $conn->luaEval( $script,
+                                       array(
+                                               $this->getQueueKey( 'z-claimed' ), # KEYS[1]
+                                               $this->getQueueKey( 'h-attempts' ), # KEYS[2]
+                                               $this->getQueueKey( 'h-data' ), # KEYS[3]
+                                               $job->metadata['uuid'] # ARGV[1]
+                                       ),
+                                       3 # number of first argument(s) that are keys
+                               );
+
+                               if ( !$res ) {
+                                       wfDebugLog( 'JobQueueRedis', "Could not acknowledge {$this->type} job." );
+
+                                       return false;
+                               }
+                       } catch ( RedisException $e ) {
+                               $this->throwRedisException( $conn, $e );
+                       }
+               }
+
+               return true;
+       }
+
+       /**
+        * @see JobQueue::doDeduplicateRootJob()
+        * @param Job $job
+        * @return bool
+        * @throws MWException|JobQueueError
+        */
+       protected function doDeduplicateRootJob( Job $job ) {
+               if ( !$job->hasRootJobParams() ) {
+                       throw new MWException( "Cannot register root job; missing parameters." );
+               }
+               $params = $job->getRootJobParams();
+
+               $key = $this->getRootJobCacheKey( $params['rootJobSignature'] );
+
+               $conn = $this->getConnection();
+               try {
+                       $timestamp = $conn->get( $key ); // current last timestamp of this job
+                       if ( $timestamp && $timestamp >= $params['rootJobTimestamp'] ) {
+                               return true; // a newer version of this root job was enqueued
+                       }
+
+                       // Update the timestamp of the last root job started at the location...
+                       return $conn->set( $key, $params['rootJobTimestamp'], self::ROOTJOB_TTL ); // 2 weeks
+               } catch ( RedisException $e ) {
+                       $this->throwRedisException( $conn, $e );
+               }
+       }
+
+       /**
+        * @see JobQueue::doIsRootJobOldDuplicate()
+        * @param Job $job
+        * @return bool
+        * @throws JobQueueError
+        */
+       protected function doIsRootJobOldDuplicate( Job $job ) {
+               if ( !$job->hasRootJobParams() ) {
+                       return false; // job has no de-deplication info
+               }
+               $params = $job->getRootJobParams();
+
+               $conn = $this->getConnection();
+               try {
+                       // Get the last time this root job was enqueued
+                       $timestamp = $conn->get( $this->getRootJobCacheKey( $params['rootJobSignature'] ) );
+               } catch ( RedisException $e ) {
+                       $this->throwRedisException( $conn, $e );
+               }
+
+               // Check if a new root job was started at the location after this one's...
+               return ( $timestamp && $timestamp > $params['rootJobTimestamp'] );
+       }
+
+       /**
+        * @see JobQueue::doDelete()
+        * @return bool
+        * @throws JobQueueError
+        */
+       protected function doDelete() {
+               static $props = array( 'l-unclaimed', 'z-claimed', 'z-abandoned',
+                       'z-delayed', 'h-idBySha1', 'h-sha1ById', 'h-attempts', 'h-data' );
+
+               $conn = $this->getConnection();
+               try {
+                       $keys = array();
+                       foreach ( $props as $prop ) {
+                               $keys[] = $this->getQueueKey( $prop );
+                       }
+
+                       return ( $conn->delete( $keys ) !== false );
+               } catch ( RedisException $e ) {
+                       $this->throwRedisException( $conn, $e );
+               }
+       }
+
+       /**
+        * @see JobQueue::getAllQueuedJobs()
+        * @return Iterator
+        */
+       public function getAllQueuedJobs() {
+               $conn = $this->getConnection();
+               try {
+                       $that = $this;
+
+                       return new MappedIterator(
+                               $conn->lRange( $this->getQueueKey( 'l-unclaimed' ), 0, -1 ),
+                               function ( $uid ) use ( $that, $conn ) {
+                                       return $that->getJobFromUidInternal( $uid, $conn );
+                               },
+                               array( 'accept' => function ( $job ) {
+                                       return is_object( $job );
+                               } )
+                       );
+               } catch ( RedisException $e ) {
+                       $this->throwRedisException( $conn, $e );
+               }
+       }
+
+       /**
+        * @see JobQueue::getAllQueuedJobs()
+        * @return Iterator
+        */
+       public function getAllDelayedJobs() {
+               $conn = $this->getConnection();
+               try {
+                       $that = $this;
+
+                       return new MappedIterator( // delayed jobs
+                               $conn->zRange( $this->getQueueKey( 'z-delayed' ), 0, -1 ),
+                               function ( $uid ) use ( $that, $conn ) {
+                                       return $that->getJobFromUidInternal( $uid, $conn );
+                               },
+                               array( 'accept' => function ( $job ) {
+                                       return is_object( $job );
+                               } )
+                       );
+               } catch ( RedisException $e ) {
+                       $this->throwRedisException( $conn, $e );
+               }
+       }
+
+       public function getCoalesceLocationInternal() {
+               return "RedisServer:" . $this->server;
+       }
+
+       protected function doGetSiblingQueuesWithJobs( array $types ) {
+               return array_keys( array_filter( $this->doGetSiblingQueueSizes( $types ) ) );
+       }
+
+       protected function doGetSiblingQueueSizes( array $types ) {
+               $sizes = array(); // (type => size)
+               $types = array_values( $types ); // reindex
+               $conn = $this->getConnection();
+               try {
+                       $conn->multi( Redis::PIPELINE );
+                       foreach ( $types as $type ) {
+                               $conn->lSize( $this->getQueueKey( 'l-unclaimed', $type ) );
+                       }
+                       $res = $conn->exec();
+                       if ( is_array( $res ) ) {
+                               foreach ( $res as $i => $size ) {
+                                       $sizes[$types[$i]] = $size;
+                               }
+                       }
+               } catch ( RedisException $e ) {
+                       $this->throwRedisException( $conn, $e );
+               }
+
+               return $sizes;
+       }
+
+       /**
+        * This function should not be called outside JobQueueRedis
+        *
+        * @param $uid string
+        * @param $conn RedisConnRef
+        * @return Job|bool Returns false if the job does not exist
+        * @throws MWException|JobQueueError
+        */
+       public function getJobFromUidInternal( $uid, RedisConnRef $conn ) {
+               try {
+                       $data = $conn->hGet( $this->getQueueKey( 'h-data' ), $uid );
+                       if ( $data === false ) {
+                               return false; // not found
+                       }
+                       $item = $this->unserialize( $conn->hGet( $this->getQueueKey( 'h-data' ), $uid ) );
+                       if ( !is_array( $item ) ) { // this shouldn't happen
+                               throw new MWException( "Could not find job with ID '$uid'." );
+                       }
+                       $title = Title::makeTitle( $item['namespace'], $item['title'] );
+                       $job = Job::factory( $item['type'], $title, $item['params'] );
+                       $job->metadata['uuid'] = $item['uuid'];
+
+                       return $job;
+               } catch ( RedisException $e ) {
+                       $this->throwRedisException( $conn, $e );
+               }
+       }
+
+       /**
+        * Recycle or destroy any jobs that have been claimed for too long
+        * and release any ready delayed jobs into the queue
+        *
+        * @return int Number of jobs recycled/deleted/undelayed
+        * @throws MWException|JobQueueError
+        */
+       public function recyclePruneAndUndelayJobs() {
+               $count = 0;
+               // For each job item that can be retried, we need to add it back to the
+               // main queue and remove it from the list of currenty claimed job items.
+               // For those that cannot, they are marked as dead and kept around for
+               // investigation and manual job restoration but are eventually deleted.
+               $conn = $this->getConnection();
+               try {
+                       $now = time();
+                       static $script =
+<<<LUA
+                       local kClaimed, kAttempts, kUnclaimed, kData, kAbandoned, kDelayed = unpack(KEYS)
+                       local released,abandoned,pruned,undelayed = 0,0,0,0
+                       -- Get all non-dead jobs that have an expired claim on them.
+                       -- The score for each item is the last claim timestamp (UNIX).
+                       local staleClaims = redis.call('zRangeByScore',kClaimed,0,ARGV[1])
+                       for k,id in ipairs(staleClaims) do
+                               local timestamp = redis.call('zScore',kClaimed,id)
+                               local attempts = redis.call('hGet',kAttempts,id)
+                               if attempts < ARGV[3] then
+                                       -- Claim expired and retries left: re-enqueue the job
+                                       redis.call('lPush',kUnclaimed,id)
+                                       redis.call('hIncrBy',kAttempts,id,1)
+                                       released = released + 1
+                               else
+                                       -- Claim expired and no retries left: mark the job as dead
+                                       redis.call('zAdd',kAbandoned,timestamp,id)
+                                       abandoned = abandoned + 1
+                               end
+                               redis.call('zRem',kClaimed,id)
+                       end
+                       -- Get all of the dead jobs that have been marked as dead for too long.
+                       -- The score for each item is the last claim timestamp (UNIX).
+                       local deadClaims = redis.call('zRangeByScore',kAbandoned,0,ARGV[2])
+                       for k,id in ipairs(deadClaims) do
+                               -- Stale and out of retries: remove any traces of the job
+                               redis.call('zRem',kAbandoned,id)
+                               redis.call('hDel',kAttempts,id)
+                               redis.call('hDel',kData,id)
+                               pruned = pruned + 1
+                       end
+                       -- Get the list of ready delayed jobs, sorted by readiness (UNIX timestamp)
+                       local ids = redis.call('zRangeByScore',kDelayed,0,ARGV[4])
+                       -- Migrate the jobs from the "delayed" set to the "unclaimed" list
+                       for k,id in ipairs(ids) do
+                               redis.call('lPush',kUnclaimed,id)
+                               redis.call('zRem',kDelayed,id)
+                       end
+                       undelayed = #ids
+                       return {released,abandoned,pruned,undelayed}
+LUA;
+                       $res = $conn->luaEval( $script,
+                               array(
+                                       $this->getQueueKey( 'z-claimed' ), # KEYS[1]
+                                       $this->getQueueKey( 'h-attempts' ), # KEYS[2]
+                                       $this->getQueueKey( 'l-unclaimed' ), # KEYS[3]
+                                       $this->getQueueKey( 'h-data' ), # KEYS[4]
+                                       $this->getQueueKey( 'z-abandoned' ), # KEYS[5]
+                                       $this->getQueueKey( 'z-delayed' ), # KEYS[6]
+                                       $now - $this->claimTTL, # ARGV[1]
+                                       $now - self::MAX_AGE_PRUNE, # ARGV[2]
+                                       $this->maxTries, # ARGV[3]
+                                       $now # ARGV[4]
+                               ),
+                               6 # number of first argument(s) that are keys
+                       );
+                       if ( $res ) {
+                               list( $released, $abandoned, $pruned, $undelayed ) = $res;
+                               $count += $released + $pruned + $undelayed;
+                               JobQueue::incrStats( 'job-recycle', $this->type, $released );
+                               JobQueue::incrStats( 'job-abandon', $this->type, $abandoned );
+                       }
+               } catch ( RedisException $e ) {
+                       $this->throwRedisException( $conn, $e );
+               }
+
+               return $count;
+       }
+
+       /**
+        * @return array
+        */
+       protected function doGetPeriodicTasks() {
+               $periods = array( 3600 ); // standard cleanup (useful on config change)
+               if ( $this->claimTTL > 0 ) {
+                       $periods[] = ceil( $this->claimTTL / 2 ); // avoid bad timing
+               }
+               if ( $this->checkDelay ) {
+                       $periods[] = 300; // 5 minutes
+               }
+               $period = min( $periods );
+               $period = max( $period, 30 ); // sanity
+               // Support override for faster testing
+               if ( $this->maximumPeriodicTaskSeconds !== null ) {
+                       $period = min( $period, $this->maximumPeriodicTaskSeconds );
+               }
+               return array(
+                       'recyclePruneAndUndelayJobs' => array(
+                               'callback' => array( $this, 'recyclePruneAndUndelayJobs' ),
+                               'period'   => $period,
+                       )
+               );
+       }
+
+       /**
+        * @param IJobSpecification $job
+        * @return array
+        */
+       protected function getNewJobFields( IJobSpecification $job ) {
+               return array(
+                       // Fields that describe the nature of the job
+                       'type' => $job->getType(),
+                       'namespace' => $job->getTitle()->getNamespace(),
+                       'title' => $job->getTitle()->getDBkey(),
+                       'params' => $job->getParams(),
+                       // Some jobs cannot run until a "release timestamp"
+                       'rtimestamp' => $job->getReleaseTimestamp() ?: 0,
+                       // Additional job metadata
+                       'uuid' => UIDGenerator::newRawUUIDv4( UIDGenerator::QUICK_RAND ),
+                       'sha1' => $job->ignoreDuplicates()
+                               ? wfBaseConvert( sha1( serialize( $job->getDeduplicationInfo() ) ), 16, 36, 31 )
+                               : '',
+                       'timestamp' => time() // UNIX timestamp
+               );
+       }
+
+       /**
+        * @param $fields array
+        * @return Job|bool
+        */
+       protected function getJobFromFields( array $fields ) {
+               $title = Title::makeTitleSafe( $fields['namespace'], $fields['title'] );
+               if ( $title ) {
+                       $job = Job::factory( $fields['type'], $title, $fields['params'] );
+                       $job->metadata['uuid'] = $fields['uuid'];
+
+                       return $job;
+               }
+
+               return false;
+       }
+
+       /**
+        * @param array $fields
+        * @return string Serialized and possibly compressed version of $fields
+        */
+       protected function serialize( array $fields ) {
+               $blob = serialize( $fields );
+               if ( $this->compression === 'gzip'
+                       && strlen( $blob ) >= 1024
+                       && function_exists( 'gzdeflate' )
+               ) {
+                       $object = (object)array( 'blob' => gzdeflate( $blob ), 'enc' => 'gzip' );
+                       $blobz = serialize( $object );
+
+                       return ( strlen( $blobz ) < strlen( $blob ) ) ? $blobz : $blob;
+               } else {
+                       return $blob;
+               }
+       }
+
+       /**
+        * @param string $blob
+        * @return array|bool Unserialized version of $blob or false
+        */
+       protected function unserialize( $blob ) {
+               $fields = unserialize( $blob );
+               if ( is_object( $fields ) ) {
+                       if ( $fields->enc === 'gzip' && function_exists( 'gzinflate' ) ) {
+                               $fields = unserialize( gzinflate( $fields->blob ) );
+                       } else {
+                               $fields = false;
+                       }
+               }
+
+               return is_array( $fields ) ? $fields : false;
+       }
+
+       /**
+        * Get a connection to the server that handles all sub-queues for this queue
+        *
+        * @return RedisConnRef
+        * @throws JobQueueConnectionError
+        */
+       protected function getConnection() {
+               $conn = $this->redisPool->getConnection( $this->server );
+               if ( !$conn ) {
+                       throw new JobQueueConnectionError( "Unable to connect to redis server." );
+               }
+
+               return $conn;
+       }
+
+       /**
+        * @param $conn RedisConnRef
+        * @param $e RedisException
+        * @throws JobQueueError
+        */
+       protected function throwRedisException( RedisConnRef $conn, $e ) {
+               $this->redisPool->handleError( $conn, $e );
+               throw new JobQueueError( "Redis server error: {$e->getMessage()}\n" );
+       }
+
+       /**
+        * @param $prop string
+        * @param $type string|null
+        * @return string
+        */
+       private function getQueueKey( $prop, $type = null ) {
+               $type = is_string( $type ) ? $type : $this->type;
+               list( $db, $prefix ) = wfSplitWikiID( $this->wiki );
+               if ( strlen( $this->key ) ) { // namespaced queue (for testing)
+                       return wfForeignMemcKey( $db, $prefix, 'jobqueue', $type, $this->key, $prop );
+               } else {
+                       return wfForeignMemcKey( $db, $prefix, 'jobqueue', $type, $prop );
+               }
+       }
+
+       /**
+        * @param $key string
+        * @return void
+        */
+       public function setTestingPrefix( $key ) {
+               $this->key = $key;
+       }
+}
diff --git a/includes/jobqueue/JobSpecification.php b/includes/jobqueue/JobSpecification.php
new file mode 100644 (file)
index 0000000..e074e5c
--- /dev/null
@@ -0,0 +1,189 @@
+<?php
+/**
+ * Job queue task description base code.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup JobQueue
+ */
+
+/**
+ * Job queue task description interface
+ *
+ * @ingroup JobQueue
+ * @since 1.23
+ */
+interface IJobSpecification {
+       /**
+        * @return string Job type
+        */
+       public function getType();
+
+       /**
+        * @return array
+        */
+       public function getParams();
+
+       /**
+        * @return int|null UNIX timestamp to delay running this job until, otherwise null
+        */
+       public function getReleaseTimestamp();
+
+       /**
+        * @return bool Whether only one of each identical set of jobs should be run
+        */
+       public function ignoreDuplicates();
+
+       /**
+        * Subclasses may need to override this to make duplication detection work.
+        * The resulting map conveys everything that makes the job unique. This is
+        * only checked if ignoreDuplicates() returns true, meaning that duplicate
+        * jobs are supposed to be ignored.
+        *
+        * @return array Map of key/values
+        */
+       public function getDeduplicationInfo();
+
+       /**
+        * @return Title Descriptive title (this can simply be informative)
+        */
+       public function getTitle();
+}
+
+/**
+ * Job queue task description base code
+ *
+ * Example usage:
+ * <code>
+ * $job = new JobSpecification(
+ *             'null',
+ *             array( 'lives' => 1, 'usleep' => 100, 'pi' => 3.141569 ),
+ *             array( 'removeDuplicates' => 1 ),
+ *             Title::makeTitle( NS_SPECIAL, 'nullity' )
+ * );
+ * JobQueueGroup::singleton()->push( $job )
+ * </code>
+ *
+ * @ingroup JobQueue
+ * @since 1.23
+ */
+class JobSpecification implements IJobSpecification {
+       /** @var string */
+       protected $type;
+
+       /** @var array Array of job parameters or false if none */
+       protected $params;
+
+       /** @var Title */
+       protected $title;
+
+       /** @var bool Expensive jobs may set this to true */
+       protected $ignoreDuplicates;
+
+       /**
+        * @param string $type
+        * @param array $params Map of key/values
+        * @param array $opts Map of key/values
+        * @param Title $title Optional descriptive title
+        */
+       public function __construct(
+               $type, array $params, array $opts = array(), Title $title = null
+       ) {
+               $this->validateParams( $params );
+
+               $this->type = $type;
+               $this->params = $params;
+               $this->title = $title ?: Title::newMainPage();
+               $this->ignoreDuplicates = !empty( $opts['removeDuplicates'] );
+       }
+
+       /**
+        * @param array $params
+        */
+       protected function validateParams( array $params ) {
+               foreach ( $params as $p => $v ) {
+                       if ( is_array( $v ) ) {
+                               $this->validateParams( $v );
+                       } elseif ( !is_scalar( $v ) && $v !== null ) {
+                               throw new UnexpectedValueException( 'Job parameters are not JSON serializable.' );
+                       }
+               }
+       }
+
+       /**
+        * @return string
+        */
+       public function getType() {
+               return $this->type;
+       }
+
+       /**
+        * @return Title
+        */
+       public function getTitle() {
+               return $this->title;
+       }
+
+       /**
+        * @return array
+        */
+       public function getParams() {
+               return $this->params;
+       }
+
+       /**
+        * @return int|null UNIX timestamp to delay running this job until, otherwise null
+        */
+       public function getReleaseTimestamp() {
+               return isset( $this->params['jobReleaseTimestamp'] )
+                       ? wfTimestampOrNull( TS_UNIX, $this->params['jobReleaseTimestamp'] )
+                       : null;
+       }
+
+       /**
+        * @return bool Whether only one of each identical set of jobs should be run
+        */
+       public function ignoreDuplicates() {
+               return $this->ignoreDuplicates;
+       }
+
+       /**
+        * Subclasses may need to override this to make duplication detection work.
+        * The resulting map conveys everything that makes the job unique. This is
+        * only checked if ignoreDuplicates() returns true, meaning that duplicate
+        * jobs are supposed to be ignored.
+        *
+        * @return array Map of key/values
+        */
+       public function getDeduplicationInfo() {
+               $info = array(
+                       'type' => $this->getType(),
+                       'namespace' => $this->getTitle()->getNamespace(),
+                       'title' => $this->getTitle()->getDBkey(),
+                       'params' => $this->getParams()
+               );
+               if ( is_array( $info['params'] ) ) {
+                       // Identical jobs with different "root" jobs should count as duplicates
+                       unset( $info['params']['rootJobSignature'] );
+                       unset( $info['params']['rootJobTimestamp'] );
+                       // Likewise for jobs with different delay times
+                       unset( $info['params']['jobReleaseTimestamp'] );
+               }
+
+               return $info;
+       }
+}
diff --git a/includes/jobqueue/README b/includes/jobqueue/README
new file mode 100644 (file)
index 0000000..c11d5a7
--- /dev/null
@@ -0,0 +1,81 @@
+/*!
+\ingroup JobQueue
+\page jobqueue_design Job queue design
+
+Notes on the Job queuing system architecture.
+
+\section intro Introduction
+
+The data model consist of the following main components:
+* The Job object represents a particular deferred task that happens in the
+  background. All jobs subclass the Job object and put the main logic in the
+  function called run().
+* The JobQueue object represents a particular queue of jobs of a certain type.
+  For example there may be a queue for email jobs and a queue for squid purge
+  jobs.
+
+\section jobqueue Job queues
+
+Each job type has its own queue and is associated to a storage medium. One
+queue might save its jobs in redis while another one uses would use a database.
+
+Storage medium are defined in a queue class. Before using it, you must
+define in $wgJobTypeConf a mapping of the job type to a queue class.
+
+The factory class JobQueueGroup provides helper functions:
+- getting the queue for a given job
+- route new job insertions to the proper queue
+
+The following queue classes are available:
+* JobQueueDB (stores jobs in the `job` table in a database)
+* JobQueueRedis (stores jobs in a redis server)
+
+All queue classes support some basic operations (though some may be no-ops):
+* enqueueing a batch of jobs
+* dequeueing a single job
+* acknowledging a job is completed
+* checking if the queue is empty
+
+Some queue classes (like JobQueueDB) may dequeue jobs in random order while other
+queues might dequeue jobs in exact FIFO order. Callers should thus not assume jobs
+are executed in FIFO order.
+
+Also note that not all queue classes will have the same reliability guarantees.
+In-memory queues may lose data when restarted depending on snapshot and journal
+settings (including journal fsync() frequency).  Some queue types may totally remove
+jobs when dequeued while leaving the ack() function as a no-op; if a job is
+dequeued by a job runner, which crashes before completion, the job will be
+lost. Some jobs, like purging squid caches after a template change, may not
+require durable queues, whereas other jobs might be more important.
+
+\section aggregator Job queue aggregator
+
+The aggregators are used by nextJobDB.php, which is a script that will return a
+random ready queue (on any wiki in the farm) that can be used with runJobs.php.
+This can be used in conjunction with any scripts that handle wiki farm job queues.
+Note that $wgLocalDatabases defines what wikis are in the wiki farm.
+
+Since each job type has its own queue, and wiki-farms may have many wikis,
+there might be a large number of queues to keep track of. To avoid wasting
+large amounts of time polling empty queues, aggregators exists to keep track
+of which queues are ready.
+
+The following queue aggregator classes are available:
+* JobQueueAggregatorMemc (uses $wgMemc to track ready queues)
+* JobQueueAggregatorRedis (uses a redis server to track ready queues)
+
+Some aggregators cache data for a few minutes while others may be always up to date.
+This can be an important factor for jobs that need a low pickup time (or latency).
+
+\section jobs Jobs
+
+Callers should also try to make jobs maintain correctness when executed twice.
+This is useful for queues that actually implement ack(), since they may recycle
+dequeued but un-acknowledged jobs back into the queue to be attempted again. If
+a runner dequeues a job, runs it, but then crashes before calling ack(), the
+job may be returned to the queue and run a second time. Jobs like cache purging can
+happen several times without any correctness problems. However, a pathological case
+would be if a bug causes the problem to systematically keep repeating. For example,
+a job may always throw a DB error at the end of run(). This problem is trickier to
+solve and more obnoxious for things like email jobs, for example. For such jobs,
+it might be useful to use a queue that does not retry jobs.
diff --git a/includes/jobqueue/aggregator/JobQueueAggregator.php b/includes/jobqueue/aggregator/JobQueueAggregator.php
new file mode 100644 (file)
index 0000000..8600eed
--- /dev/null
@@ -0,0 +1,162 @@
+<?php
+/**
+ * Job queue aggregator code.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @author Aaron Schulz
+ */
+
+/**
+ * Class to handle tracking information about all queues
+ *
+ * @ingroup JobQueue
+ * @since 1.21
+ */
+abstract class JobQueueAggregator {
+       /** @var JobQueueAggregator */
+       protected static $instance = null;
+
+       /**
+        * @param array $params
+        */
+       protected function __construct( array $params ) {
+       }
+
+       /**
+        * @throws MWException
+        * @return JobQueueAggregator
+        */
+       final public static function singleton() {
+               global $wgJobQueueAggregator;
+
+               if ( !isset( self::$instance ) ) {
+                       $class = $wgJobQueueAggregator['class'];
+                       $obj = new $class( $wgJobQueueAggregator );
+                       if ( !( $obj instanceof JobQueueAggregator ) ) {
+                               throw new MWException( "Class '$class' is not a JobQueueAggregator class." );
+                       }
+                       self::$instance = $obj;
+               }
+
+               return self::$instance;
+       }
+
+       /**
+        * Destroy the singleton instance
+        *
+        * @return void
+        */
+       final public static function destroySingleton() {
+               self::$instance = null;
+       }
+
+       /**
+        * Mark a queue as being empty
+        *
+        * @param string $wiki
+        * @param string $type
+        * @return bool Success
+        */
+       final public function notifyQueueEmpty( $wiki, $type ) {
+               wfProfileIn( __METHOD__ );
+               $ok = $this->doNotifyQueueEmpty( $wiki, $type );
+               wfProfileOut( __METHOD__ );
+
+               return $ok;
+       }
+
+       /**
+        * @see JobQueueAggregator::notifyQueueEmpty()
+        */
+       abstract protected function doNotifyQueueEmpty( $wiki, $type );
+
+       /**
+        * Mark a queue as being non-empty
+        *
+        * @param string $wiki
+        * @param string $type
+        * @return bool Success
+        */
+       final public function notifyQueueNonEmpty( $wiki, $type ) {
+               wfProfileIn( __METHOD__ );
+               $ok = $this->doNotifyQueueNonEmpty( $wiki, $type );
+               wfProfileOut( __METHOD__ );
+
+               return $ok;
+       }
+
+       /**
+        * @see JobQueueAggregator::notifyQueueNonEmpty()
+        */
+       abstract protected function doNotifyQueueNonEmpty( $wiki, $type );
+
+       /**
+        * Get the list of all of the queues with jobs
+        *
+        * @return array (job type => (list of wiki IDs))
+        */
+       final public function getAllReadyWikiQueues() {
+               wfProfileIn( __METHOD__ );
+               $res = $this->doGetAllReadyWikiQueues();
+               wfProfileOut( __METHOD__ );
+
+               return $res;
+       }
+
+       /**
+        * @see JobQueueAggregator::getAllReadyWikiQueues()
+        */
+       abstract protected function doGetAllReadyWikiQueues();
+
+       /**
+        * Purge all of the aggregator information
+        *
+        * @return bool Success
+        */
+       final public function purge() {
+               wfProfileIn( __METHOD__ );
+               $res = $this->doPurge();
+               wfProfileOut( __METHOD__ );
+
+               return $res;
+       }
+
+       /**
+        * @see JobQueueAggregator::purge()
+        */
+       abstract protected function doPurge();
+
+       /**
+        * Get all databases that have a pending job.
+        * This poll all the queues and is this expensive.
+        *
+        * @return array (job type => (list of wiki IDs))
+        */
+       protected function findPendingWikiQueues() {
+               global $wgLocalDatabases;
+
+               $pendingDBs = array(); // (job type => (db list))
+               foreach ( $wgLocalDatabases as $db ) {
+                       foreach ( JobQueueGroup::singleton( $db )->getQueuesWithJobs() as $type ) {
+                               $pendingDBs[$type][] = $db;
+                       }
+               }
+
+               return $pendingDBs;
+       }
+}
diff --git a/includes/jobqueue/aggregator/JobQueueAggregatorMemc.php b/includes/jobqueue/aggregator/JobQueueAggregatorMemc.php
new file mode 100644 (file)
index 0000000..d733a42
--- /dev/null
@@ -0,0 +1,126 @@
+<?php
+/**
+ * Job queue aggregator code that uses BagOStuff.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @author Aaron Schulz
+ */
+
+/**
+ * Class to handle tracking information about all queues using BagOStuff
+ *
+ * @ingroup JobQueue
+ * @since 1.21
+ */
+class JobQueueAggregatorMemc extends JobQueueAggregator {
+       /** @var BagOStuff */
+       protected $cache;
+
+       protected $cacheTTL; // integer; seconds
+
+       /**
+        * @params include:
+        *   - objectCache : Name of an object cache registered in $wgObjectCaches.
+        *                   This defaults to the one specified by $wgMainCacheType.
+        *   - cacheTTL    : Seconds to cache the aggregate data before regenerating.
+        * @param array $params
+        */
+       protected function __construct( array $params ) {
+               parent::__construct( $params );
+               $this->cache = isset( $params['objectCache'] )
+                       ? wfGetCache( $params['objectCache'] )
+                       : wfGetMainCache();
+               $this->cacheTTL = isset( $params['cacheTTL'] ) ? $params['cacheTTL'] : 180; // 3 min
+       }
+
+       /**
+        * @see JobQueueAggregator::doNotifyQueueEmpty()
+        */
+       protected function doNotifyQueueEmpty( $wiki, $type ) {
+               $key = $this->getReadyQueueCacheKey();
+               // Delist the queue from the "ready queue" list
+               if ( $this->cache->add( "$key:lock", 1, 60 ) ) { // lock
+                       $curInfo = $this->cache->get( $key );
+                       if ( is_array( $curInfo ) && isset( $curInfo['pendingDBs'][$type] ) ) {
+                               if ( in_array( $wiki, $curInfo['pendingDBs'][$type] ) ) {
+                                       $curInfo['pendingDBs'][$type] = array_diff(
+                                               $curInfo['pendingDBs'][$type], array( $wiki ) );
+                                       $this->cache->set( $key, $curInfo );
+                               }
+                       }
+                       $this->cache->delete( "$key:lock" ); // unlock
+               }
+
+               return true;
+       }
+
+       /**
+        * @see JobQueueAggregator::doNotifyQueueNonEmpty()
+        */
+       protected function doNotifyQueueNonEmpty( $wiki, $type ) {
+               return true; // updated periodically
+       }
+
+       /**
+        * @see JobQueueAggregator::doAllGetReadyWikiQueues()
+        */
+       protected function doGetAllReadyWikiQueues() {
+               $key = $this->getReadyQueueCacheKey();
+               // If the cache entry wasn't present, is stale, or in .1% of cases otherwise,
+               // regenerate the cache. Use any available stale cache if another process is
+               // currently regenerating the pending DB information.
+               $pendingDbInfo = $this->cache->get( $key );
+               if ( !is_array( $pendingDbInfo )
+                       || ( time() - $pendingDbInfo['timestamp'] ) > $this->cacheTTL
+                       || mt_rand( 0, 999 ) == 0
+               ) {
+                       if ( $this->cache->add( "$key:rebuild", 1, 1800 ) ) { // lock
+                               $pendingDbInfo = array(
+                                       'pendingDBs' => $this->findPendingWikiQueues(),
+                                       'timestamp' => time()
+                               );
+                               for ( $attempts = 1; $attempts <= 25; ++$attempts ) {
+                                       if ( $this->cache->add( "$key:lock", 1, 60 ) ) { // lock
+                                               $this->cache->set( $key, $pendingDbInfo );
+                                               $this->cache->delete( "$key:lock" ); // unlock
+                                               break;
+                                       }
+                               }
+                               $this->cache->delete( "$key:rebuild" ); // unlock
+                       }
+               }
+
+               return is_array( $pendingDbInfo )
+                       ? $pendingDbInfo['pendingDBs']
+                       : array(); // cache is both empty and locked
+       }
+
+       /**
+        * @see JobQueueAggregator::doPurge()
+        */
+       protected function doPurge() {
+               return $this->cache->delete( $this->getReadyQueueCacheKey() );
+       }
+
+       /**
+        * @return string
+        */
+       private function getReadyQueueCacheKey() {
+               return "jobqueue:aggregator:ready-queues:v1"; // global
+       }
+}
diff --git a/includes/jobqueue/aggregator/JobQueueAggregatorRedis.php b/includes/jobqueue/aggregator/JobQueueAggregatorRedis.php
new file mode 100644 (file)
index 0000000..2aec3c9
--- /dev/null
@@ -0,0 +1,206 @@
+<?php
+/**
+ * Job queue aggregator code that uses PhpRedis.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @author Aaron Schulz
+ */
+
+/**
+ * Class to handle tracking information about all queues using PhpRedis
+ *
+ * @ingroup JobQueue
+ * @ingroup Redis
+ * @since 1.21
+ */
+class JobQueueAggregatorRedis extends JobQueueAggregator {
+       /** @var RedisConnectionPool */
+       protected $redisPool;
+
+       /** @var array List of Redis server addresses */
+       protected $servers;
+
+       /**
+        * @params include:
+        *   - redisConfig  : An array of parameters to RedisConnectionPool::__construct().
+        *   - redisServers : Array of server entries, the first being the primary and the
+        *                    others being fallback servers. Each entry is either a hostname/port
+        *                    combination or the absolute path of a UNIX socket.
+        *                    If a hostname is specified but no port, the standard port number
+        *                    6379 will be used. Required.
+        * @param array $params
+        */
+       protected function __construct( array $params ) {
+               parent::__construct( $params );
+               $this->servers = isset( $params['redisServers'] )
+                       ? $params['redisServers']
+                       : array( $params['redisServer'] ); // b/c
+               $this->redisPool = RedisConnectionPool::singleton( $params['redisConfig'] );
+       }
+
+       protected function doNotifyQueueEmpty( $wiki, $type ) {
+               $conn = $this->getConnection();
+               if ( !$conn ) {
+                       return false;
+               }
+               try {
+                       $conn->hDel( $this->getReadyQueueKey(), $this->encQueueName( $type, $wiki ) );
+
+                       return true;
+               } catch ( RedisException $e ) {
+                       $this->handleException( $conn, $e );
+
+                       return false;
+               }
+       }
+
+       protected function doNotifyQueueNonEmpty( $wiki, $type ) {
+               $conn = $this->getConnection();
+               if ( !$conn ) {
+                       return false;
+               }
+               try {
+                       $conn->hSet( $this->getReadyQueueKey(), $this->encQueueName( $type, $wiki ), time() );
+
+                       return true;
+               } catch ( RedisException $e ) {
+                       $this->handleException( $conn, $e );
+
+                       return false;
+               }
+       }
+
+       protected function doGetAllReadyWikiQueues() {
+               $conn = $this->getConnection();
+               if ( !$conn ) {
+                       return array();
+               }
+               try {
+                       $conn->multi( Redis::PIPELINE );
+                       $conn->exists( $this->getReadyQueueKey() );
+                       $conn->hGetAll( $this->getReadyQueueKey() );
+                       list( $exists, $map ) = $conn->exec();
+
+                       if ( $exists ) { // cache hit
+                               $pendingDBs = array(); // (type => list of wikis)
+                               foreach ( $map as $key => $time ) {
+                                       list( $type, $wiki ) = $this->dencQueueName( $key );
+                                       $pendingDBs[$type][] = $wiki;
+                               }
+                       } else { // cache miss
+                               // Avoid duplicated effort
+                               $rand = wfRandomString( 32 );
+                               $conn->multi( Redis::MULTI );
+                               $conn->setex( "{$rand}:lock", 3600, 1 );
+                               $conn->renamenx( "{$rand}:lock", $this->getReadyQueueKey() . ":lock" );
+                               if ( $conn->exec() !== array( true, true ) ) { // lock
+                                       $conn->delete( "{$rand}:lock" );
+                                       return array(); // already in progress
+                               }
+
+                               $pendingDBs = $this->findPendingWikiQueues(); // (type => list of wikis)
+
+                               $conn->delete( $this->getReadyQueueKey() . ":lock" ); // unlock
+
+                               $now = time();
+                               $map = array();
+                               foreach ( $pendingDBs as $type => $wikis ) {
+                                       foreach ( $wikis as $wiki ) {
+                                               $map[$this->encQueueName( $type, $wiki )] = $now;
+                                       }
+                               }
+                               $conn->hMSet( $this->getReadyQueueKey(), $map );
+                       }
+
+                       return $pendingDBs;
+               } catch ( RedisException $e ) {
+                       $this->handleException( $conn, $e );
+
+                       return array();
+               }
+       }
+
+       protected function doPurge() {
+               $conn = $this->getConnection();
+               if ( !$conn ) {
+                       return false;
+               }
+               try {
+                       $conn->delete( $this->getReadyQueueKey() );
+               } catch ( RedisException $e ) {
+                       $this->handleException( $conn, $e );
+
+                       return false;
+               }
+
+               return true;
+       }
+
+       /**
+        * Get a connection to the server that handles all sub-queues for this queue
+        *
+        * @return RedisConnRef|bool Returns false on failure
+        * @throws MWException
+        */
+       protected function getConnection() {
+               $conn = false;
+               foreach ( $this->servers as $server ) {
+                       $conn = $this->redisPool->getConnection( $server );
+                       if ( $conn ) {
+                               break;
+                       }
+               }
+
+               return $conn;
+       }
+
+       /**
+        * @param RedisConnRef $conn
+        * @param RedisException $e
+        * @return void
+        */
+       protected function handleException( RedisConnRef $conn, $e ) {
+               $this->redisPool->handleError( $conn, $e );
+       }
+
+       /**
+        * @return string
+        */
+       private function getReadyQueueKey() {
+               return "jobqueue:aggregator:h-ready-queues:v1"; // global
+       }
+
+       /**
+        * @param string $type
+        * @param string $wiki
+        * @return string
+        */
+       private function encQueueName( $type, $wiki ) {
+               return rawurlencode( $type ) . '/' . rawurlencode( $wiki );
+       }
+
+       /**
+        * @param string $name
+        * @return string
+        */
+       private function dencQueueName( $name ) {
+               list( $type, $wiki ) = explode( '/', $name, 2 );
+
+               return array( rawurldecode( $type ), rawurldecode( $wiki ) );
+       }
+}
diff --git a/includes/jobqueue/jobs/AssembleUploadChunksJob.php b/includes/jobqueue/jobs/AssembleUploadChunksJob.php
new file mode 100644 (file)
index 0000000..19b0558
--- /dev/null
@@ -0,0 +1,134 @@
+<?php
+/**
+ * Assemble the segments of a chunked upload.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Upload
+ */
+
+/**
+ * Assemble the segments of a chunked upload.
+ *
+ * @ingroup Upload
+ */
+class AssembleUploadChunksJob extends Job {
+       public function __construct( $title, $params ) {
+               parent::__construct( 'AssembleUploadChunks', $title, $params );
+               $this->removeDuplicates = true;
+       }
+
+       public function run() {
+               $scope = RequestContext::importScopedSession( $this->params['session'] );
+               $context = RequestContext::getMain();
+               try {
+                       $user = $context->getUser();
+                       if ( !$user->isLoggedIn() ) {
+                               $this->setLastError( "Could not load the author user from session." );
+
+                               return false;
+                       }
+
+                       if ( count( $_SESSION ) === 0 ) {
+                               // Empty session probably indicates that we didn't associate
+                               // with the session correctly. Note that being able to load
+                               // the user does not necessarily mean the session was loaded.
+                               // Most likely cause by suhosin.session.encrypt = On.
+                               $this->setLastError( "Error associating with user session. " .
+                                       "Try setting suhosin.session.encrypt = Off" );
+
+                               return false;
+                       }
+
+                       UploadBase::setSessionStatus(
+                               $this->params['filekey'],
+                               array( 'result' => 'Poll', 'stage' => 'assembling', 'status' => Status::newGood() )
+                       );
+
+                       $upload = new UploadFromChunks( $user );
+                       $upload->continueChunks(
+                               $this->params['filename'],
+                               $this->params['filekey'],
+                               $context->getRequest()
+                       );
+
+                       // Combine all of the chunks into a local file and upload that to a new stash file
+                       $status = $upload->concatenateChunks();
+                       if ( !$status->isGood() ) {
+                               UploadBase::setSessionStatus(
+                                       $this->params['filekey'],
+                                       array( 'result' => 'Failure', 'stage' => 'assembling', 'status' => $status )
+                               );
+                               $this->setLastError( $status->getWikiText() );
+
+                               return false;
+                       }
+
+                       // We have a new filekey for the fully concatenated file
+                       $newFileKey = $upload->getLocalFile()->getFileKey();
+
+                       // Remove the old stash file row and first chunk file
+                       $upload->stash->removeFileNoAuth( $this->params['filekey'] );
+
+                       // Build the image info array while we have the local reference handy
+                       $apiMain = new ApiMain(); // dummy object (XXX)
+                       $imageInfo = $upload->getImageInfo( $apiMain->getResult() );
+
+                       // Cleanup any temporary local file
+                       $upload->cleanupTempFile();
+
+                       // Cache the info so the user doesn't have to wait forever to get the final info
+                       UploadBase::setSessionStatus(
+                               $this->params['filekey'],
+                               array(
+                                       'result' => 'Success',
+                                       'stage' => 'assembling',
+                                       'filekey' => $newFileKey,
+                                       'imageinfo' => $imageInfo,
+                                       'status' => Status::newGood()
+                               )
+                       );
+               } catch ( MWException $e ) {
+                       UploadBase::setSessionStatus(
+                               $this->params['filekey'],
+                               array(
+                                       'result' => 'Failure',
+                                       'stage' => 'assembling',
+                                       'status' => Status::newFatal( 'api-error-stashfailed' )
+                               )
+                       );
+                       $this->setLastError( get_class( $e ) . ": " . $e->getText() );
+
+                       return false;
+               }
+
+               return true;
+       }
+
+       public function getDeduplicationInfo() {
+               $info = parent::getDeduplicationInfo();
+               if ( is_array( $info['params'] ) ) {
+                       $info['params'] = array( 'filekey' => $info['params']['filekey'] );
+               }
+
+               return $info;
+       }
+
+       public function allowRetries() {
+               return false;
+       }
+}
diff --git a/includes/jobqueue/jobs/DoubleRedirectJob.php b/includes/jobqueue/jobs/DoubleRedirectJob.php
new file mode 100644 (file)
index 0000000..94b56ef
--- /dev/null
@@ -0,0 +1,251 @@
+<?php
+/**
+ * Job to fix double redirects after moving a page.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup JobQueue
+ */
+
+/**
+ * Job to fix double redirects after moving a page
+ *
+ * @ingroup JobQueue
+ */
+class DoubleRedirectJob extends Job {
+       /** @var string Reason for the change, 'maintenance' or 'move'. Suffix fo
+        *    message key 'double-redirect-fixed-'.
+        */
+       private $reason;
+
+       /** @var Title The title which has changed, redirects pointing to this
+        *    title are fixed
+        */
+       private $redirTitle;
+
+       /** @var User */
+       private static $user;
+
+       /**
+        * Insert jobs into the job queue to fix redirects to the given title
+        * @param string $reason the reason for the fix, see message
+        *   "double-redirect-fixed-<reason>"
+        * @param $redirTitle Title: the title which has changed, redirects
+        *   pointing to this title are fixed
+        * @param bool $destTitle Not used
+        */
+       public static function fixRedirects( $reason, $redirTitle, $destTitle = false ) {
+               # Need to use the master to get the redirect table updated in the same transaction
+               $dbw = wfGetDB( DB_MASTER );
+               $res = $dbw->select(
+                       array( 'redirect', 'page' ),
+                       array( 'page_namespace', 'page_title' ),
+                       array(
+                               'page_id = rd_from',
+                               'rd_namespace' => $redirTitle->getNamespace(),
+                               'rd_title' => $redirTitle->getDBkey()
+                       ), __METHOD__ );
+               if ( !$res->numRows() ) {
+                       return;
+               }
+               $jobs = array();
+               foreach ( $res as $row ) {
+                       $title = Title::makeTitle( $row->page_namespace, $row->page_title );
+                       if ( !$title ) {
+                               continue;
+                       }
+
+                       $jobs[] = new self( $title, array(
+                               'reason' => $reason,
+                               'redirTitle' => $redirTitle->getPrefixedDBkey() ) );
+                       # Avoid excessive memory usage
+                       if ( count( $jobs ) > 10000 ) {
+                               JobQueueGroup::singleton()->push( $jobs );
+                               $jobs = array();
+                       }
+               }
+               JobQueueGroup::singleton()->push( $jobs );
+       }
+
+       /**
+        * @param Title $title
+        * @param array|bool $params
+        * @param int $id
+        */
+       function __construct( $title, $params = false ) {
+               parent::__construct( 'fixDoubleRedirect', $title, $params );
+               $this->reason = $params['reason'];
+               $this->redirTitle = Title::newFromText( $params['redirTitle'] );
+       }
+
+       /**
+        * @return bool
+        */
+       function run() {
+               if ( !$this->redirTitle ) {
+                       $this->setLastError( 'Invalid title' );
+
+                       return false;
+               }
+
+               $targetRev = Revision::newFromTitle( $this->title, false, Revision::READ_LATEST );
+               if ( !$targetRev ) {
+                       wfDebug( __METHOD__ . ": target redirect already deleted, ignoring\n" );
+
+                       return true;
+               }
+               $content = $targetRev->getContent();
+               $currentDest = $content ? $content->getRedirectTarget() : null;
+               if ( !$currentDest || !$currentDest->equals( $this->redirTitle ) ) {
+                       wfDebug( __METHOD__ . ": Redirect has changed since the job was queued\n" );
+
+                       return true;
+               }
+
+               // Check for a suppression tag (used e.g. in periodically archived discussions)
+               $mw = MagicWord::get( 'staticredirect' );
+               if ( $content->matchMagicWord( $mw ) ) {
+                       wfDebug( __METHOD__ . ": skipping: suppressed with __STATICREDIRECT__\n" );
+
+                       return true;
+               }
+
+               // Find the current final destination
+               $newTitle = self::getFinalDestination( $this->redirTitle );
+               if ( !$newTitle ) {
+                       wfDebug( __METHOD__ .
+                               ": skipping: single redirect, circular redirect or invalid redirect destination\n" );
+
+                       return true;
+               }
+               if ( $newTitle->equals( $this->redirTitle ) ) {
+                       // The redirect is already right, no need to change it
+                       // This can happen if the page was moved back (say after vandalism)
+                       wfDebug( __METHOD__ . " : skipping, already good\n" );
+               }
+
+               // Preserve fragment (bug 14904)
+               $newTitle = Title::makeTitle( $newTitle->getNamespace(), $newTitle->getDBkey(),
+                       $currentDest->getFragment(), $newTitle->getInterwiki() );
+
+               // Fix the text
+               $newContent = $content->updateRedirect( $newTitle );
+
+               if ( $newContent->equals( $content ) ) {
+                       $this->setLastError( 'Content unchanged???' );
+
+                       return false;
+               }
+
+               $user = $this->getUser();
+               if ( !$user ) {
+                       $this->setLastError( 'Invalid user' );
+
+                       return false;
+               }
+
+               // Save it
+               global $wgUser;
+               $oldUser = $wgUser;
+               $wgUser = $user;
+               $article = WikiPage::factory( $this->title );
+
+               // Messages: double-redirect-fixed-move, double-redirect-fixed-maintenance
+               $reason = wfMessage( 'double-redirect-fixed-' . $this->reason,
+                       $this->redirTitle->getPrefixedText(), $newTitle->getPrefixedText()
+               )->inContentLanguage()->text();
+               $article->doEditContent( $newContent, $reason, EDIT_UPDATE | EDIT_SUPPRESS_RC, false, $user );
+               $wgUser = $oldUser;
+
+               return true;
+       }
+
+       /**
+        * Get the final destination of a redirect
+        *
+        * @param $title Title
+        *
+        * @return bool if the specified title is not a redirect, or if it is a circular redirect
+        */
+       public static function getFinalDestination( $title ) {
+               $dbw = wfGetDB( DB_MASTER );
+
+               // Circular redirect check
+               $seenTitles = array();
+               $dest = false;
+
+               while ( true ) {
+                       $titleText = $title->getPrefixedDBkey();
+                       if ( isset( $seenTitles[$titleText] ) ) {
+                               wfDebug( __METHOD__, "Circular redirect detected, aborting\n" );
+
+                               return false;
+                       }
+                       $seenTitles[$titleText] = true;
+
+                       if ( $title->isExternal() ) {
+                               // If the target is interwiki, we have to break early (bug 40352).
+                               // Otherwise it will look up a row in the local page table
+                               // with the namespace/page of the interwiki target which can cause
+                               // unexpected results (e.g. X -> foo:Bar -> Bar -> .. )
+                               break;
+                       }
+
+                       $row = $dbw->selectRow(
+                               array( 'redirect', 'page' ),
+                               array( 'rd_namespace', 'rd_title', 'rd_interwiki' ),
+                               array(
+                                       'rd_from=page_id',
+                                       'page_namespace' => $title->getNamespace(),
+                                       'page_title' => $title->getDBkey()
+                               ), __METHOD__ );
+                       if ( !$row ) {
+                               # No redirect from here, chain terminates
+                               break;
+                       } else {
+                               $dest = $title = Title::makeTitle(
+                                       $row->rd_namespace,
+                                       $row->rd_title,
+                                       '',
+                                       $row->rd_interwiki
+                               );
+                       }
+               }
+
+               return $dest;
+       }
+
+       /**
+        * Get a user object for doing edits, from a request-lifetime cache
+        * False will be returned if the user name specified in the
+        * 'double-redirect-fixer' message is invalid.
+        *
+        * @return User|bool
+        */
+       function getUser() {
+               if ( !self::$user ) {
+                       $username = wfMessage( 'double-redirect-fixer' )->inContentLanguage()->text();
+                       self::$user = User::newFromName( $username );
+                       # User::newFromName() can return false on a badly configured wiki.
+                       if ( self::$user && !self::$user->isLoggedIn() ) {
+                               self::$user->addToDatabase();
+                       }
+               }
+
+               return self::$user;
+       }
+}
diff --git a/includes/jobqueue/jobs/DuplicateJob.php b/includes/jobqueue/jobs/DuplicateJob.php
new file mode 100644 (file)
index 0000000..b0a6ef7
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+/**
+ * No-op job that does nothing.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Cache
+ */
+
+/**
+ * No-op job that does nothing. Used to represent duplicates.
+ *
+ * @ingroup JobQueue
+ */
+final class DuplicateJob extends Job {
+       /**
+        * Callers should use DuplicateJob::newFromJob() instead
+        *
+        * @param Title $title
+        * @param array $params job parameters
+        */
+       function __construct( $title, $params ) {
+               parent::__construct( 'duplicate', $title, $params );
+       }
+
+       /**
+        * Get a duplicate no-op version of a job
+        *
+        * @param Job $job
+        * @return Job
+        */
+       public static function newFromJob( Job $job ) {
+               $djob = new self( $job->getTitle(), $job->getParams() );
+               $djob->command = $job->getType();
+               $djob->params = is_array( $djob->params ) ? $djob->params : array();
+               $djob->params = array( 'isDuplicate' => true ) + $djob->params;
+               $djob->metadata = $job->metadata;
+
+               return $djob;
+       }
+
+       public function run() {
+               return true;
+       }
+}
diff --git a/includes/jobqueue/jobs/EmaillingJob.php b/includes/jobqueue/jobs/EmaillingJob.php
new file mode 100644 (file)
index 0000000..df8ae63
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Old job for notification emails.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup JobQueue
+ */
+
+/**
+ * Old job used for sending single notification emails;
+ * kept for backwards-compatibility
+ *
+ * @ingroup JobQueue
+ */
+class EmaillingJob extends Job {
+       function __construct( $title, $params ) {
+               parent::__construct( 'sendMail', Title::newMainPage(), $params );
+       }
+
+       function run() {
+               $status = UserMailer::send(
+                       $this->params['to'],
+                       $this->params['from'],
+                       $this->params['subj'],
+                       $this->params['body'],
+                       $this->params['replyto']
+               );
+
+               return $status->isOK();
+       }
+}
diff --git a/includes/jobqueue/jobs/EnotifNotifyJob.php b/includes/jobqueue/jobs/EnotifNotifyJob.php
new file mode 100644 (file)
index 0000000..1ed99a5
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Job for notification emails.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup JobQueue
+ */
+
+/**
+ * Job for email notification mails
+ *
+ * @ingroup JobQueue
+ */
+class EnotifNotifyJob extends Job {
+       function __construct( $title, $params ) {
+               parent::__construct( 'enotifNotify', $title, $params );
+       }
+
+       function run() {
+               $enotif = new EmailNotification();
+               // Get the user from ID (rename safe). Anons are 0, so defer to name.
+               if ( isset( $this->params['editorID'] ) && $this->params['editorID'] ) {
+                       $editor = User::newFromId( $this->params['editorID'] );
+               // B/C, only the name might be given.
+               } else {
+                       # @todo FIXME: newFromName could return false on a badly configured wiki.
+                       $editor = User::newFromName( $this->params['editor'], false );
+               }
+               $enotif->actuallyNotifyOnPageChange(
+                       $editor,
+                       $this->title,
+                       $this->params['timestamp'],
+                       $this->params['summary'],
+                       $this->params['minorEdit'],
+                       $this->params['oldid'],
+                       $this->params['watchers'],
+                       $this->params['pageStatus']
+               );
+
+               return true;
+       }
+}
diff --git a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php
new file mode 100644 (file)
index 0000000..a7c5dc0
--- /dev/null
@@ -0,0 +1,170 @@
+<?php
+/**
+ * HTML cache invalidation of all pages linking to a given title.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Cache
+ */
+
+/**
+ * Job to purge the cache for all pages that link to or use another page or file
+ *
+ * This job comes in a few variants:
+ *   - a) Recursive jobs to purge caches for backlink pages for a given title.
+ *        These jobs have have (recursive:true,table:<table>) set.
+ *   - b) Jobs to purge caches for a set of titles (the job title is ignored).
+ *           These jobs have have (pages:(<page ID>:(<namespace>,<title>),...) set.
+ *
+ * @ingroup JobQueue
+ */
+class HTMLCacheUpdateJob extends Job {
+       function __construct( $title, $params = '' ) {
+               parent::__construct( 'htmlCacheUpdate', $title, $params );
+               // Base backlink purge jobs can be de-duplicated
+               $this->removeDuplicates = ( !isset( $params['range'] ) && !isset( $params['pages'] ) );
+       }
+
+       function run() {
+               global $wgUpdateRowsPerJob, $wgUpdateRowsPerQuery, $wgMaxBacklinksInvalidate;
+
+               static $expected = array( 'recursive', 'pages' ); // new jobs have one of these
+
+               $oldRangeJob = false;
+               if ( !array_intersect( array_keys( $this->params ), $expected ) ) {
+                       // B/C for older job params formats that lack these fields:
+                       // a) base jobs with just ("table") and b) range jobs with ("table","start","end")
+                       if ( isset( $this->params['start'] ) && isset( $this->params['end'] ) ) {
+                               $oldRangeJob = true;
+                       } else {
+                               $this->params['recursive'] = true; // base job
+                       }
+               }
+
+               // Job to purge all (or a range of) backlink pages for a page
+               if ( !empty( $this->params['recursive'] ) ) {
+                       // @TODO: try to use delayed jobs if possible?
+                       if ( !isset( $this->params['range'] ) && $wgMaxBacklinksInvalidate !== false ) {
+                               $numRows = $this->title->getBacklinkCache()->getNumLinks(
+                                       $this->params['table'], $wgMaxBacklinksInvalidate );
+                               if ( $numRows > $wgMaxBacklinksInvalidate ) {
+                                       return true;
+                               }
+                       }
+                       // Convert this into no more than $wgUpdateRowsPerJob HTMLCacheUpdateJob per-title
+                       // jobs and possibly a recursive HTMLCacheUpdateJob job for the rest of the backlinks
+                       $jobs = BacklinkJobUtils::partitionBacklinkJob(
+                               $this,
+                               $wgUpdateRowsPerJob,
+                               $wgUpdateRowsPerQuery, // jobs-per-title
+                               // Carry over information for de-duplication
+                               array( 'params' => $this->getRootJobParams() )
+                       );
+                       JobQueueGroup::singleton()->push( $jobs );
+               // Job to purge pages for for a set of titles
+               } elseif ( isset( $this->params['pages'] ) ) {
+                       $this->invalidateTitles( $this->params['pages'] );
+               // B/C for job to purge a range of backlink pages for a given page
+               } elseif ( $oldRangeJob ) {
+                       $titleArray = $this->title->getBacklinkCache()->getLinks(
+                               $this->params['table'], $this->params['start'], $this->params['end'] );
+
+                       $pages = array(); // same format BacklinkJobUtils uses
+                       foreach ( $titleArray as $tl ) {
+                               $pages[$tl->getArticleId()] = array( $tl->getNamespace(), $tl->getDbKey() );
+                       }
+
+                       $jobs = array();
+                       foreach ( array_chunk( $pages, $wgUpdateRowsPerJob ) as $pageChunk ) {
+                               $jobs[] = new HTMLCacheUpdateJob( $this->title,
+                                       array(
+                                               'table' => $this->params['table'],
+                                               'pages' => $pageChunk
+                                       ) + $this->getRootJobParams() // carry over information for de-duplication
+                               );
+                       }
+                       JobQueueGroup::singleton()->push( $jobs );
+               }
+
+               return true;
+       }
+
+       /**
+        * @param array $pages Map of (page ID => (namespace, DB key)) entries
+        */
+       protected function invalidateTitles( array $pages ) {
+               global $wgUpdateRowsPerQuery, $wgUseFileCache, $wgUseSquid;
+
+               // Get all page IDs in this query into an array
+               $pageIds = array_keys( $pages );
+               if ( !$pageIds ) {
+                       return;
+               }
+
+               $dbw = wfGetDB( DB_MASTER );
+
+               // The page_touched field will need to be bumped for these pages.
+               // Only bump it to the present time if no "rootJobTimestamp" was known.
+               // If it is known, it can be used instead, which avoids invalidating output
+               // that was in fact generated *after* the relevant dependency change time
+               // (e.g. template edit). This is particularily useful since refreshLinks jobs
+               // save back parser output and usually run along side htmlCacheUpdate jobs;
+               // their saved output would be invalidated by using the current timestamp.
+               if ( isset( $this->params['rootJobTimestamp'] ) ) {
+                       $touchTimestamp = $this->params['rootJobTimestamp'];
+               } else {
+                       $touchTimestamp = wfTimestampNow();
+               }
+
+               // Update page_touched (skipping pages already touched since the root job).
+               // Check $wgUpdateRowsPerQuery for sanity; batch jobs are sized by that already.
+               foreach ( array_chunk( $pageIds, $wgUpdateRowsPerQuery ) as $batch ) {
+                       $dbw->update( 'page',
+                               array( 'page_touched' => $dbw->timestamp( $touchTimestamp ) ),
+                               array( 'page_id' => $batch,
+                                       // don't invalidated pages that were already invalidated
+                                       "page_touched < " . $dbw->addQuotes( $dbw->timestamp( $touchTimestamp ) )
+                               ),
+                               __METHOD__
+                       );
+               }
+               // Get the list of affected pages (races only mean something else did the purge)
+               $titleArray = TitleArray::newFromResult( $dbw->select(
+                       'page',
+                       array( 'page_namespace', 'page_title' ),
+                       array( 'page_id' => $pageIds, 'page_touched' => $dbw->timestamp( $touchTimestamp ) ),
+                       __METHOD__
+               ) );
+
+               // Update squid
+               if ( $wgUseSquid ) {
+                       $u = SquidUpdate::newFromTitles( $titleArray );
+                       $u->doUpdate();
+               }
+
+               // Update file cache
+               if ( $wgUseFileCache ) {
+                       foreach ( $titleArray as $title ) {
+                               HTMLFileCache::clearFileCache( $title );
+                       }
+               }
+       }
+
+       public function workItemCount() {
+               return isset( $this->params['pages'] ) ? count( $this->params['pages'] ) : 1;
+       }
+}
diff --git a/includes/jobqueue/jobs/NullJob.php b/includes/jobqueue/jobs/NullJob.php
new file mode 100644 (file)
index 0000000..b2d6a9a
--- /dev/null
@@ -0,0 +1,76 @@
+<?php
+/**
+ * Degenerate job that does nothing.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Cache
+ */
+
+/**
+ * Degenerate job that does nothing, but can optionally replace itself
+ * in the queue and/or sleep for a brief time period. These can be used
+ * to represent "no-op" jobs or test lock contention and performance.
+ *
+ * @par Example:
+ * Inserting a null job in the configured job queue:
+ * @code
+ * $ php maintenance/eval.php
+ * > $queue = JobQueueGroup::singleton();
+ * > $job = new NullJob( Title::newMainPage(), array( 'lives' => 10 ) );
+ * > $queue->push( $job );
+ * @endcode
+ * You can then confirm the job has been enqueued by using the showJobs.php
+ * maintenance utility:
+ * @code
+ * $ php maintenance/showJobs.php --group
+ * null: 1 queue; 0 claimed (0 active, 0 abandoned)
+ * $
+ * @endcode
+ *
+ * @ingroup JobQueue
+ */
+class NullJob extends Job {
+       /**
+        * @param Title $title
+        * @param array $params job parameters (lives, usleep)
+        */
+       function __construct( $title, $params ) {
+               parent::__construct( 'null', $title, $params );
+               if ( !isset( $this->params['lives'] ) ) {
+                       $this->params['lives'] = 1;
+               }
+               if ( !isset( $this->params['usleep'] ) ) {
+                       $this->params['usleep'] = 0;
+               }
+               $this->removeDuplicates = !empty( $this->params['removeDuplicates'] );
+       }
+
+       public function run() {
+               if ( $this->params['usleep'] > 0 ) {
+                       usleep( $this->params['usleep'] );
+               }
+               if ( $this->params['lives'] > 1 ) {
+                       $params = $this->params;
+                       $params['lives']--;
+                       $job = new self( $this->title, $params );
+                       JobQueueGroup::singleton()->push( $job );
+               }
+
+               return true;
+       }
+}
diff --git a/includes/jobqueue/jobs/PublishStashedFileJob.php b/includes/jobqueue/jobs/PublishStashedFileJob.php
new file mode 100644 (file)
index 0000000..d7667f3
--- /dev/null
@@ -0,0 +1,147 @@
+<?php
+/**
+ * Upload a file from the upload stash into the local file repo.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Upload
+ */
+
+/**
+ * Upload a file from the upload stash into the local file repo.
+ *
+ * @ingroup Upload
+ */
+class PublishStashedFileJob extends Job {
+       public function __construct( $title, $params ) {
+               parent::__construct( 'PublishStashedFile', $title, $params );
+               $this->removeDuplicates = true;
+       }
+
+       public function run() {
+               $scope = RequestContext::importScopedSession( $this->params['session'] );
+               $context = RequestContext::getMain();
+               try {
+                       $user = $context->getUser();
+                       if ( !$user->isLoggedIn() ) {
+                               $this->setLastError( "Could not load the author user from session." );
+
+                               return false;
+                       }
+
+                       if ( count( $_SESSION ) === 0 ) {
+                               // Empty session probably indicates that we didn't associate
+                               // with the session correctly. Note that being able to load
+                               // the user does not necessarily mean the session was loaded.
+                               // Most likely cause by suhosin.session.encrypt = On.
+                               $this->setLastError( "Error associating with user session. " .
+                                       "Try setting suhosin.session.encrypt = Off" );
+
+                               return false;
+                       }
+
+                       UploadBase::setSessionStatus(
+                               $this->params['filekey'],
+                               array( 'result' => 'Poll', 'stage' => 'publish', 'status' => Status::newGood() )
+                       );
+
+                       $upload = new UploadFromStash( $user );
+                       // @todo initialize() causes a GET, ideally we could frontload the antivirus
+                       // checks and anything else to the stash stage (which includes concatenation and
+                       // the local file is thus already there). That way, instead of GET+PUT, there could
+                       // just be a COPY operation from the stash to the public zone.
+                       $upload->initialize( $this->params['filekey'], $this->params['filename'] );
+
+                       // Check if the local file checks out (this is generally a no-op)
+                       $verification = $upload->verifyUpload();
+                       if ( $verification['status'] !== UploadBase::OK ) {
+                               $status = Status::newFatal( 'verification-error' );
+                               $status->value = array( 'verification' => $verification );
+                               UploadBase::setSessionStatus(
+                                       $this->params['filekey'],
+                                       array( 'result' => 'Failure', 'stage' => 'publish', 'status' => $status )
+                               );
+                               $this->setLastError( "Could not verify upload." );
+
+                               return false;
+                       }
+
+                       // Upload the stashed file to a permanent location
+                       $status = $upload->performUpload(
+                               $this->params['comment'],
+                               $this->params['text'],
+                               $this->params['watch'],
+                               $user
+                       );
+                       if ( !$status->isGood() ) {
+                               UploadBase::setSessionStatus(
+                                       $this->params['filekey'],
+                                       array( 'result' => 'Failure', 'stage' => 'publish', 'status' => $status )
+                               );
+                               $this->setLastError( $status->getWikiText() );
+
+                               return false;
+                       }
+
+                       // Build the image info array while we have the local reference handy
+                       $apiMain = new ApiMain(); // dummy object (XXX)
+                       $imageInfo = $upload->getImageInfo( $apiMain->getResult() );
+
+                       // Cleanup any temporary local file
+                       $upload->cleanupTempFile();
+
+                       // Cache the info so the user doesn't have to wait forever to get the final info
+                       UploadBase::setSessionStatus(
+                               $this->params['filekey'],
+                               array(
+                                       'result' => 'Success',
+                                       'stage' => 'publish',
+                                       'filename' => $upload->getLocalFile()->getName(),
+                                       'imageinfo' => $imageInfo,
+                                       'status' => Status::newGood()
+                               )
+                       );
+               } catch ( MWException $e ) {
+                       UploadBase::setSessionStatus(
+                               $this->params['filekey'],
+                               array(
+                                       'result' => 'Failure',
+                                       'stage' => 'publish',
+                                       'status' => Status::newFatal( 'api-error-publishfailed' )
+                               )
+                       );
+                       $this->setLastError( get_class( $e ) . ": " . $e->getText() );
+
+                       return false;
+               }
+
+               return true;
+       }
+
+       public function getDeduplicationInfo() {
+               $info = parent::getDeduplicationInfo();
+               if ( is_array( $info['params'] ) ) {
+                       $info['params'] = array( 'filekey' => $info['params']['filekey'] );
+               }
+
+               return $info;
+       }
+
+       public function allowRetries() {
+               return false;
+       }
+}
diff --git a/includes/jobqueue/jobs/RefreshLinksJob.php b/includes/jobqueue/jobs/RefreshLinksJob.php
new file mode 100644 (file)
index 0000000..3bcb4fc
--- /dev/null
@@ -0,0 +1,197 @@
+<?php
+/**
+ * Job to update link tables for pages
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup JobQueue
+ */
+
+/**
+ * Job to update link tables for pages
+ *
+ * This job comes in a few variants:
+ *   - a) Recursive jobs to update links for backlink pages for a given title.
+ *        These jobs have have (recursive:true,table:<table>) set.
+ *   - b) Jobs to update links for a set of pages (the job title is ignored).
+ *           These jobs have have (pages:(<page ID>:(<namespace>,<title>),...) set.
+ *   - c) Jobs to update links for a single page (the job title)
+ *        These jobs need no extra fields set.
+ *
+ * @ingroup JobQueue
+ */
+class RefreshLinksJob extends Job {
+       const PARSE_THRESHOLD_SEC = 1.0;
+
+       function __construct( $title, $params = '' ) {
+               parent::__construct( 'refreshLinks', $title, $params );
+               // Base backlink update jobs and per-title update jobs can be de-duplicated.
+               // If template A changes twice before any jobs run, a clean queue will have:
+               //              (A base, A base)
+               // The second job is ignored by the queue on insertion.
+               // Suppose, many pages use template A, and that template itself uses template B.
+               // An edit to both will first create two base jobs. A clean FIFO queue will have:
+               //              (A base, B base)
+               // When these jobs run, the queue will have per-title and remnant partition jobs:
+               //              (titleX,titleY,titleZ,...,A remnant,titleM,titleN,titleO,...,B remnant)
+               // Some these jobs will be the same, and will automatically be ignored by
+               // the queue upon insertion. Some title jobs will run before the duplicate is
+               // inserted, so the work will still be done twice in those cases. More titles
+               // can be de-duplicated as the remnant jobs continue to be broken down. This
+               // works best when $wgUpdateRowsPerJob, and either the pages have few backlinks
+               // and/or the backlink sets for pages A and B are almost identical.
+               $this->removeDuplicates = !isset( $params['range'] )
+                       && ( !isset( $params['pages'] ) || count( $params['pages'] ) == 1 );
+       }
+
+       function run() {
+               global $wgUpdateRowsPerJob;
+
+               // Job to update all (or a range of) backlink pages for a page
+               if ( !empty( $this->params['recursive'] ) ) {
+                       // Carry over information for de-duplication
+                       $extraParams = $this->getRootJobParams();
+                       // Avoid slave lag when fetching templates.
+                       // When the outermost job is run, we know that the caller that enqueued it must have
+                       // committed the relevant changes to the DB by now. At that point, record the master
+                       // position and pass it along as the job recursively breaks into smaller range jobs.
+                       // Hopefully, when leaf jobs are popped, the slaves will have reached that position.
+                       if ( isset( $this->params['masterPos'] ) ) {
+                               $extraParams['masterPos'] = $this->params['masterPos'];
+                       } elseif ( wfGetLB()->getServerCount() > 1 ) {
+                               $extraParams['masterPos'] = wfGetLB()->getMasterPos();
+                       } else {
+                               $extraParams['masterPos'] = false;
+                       }
+                       // Convert this into no more than $wgUpdateRowsPerJob RefreshLinks per-title
+                       // jobs and possibly a recursive RefreshLinks job for the rest of the backlinks
+                       $jobs = BacklinkJobUtils::partitionBacklinkJob(
+                               $this,
+                               $wgUpdateRowsPerJob,
+                               1, // job-per-title
+                               array( 'params' => $extraParams )
+                       );
+                       JobQueueGroup::singleton()->push( $jobs );
+               // Job to update link tables for for a set of titles
+               } elseif ( isset( $this->params['pages'] ) ) {
+                       foreach ( $this->params['pages'] as $pageId => $nsAndKey ) {
+                               list( $ns, $dbKey ) = $nsAndKey;
+                               $this->runForTitle( Title::makeTitleSafe( $ns, $dbKey ) );
+                       }
+               // Job to update link tables for a given title
+               } else {
+                       $this->runForTitle( $this->title );
+               }
+
+               return true;
+       }
+
+       protected function runForTitle( Title $title = null ) {
+               $linkCache = LinkCache::singleton();
+               $linkCache->clear();
+
+               if ( is_null( $title ) ) {
+                       $this->setLastError( "refreshLinks: Invalid title" );
+                       return false;
+               }
+
+               // Wait for the DB of the current/next slave DB handle to catch up to the master.
+               // This way, we get the correct page_latest for templates or files that just changed
+               // milliseconds ago, having triggered this job to begin with.
+               if ( isset( $this->params['masterPos'] ) && $this->params['masterPos'] !== false ) {
+                       wfGetLB()->waitFor( $this->params['masterPos'] );
+               }
+
+               $page = WikiPage::factory( $title );
+
+               // Fetch the current revision...
+               $revision = Revision::newFromTitle( $title, false, Revision::READ_NORMAL );
+               if ( !$revision ) {
+                       $this->setLastError( "refreshLinks: Article not found {$title->getPrefixedDBkey()}" );
+                       return false; // XXX: what if it was just deleted?
+               }
+               $content = $revision->getContent( Revision::RAW );
+               if ( !$content ) {
+                       // If there is no content, pretend the content is empty
+                       $content = $revision->getContentHandler()->makeEmptyContent();
+               }
+
+               $parserOutput = false;
+               $parserOptions = $page->makeParserOptions( 'canonical' );
+               // If page_touched changed after this root job (with a good slave lag skew factor),
+               // then it is likely that any views of the pages already resulted in re-parses which
+               // are now in cache. This can be reused to avoid expensive parsing in some cases.
+               if ( isset( $this->params['rootJobTimestamp'] ) ) {
+                       $skewedTimestamp = wfTimestamp( TS_UNIX, $this->params['rootJobTimestamp'] ) + 5;
+                       if ( $page->getLinksTimestamp() > wfTimestamp( TS_MW, $skewedTimestamp ) ) {
+                               // Something already updated the backlinks since this job was made
+                               return true;
+                       }
+                       if ( $page->getTouched() > wfTimestamp( TS_MW, $skewedTimestamp ) ) {
+                               $parserOutput = ParserCache::singleton()->getDirty( $page, $parserOptions );
+                               if ( $parserOutput && $parserOutput->getCacheTime() <= $skewedTimestamp ) {
+                                       $parserOutput = false; // too stale
+                               }
+                       }
+               }
+               // Fetch the current revision and parse it if necessary...
+               if ( $parserOutput == false ) {
+                       $start = microtime( true );
+                       // Revision ID must be passed to the parser output to get revision variables correct
+                       $parserOutput = $content->getParserOutput(
+                               $title, $revision->getId(), $parserOptions, false );
+                       $ellapsed = microtime( true ) - $start;
+                       // If it took a long time to render, then save this back to the cache to avoid
+                       // wasted CPU by other apaches or job runners. We don't want to always save to
+                       // cache as this cause cause high cache I/O and LRU churn when a template changes.
+                       if ( $ellapsed >= self::PARSE_THRESHOLD_SEC
+                               && $page->isParserCacheUsed( $parserOptions, $revision->getId() )
+                               && $parserOutput->isCacheable()
+                       ) {
+                               $ctime = wfTimestamp( TS_MW, (int)$start ); // cache time
+                               ParserCache::singleton()->save( $parserOutput, $page, $parserOptions, $ctime );
+                       }
+               }
+
+               $updates = $content->getSecondaryDataUpdates( $title, null, false, $parserOutput );
+               DataUpdate::runUpdates( $updates );
+
+               InfoAction::invalidateCache( $title );
+
+               return true;
+       }
+
+       public function getDeduplicationInfo() {
+               $info = parent::getDeduplicationInfo();
+               if ( is_array( $info['params'] ) ) {
+                       // Don't let highly unique "masterPos" values ruin duplicate detection
+                       unset( $info['params']['masterPos'] );
+                       // For per-pages jobs, the job title is that of the template that changed
+                       // (or similar), so remove that since it ruins duplicate detection
+                       if ( isset( $info['pages'] ) ) {
+                               unset( $info['namespace'] );
+                               unset( $info['title'] );
+                       }
+               }
+
+               return $info;
+       }
+
+       public function workItemCount() {
+               return isset( $this->params['pages'] ) ? count( $this->params['pages'] ) : 1;
+       }
+}
diff --git a/includes/jobqueue/jobs/RefreshLinksJob2.php b/includes/jobqueue/jobs/RefreshLinksJob2.php
new file mode 100644 (file)
index 0000000..77e3b3f
--- /dev/null
@@ -0,0 +1,141 @@
+<?php
+/**
+ * Job to update links for a given title.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup JobQueue
+ */
+
+/**
+ * Background job to update links for titles in certain backlink range by page ID.
+ * Newer version for high use templates. This is deprecated by RefreshLinksPartitionJob.
+ *
+ * @ingroup JobQueue
+ * @deprecated 1.23
+ */
+class RefreshLinksJob2 extends Job {
+       function __construct( $title, $params ) {
+               parent::__construct( 'refreshLinks2', $title, $params );
+               // Base jobs for large templates can easily be de-duplicated
+               $this->removeDuplicates = !isset( $params['start'] ) && !isset( $params['end'] );
+       }
+
+       /**
+        * Run a refreshLinks2 job
+        * @return boolean success
+        */
+       function run() {
+               global $wgUpdateRowsPerJob;
+
+               $linkCache = LinkCache::singleton();
+               $linkCache->clear();
+
+               if ( is_null( $this->title ) ) {
+                       $this->error = "refreshLinks2: Invalid title";
+                       return false;
+               }
+
+               // Back compat for pre-r94435 jobs
+               $table = isset( $this->params['table'] ) ? $this->params['table'] : 'templatelinks';
+
+               // Avoid slave lag when fetching templates.
+               // When the outermost job is run, we know that the caller that enqueued it must have
+               // committed the relevant changes to the DB by now. At that point, record the master
+               // position and pass it along as the job recursively breaks into smaller range jobs.
+               // Hopefully, when leaf jobs are popped, the slaves will have reached that position.
+               if ( isset( $this->params['masterPos'] ) ) {
+                       $masterPos = $this->params['masterPos'];
+               } elseif ( wfGetLB()->getServerCount() > 1 ) {
+                       $masterPos = wfGetLB()->getMasterPos();
+               } else {
+                       $masterPos = false;
+               }
+
+               $tbc = $this->title->getBacklinkCache();
+
+               $jobs = array(); // jobs to insert
+               if ( isset( $this->params['start'] ) && isset( $this->params['end'] ) ) {
+                       # This is a partition job to trigger the insertion of leaf jobs...
+                       $jobs = array_merge( $jobs, $this->getSingleTitleJobs( $table, $masterPos ) );
+               } else {
+                       # This is a base job to trigger the insertion of partitioned jobs...
+                       if ( $tbc->getNumLinks( $table, $wgUpdateRowsPerJob + 1 ) <= $wgUpdateRowsPerJob ) {
+                               # Just directly insert the single per-title jobs
+                               $jobs = array_merge( $jobs, $this->getSingleTitleJobs( $table, $masterPos ) );
+                       } else {
+                               # Insert the partition jobs to make per-title jobs
+                               foreach ( $tbc->partition( $table, $wgUpdateRowsPerJob ) as $batch ) {
+                                       list( $start, $end ) = $batch;
+                                       $jobs[] = new RefreshLinksJob2( $this->title,
+                                               array(
+                                                       'table' => $table,
+                                                       'start' => $start,
+                                                       'end' => $end,
+                                                       'masterPos' => $masterPos,
+                                               ) + $this->getRootJobParams() // carry over information for de-duplication
+                                       );
+                               }
+                       }
+               }
+
+               if ( count( $jobs ) ) {
+                       JobQueueGroup::singleton()->push( $jobs );
+               }
+
+               return true;
+       }
+
+       /**
+        * @param $table string
+        * @param $masterPos mixed
+        * @return Array
+        */
+       protected function getSingleTitleJobs( $table, $masterPos ) {
+               # The "start"/"end" fields are not set for the base jobs
+               $start = isset( $this->params['start'] ) ? $this->params['start'] : false;
+               $end = isset( $this->params['end'] ) ? $this->params['end'] : false;
+               $titles = $this->title->getBacklinkCache()->getLinks( $table, $start, $end );
+               # Convert into single page refresh links jobs.
+               # This handles well when in sapi mode and is useful in any case for job
+               # de-duplication. If many pages use template A, and that template itself
+               # uses template B, then an edit to both will create many duplicate jobs.
+               # Roughly speaking, for each page, one of the "RefreshLinksJob" jobs will
+               # get run first, and when it does, it will remove the duplicates. Of course,
+               # one page could have its job popped when the other page's job is still
+               # buried within the logic of a refreshLinks2 job.
+               $jobs = array();
+               foreach ( $titles as $title ) {
+                       $jobs[] = new RefreshLinksJob( $title,
+                               array( 'masterPos' => $masterPos ) + $this->getRootJobParams()
+                       ); // carry over information for de-duplication
+               }
+               return $jobs;
+       }
+
+       /**
+        * @return Array
+        */
+       public function getDeduplicationInfo() {
+               $info = parent::getDeduplicationInfo();
+               // Don't let highly unique "masterPos" values ruin duplicate detection
+               if ( is_array( $info['params'] ) ) {
+                       unset( $info['params']['masterPos'] );
+               }
+               return $info;
+       }
+}
diff --git a/includes/jobqueue/jobs/UploadFromUrlJob.php b/includes/jobqueue/jobs/UploadFromUrlJob.php
new file mode 100644 (file)
index 0000000..2cdac57
--- /dev/null
@@ -0,0 +1,187 @@
+<?php
+/**
+ * Job for asynchronous upload-by-url.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup JobQueue
+ */
+
+/**
+ * Job for asynchronous upload-by-url.
+ *
+ * This job is in fact an interface to UploadFromUrl, which is designed such
+ * that it does not require any globals. If it does, fix it elsewhere, do not
+ * add globals in here.
+ *
+ * @ingroup JobQueue
+ */
+class UploadFromUrlJob extends Job {
+       const SESSION_KEYNAME = 'wsUploadFromUrlJobData';
+
+       /** @var UploadFromUrl */
+       public $upload;
+
+       /** @var User */
+       protected $user;
+
+       public function __construct( $title, $params ) {
+               parent::__construct( 'uploadFromUrl', $title, $params );
+       }
+
+       public function run() {
+               global $wgCopyUploadAsyncTimeout;
+               # Initialize this object and the upload object
+               $this->upload = new UploadFromUrl();
+               $this->upload->initialize(
+                       $this->title->getText(),
+                       $this->params['url'],
+                       false
+               );
+               $this->user = User::newFromName( $this->params['userName'] );
+
+               # Fetch the file
+               $opts = array();
+               if ( $wgCopyUploadAsyncTimeout ) {
+                       $opts['timeout'] = $wgCopyUploadAsyncTimeout;
+               }
+               $status = $this->upload->fetchFile( $opts );
+               if ( !$status->isOk() ) {
+                       $this->leaveMessage( $status );
+
+                       return true;
+               }
+
+               # Verify upload
+               $result = $this->upload->verifyUpload();
+               if ( $result['status'] != UploadBase::OK ) {
+                       $status = $this->upload->convertVerifyErrorToStatus( $result );
+                       $this->leaveMessage( $status );
+
+                       return true;
+               }
+
+               # Check warnings
+               if ( !$this->params['ignoreWarnings'] ) {
+                       $warnings = $this->upload->checkWarnings();
+                       if ( $warnings ) {
+
+                               # Stash the upload
+                               $key = $this->upload->stashFile();
+
+                               // @todo FIXME: This has been broken for a while.
+                               // User::leaveUserMessage() does not exist.
+                               if ( $this->params['leaveMessage'] ) {
+                                       $this->user->leaveUserMessage(
+                                               wfMessage( 'upload-warning-subj' )->text(),
+                                               wfMessage( 'upload-warning-msg',
+                                                       $key,
+                                                       $this->params['url'] )->text()
+                                       );
+                               } else {
+                                       wfSetupSession( $this->params['sessionId'] );
+                                       $this->storeResultInSession( 'Warning',
+                                               'warnings', $warnings );
+                                       session_write_close();
+                               }
+
+                               return true;
+                       }
+               }
+
+               # Perform the upload
+               $status = $this->upload->performUpload(
+                       $this->params['comment'],
+                       $this->params['pageText'],
+                       $this->params['watch'],
+                       $this->user
+               );
+               $this->leaveMessage( $status );
+
+               return true;
+       }
+
+       /**
+        * Leave a message on the user talk page or in the session according to
+        * $params['leaveMessage'].
+        *
+        * @param Status $status
+        */
+       protected function leaveMessage( $status ) {
+               if ( $this->params['leaveMessage'] ) {
+                       if ( $status->isGood() ) {
+                               // @todo FIXME: user->leaveUserMessage does not exist.
+                               $this->user->leaveUserMessage( wfMessage( 'upload-success-subj' )->text(),
+                                       wfMessage( 'upload-success-msg',
+                                               $this->upload->getTitle()->getText(),
+                                               $this->params['url']
+                                       )->text() );
+                       } else {
+                               // @todo FIXME: user->leaveUserMessage does not exist.
+                               $this->user->leaveUserMessage( wfMessage( 'upload-failure-subj' )->text(),
+                                       wfMessage( 'upload-failure-msg',
+                                               $status->getWikiText(),
+                                               $this->params['url']
+                                       )->text() );
+                       }
+               } else {
+                       wfSetupSession( $this->params['sessionId'] );
+                       if ( $status->isOk() ) {
+                               $this->storeResultInSession( 'Success',
+                                       'filename', $this->upload->getLocalFile()->getName() );
+                       } else {
+                               $this->storeResultInSession( 'Failure',
+                                       'errors', $status->getErrorsArray() );
+                       }
+                       session_write_close();
+               }
+       }
+
+       /**
+        * Store a result in the session data. Note that the caller is responsible
+        * for appropriate session_start and session_write_close calls.
+        *
+        * @param string $result the result (Success|Warning|Failure)
+        * @param string $dataKey the key of the extra data
+        * @param mixed $dataValue The extra data itself
+        */
+       protected function storeResultInSession( $result, $dataKey, $dataValue ) {
+               $session =& self::getSessionData( $this->params['sessionKey'] );
+               $session['result'] = $result;
+               $session[$dataKey] = $dataValue;
+       }
+
+       /**
+        * Initialize the session data. Sets the intial result to queued.
+        */
+       public function initializeSessionData() {
+               $session =& self::getSessionData( $this->params['sessionKey'] );
+               $$session['result'] = 'Queued';
+       }
+
+       /**
+        * @param $key
+        * @return mixed
+        */
+       public static function &getSessionData( $key ) {
+               if ( !isset( $_SESSION[self::SESSION_KEYNAME][$key] ) ) {
+                       $_SESSION[self::SESSION_KEYNAME][$key] = array();
+               }
+
+               return $_SESSION[self::SESSION_KEYNAME][$key];
+       }
+}
diff --git a/includes/jobqueue/utils/BacklinkJobUtils.php b/includes/jobqueue/utils/BacklinkJobUtils.php
new file mode 100644 (file)
index 0000000..c8e5df6
--- /dev/null
@@ -0,0 +1,122 @@
+<?php
+/**
+ * Job to update links for a given title.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup JobQueue
+ * @author Aaron Schulz
+ */
+
+/**
+ * Class with Backlink related Job helper methods
+ *
+ * @ingroup JobQueue
+ * @since 1.23
+ */
+class BacklinkJobUtils {
+       /**
+        * Break down $job into approximately ($bSize/$cSize) leaf jobs and a single partition
+        * job that covers the remaining backlink range (if needed). Jobs for the first $bSize
+        * titles are collated ($cSize per job) into leaf jobs to do actual work. All the
+        * resulting jobs are of the same class as $job. No partition job is returned if the
+        * range covered by $job was less than $bSize, as the leaf jobs have full coverage.
+        *
+        * The leaf jobs have the 'pages' param set to a (<page ID>:(<namespace>,<DB key>),...)
+        * map so that the run() function knows what pages to act on. The leaf jobs will keep
+        * the same job title as the parent job (e.g. $job).
+        *
+        * The partition jobs have the 'range' parameter set to a map of the format
+        * (start:<integer>, end:<integer>, batchSize:<integer>, subranges:((<start>,<end>),...)),
+        * the 'table' parameter set to that of $job, and the 'recursive' parameter set to true.
+        * This method can be called on the resulting job to repeat the process again.
+        *
+        * The job provided ($job) must have the 'recursive' parameter set to true and the 'table'
+        * parameter must be set to a backlink table. The job title will be used as the title to
+        * find backlinks for. Any 'range' parameter must follow the same format as mentioned above.
+        * This should be managed by recursive calls to this method.
+        *
+        * The first jobs return are always the leaf jobs. This lets the caller use push() to
+        * put them directly into the queue and works well if the queue is FIFO. In such a queue,
+        * the leaf jobs have to get finished first before anything can resolve the next partition
+        * job, which keeps the queue very small.
+        *
+        * $opts includes:
+        *   - params : extra job parameters to include in each job
+        *
+        * @param Job $job
+        * @param int $bSize BacklinkCache partition size; usually $wgUpdateRowsPerJob
+        * @param int $cSize Max titles per leaf job; Usually 1 or a modest value
+        * @param array $opts Optional parameter map
+        * @return Job[] List of Job objects
+        */
+       public static function partitionBacklinkJob( Job $job, $bSize, $cSize, $opts = array() ) {
+               $class = get_class( $job );
+               $title = $job->getTitle();
+               $params = $job->getParams();
+
+               if ( isset( $params['pages'] ) || empty( $params['recursive'] ) ) {
+                       $ranges = array(); // sanity; this is a leaf node
+                       wfWarn( __METHOD__ . " called on {$job->getType()} leaf job (explosive recursion)." );
+               } elseif ( isset( $params['range'] ) ) {
+                       // This is a range job to trigger the insertion of partitioned/title jobs...
+                       $ranges = $params['range']['subranges'];
+                       $realBSize = $params['range']['batchSize'];
+               } else {
+                       // This is a base job to trigger the insertion of partitioned jobs...
+                       $ranges = $title->getBacklinkCache()->partition( $params['table'], $bSize );
+                       $realBSize = $bSize;
+               }
+
+               $extraParams = isset( $opts['params'] ) ? $opts['params'] : array();
+
+               $jobs = array();
+               // Combine the first range (of size $bSize) backlinks into leaf jobs
+               if ( isset( $ranges[0] ) ) {
+                       list( $start, $end ) = $ranges[0];
+                       $titles = $title->getBacklinkCache()->getLinks( $params['table'], $start, $end );
+                       foreach ( array_chunk( iterator_to_array( $titles ), $cSize ) as $titleBatch ) {
+                               $pages = array();
+                               foreach ( $titleBatch as $tl ) {
+                                       $pages[$tl->getArticleId()] = array( $tl->getNamespace(), $tl->getDBKey() );
+                               }
+                               $jobs[] = new $class(
+                                       $title, // maintain parent job title
+                                       array( 'pages' => $pages ) + $extraParams
+                               );
+                       }
+               }
+               // Take all of the remaining ranges and build a partition job from it
+               if ( isset( $ranges[1] ) ) {
+                       $jobs[] = new $class(
+                               $title, // maintain parent job title
+                               array(
+                                       'recursive'     => true,
+                                       'table'         => $params['table'],
+                                       'range'         => array(
+                                               'start'     => $ranges[1][0],
+                                               'end'       => $ranges[count( $ranges ) - 1][1],
+                                               'batchSize' => $realBSize,
+                                               'subranges' => array_slice( $ranges, 1 )
+                                       ),
+                               ) + $extraParams
+                       );
+               }
+
+               return $jobs;
+       }
+}
index 235a5ad..a26ef68 100644 (file)
@@ -227,15 +227,17 @@ class Profiler {
                $bit = array_pop( $this->mWorkStack );
 
                if ( !$bit ) {
-                       $this->debug( "Profiling error, !\$bit: $functionname\n" );
+                       $this->debugGroup( 'profileerror', "Profiling error, !\$bit: $functionname" );
                } else {
                        if ( $functionname == 'close' ) {
-                               $message = "Profile section ended by close(): {$bit[0]}";
-                               $this->debug( "$message\n" );
-                               $this->mStack[] = array( $message, 0, 0.0, 0, 0.0, 0 );
+                               if ( $bit[0] != '-total' ) {
+                                       $message = "Profile section ended by close(): {$bit[0]}";
+                                       $this->debugGroup( 'profileerror', $message );
+                                       $this->mStack[] = array( $message, 0, 0.0, 0, 0.0, 0 );
+                               }
                        } elseif ( $bit[0] != $functionname ) {
                                $message = "Profiling error: in({$bit[0]}), out($functionname)";
-                               $this->debug( "$message\n" );
+                               $this->debugGroup( 'profileerror', $message );
                                $this->mStack[] = array( $message, 0, 0.0, 0, 0.0, 0 );
                        }
                        $bit[] = $time;
@@ -324,7 +326,7 @@ class Profiler {
                                        list( $method, $realtime ) = $info;
                                        $msg .= sprintf( "%d\t%.6f\t%s\n", $i, $realtime, $method );
                                }
-                               wfDebugLog( 'DBPerformance', $msg );
+                               $this->debugGroup( 'DBPerformance', $msg );
                        }
                        unset( $this->mDBTrxHoldingLocks[$name] );
                        unset( $this->mDBTrxMethodTimes[$name] );
@@ -720,6 +722,18 @@ class Profiler {
                }
        }
 
+       /**
+        * Add an entry in the debug log group
+        *
+        * @param string $group Group to send the message to
+        * @param string $s to output
+        */
+       function debugGroup( $group, $s ) {
+               if ( function_exists( 'wfDebugLog' ) ) {
+                       wfDebugLog( $group, $s );
+               }
+       }
+
        /**
         * Get the content type sent out to the client.
         * Used for profilers that output instead of store data.
index e81c6ec..5ecfc21 100644 (file)
@@ -90,7 +90,7 @@ class ProfilerMwprof extends Profiler {
                // Check for unbalanced profileIn / profileOut calls.
                // Bad entries are logged but not sent.
                if ( $inName !== $outName ) {
-                       wfDebugLog( 'ProfilerUnbalanced', json_encode( array( $inName, $outName ) ) );
+                       $this->debugGroup( 'ProfilerUnbalanced', json_encode( array( $inName, $outName ) ) );
                        return;
                }
 
index ee92c17..7d78e36 100644 (file)
@@ -102,17 +102,18 @@ class ProfilerSimple extends Profiler {
                list( $ofname, /* $ocount */, $ortime, $octime ) = array_pop( $this->mWorkStack );
 
                if ( !$ofname ) {
-                       $this->debug( "Profiling error: $functionname\n" );
+                       $this->debugGroup( 'profileerror', "Profiling error: $functionname" );
                } else {
                        if ( $functionname == 'close' ) {
-                               $message = "Profile section ended by close(): {$ofname}";
-                               $functionname = $ofname;
-                               $this->debug( "$message\n" );
-                               $this->mCollated[$message] = $this->errorEntry;
-                       }
-                       elseif ( $ofname != $functionname ) {
+                               if ( $ofname != '-total' ) {
+                                       $message = "Profile section ended by close(): {$ofname}";
+                                       $functionname = $ofname;
+                                       $this->debugGroup( 'profileerror', $message );
+                                       $this->mCollated[$message] = $this->errorEntry;
+                               }
+                       } elseif ( $ofname != $functionname ) {
                                $message = "Profiling error: in({$ofname}), out($functionname)";
-                               $this->debug( "$message\n" );
+                               $this->debugGroup( 'profileerror', $message );
                                $this->mCollated[$message] = $this->errorEntry;
                        }
                        $elapsedcpu = $this->getTime( 'cpu' ) - $octime;
index f478ed2..69cc39d 100644 (file)
@@ -205,7 +205,7 @@ $messages = array(
 'category_header' => '"$1" kateqoriyasındakı məqalələr',
 'subcategories' => 'Alt kateqoriyalar',
 'category-media-header' => '"$1" kateqoriyasında mediya',
-'category-empty' => "''Bu kateqoriyanın tərkibi hal-hazırda boşdur.''",
+'category-empty' => '"Bu kateqoriya hal-hazırda boşdur."',
 'hidden-categories' => '{{PLURAL:$1|Gizli kateqoriya|Gizli kateqoriyalar}}',
 'hidden-category-category' => 'Gizli kateqoriyalar',
 'category-subcat-count' => '{{PLURAL:$2|Bu kateqoriya yalnız aşağıdakı altkateqoriyadan ibarətdir.|Cəmi $2 kateqoriyadan {{PLURAL:$1|altkateqoriya|$1 altkateqoriya}} göstərilmişdir.}}',
@@ -353,10 +353,10 @@ Bax: [[Special:Version|Versiyalar]].',
 'pagetitle' => '$1 - {{SITENAME}}',
 'pagetitle-view-mainpage' => '{{SITENAME}}',
 'retrievedfrom' => 'Mənbə — "$1"',
-'youhavenewmessages' => 'Hal-hazırda $1 var. ($2)',
+'youhavenewmessages' => '{{PLURAL:$3|$3}} $1 var ($2).',
 'youhavenewmessagesfromusers' => '{{PLURAL:$3|Başqa bir istifadəçidən|$3 istifadəçidən}} $1 var ($2).',
-'youhavenewmessagesmanyusers' => 'Bir çox istifadəçidən $1 var ($2).',
-'newmessageslinkplural' => '{{PLURAL:$1|yeni mesajınız|yeni mesajlarınız}}',
+'youhavenewmessagesmanyusers' => 'Bir neçə istifadəçidən $1 var ($2).',
+'newmessageslinkplural' => '{{PLURAL:$1|yeni mesajınız|yeni mesajınız}}',
 'newmessagesdifflinkplural' => 'son {{PLURAL:$1|dəyişiklik|dəyişikliklər}}',
 'youhavenewmessagesmulti' => '"$1"da yeni mesajınız var.',
 'editsection' => 'redaktə',
@@ -428,7 +428,7 @@ Bu vəziyyət səhifənin, silinmiş bir səhifənin keçmiş versiyası olması
 
 Əgər niyə bu deyilsə, proqramda bir səhv ilə qarşılaşmış ola bilərsiniz.
 Xahiş edirik bunu bir [[Special:ListUsers/sysop|İdarəçilərə]], URL not edərək göndərin.',
-'missingarticle-rev' => '(təftiş № $1)',
+'missingarticle-rev' => '(versiya №: $1)',
 'missingarticle-diff' => '(fərq: $1, $2)',
 'readonly_lag' => 'Məlumatlar bazasının ikinci dərəcəli serveri əsas serverlə əlaqə yaradanadək məlumatlar bazası avtomatik olaraq bloklanmışdır',
 'internalerror' => 'Daxili xəta',
@@ -508,7 +508,7 @@ Siz {{SITENAME}} saytını anonim olaraq istifadə etməyə davam edə bilər v
 'userlogin-yourpassword' => 'Parol',
 'userlogin-yourpassword-ph' => 'Parolunuzu daxil edin',
 'createacct-yourpassword-ph' => 'Parol daxil edin',
-'yourpasswordagain' => 'Parolu təkrar yazın:',
+'yourpasswordagain' => 'Parolu təkrar daxil edin:',
 'createacct-yourpasswordagain' => 'Parolu təsdiqlə',
 'createacct-yourpasswordagain-ph' => 'Parolu təkrar daxil edin',
 'remembermypassword' => 'Məni bu kompyuterdə xatırla (maksimum $1 {{PLURAL:$1|gün|gün}})',
@@ -527,10 +527,10 @@ Siz {{SITENAME}} saytını anonim olaraq istifadə etməyə davam edə bilər v
 'notloggedin' => 'Daxil olmamısınız',
 'userlogin-noaccount' => 'İstifadəçi hesabınız yoxdur?',
 'userlogin-joinproject' => '{{SITENAME}} qoşulun',
-'nologin' => "İstifadəçi hesabınız yoxdur? '''$1'''.",
-'nologinlink' => 'hesab açın',
+'nologin' => 'İstifadəçi hesabınız yoxdur? $1.',
+'nologinlink' => 'Hesab yaradın',
 'createaccount' => 'Hesab aç',
-'gotaccount' => "Giriş hesabınız varsa '''$1'''.",
+'gotaccount' => "İstifadəçi hesabınız varmı? '''$1'''.",
 'gotaccountlink' => 'Daxil olun',
 'userlogin-resetlink' => 'Daxilolma məlumatlarınızı unutmusunuz?',
 'userlogin-resetpassword-link' => 'Parolu unutdunuzmu?',
@@ -757,7 +757,7 @@ Bloklama qeydlərinin sonuncusu aşağıda göstərilmişdir:',
 '''Bu hələ yaddaşda saxlanılmayıb!'''",
 'updated' => '(yeniləndi)',
 'note' => "'''Qeyd:'''",
-'previewnote' => "'''Bu yalnız sınaq göstərişidir; dəyişikliklər hal-hazırda qeyd edilməmişdir!'''",
+'previewnote' => '<strong>Unutmayın ki, bu yalnız sınaq göstərişidir.</strong> Dəyişiklikləriniz hal-hazırda qeyd edilməmişdir!',
 'previewconflict' => 'Bu sınaq göstərişidir və yaddaşda saxlayacağınız təqdirdə mətnin redaktə səhifəsinin yuxarı hissəsində nəticənin necə olacağını göstərir.',
 'session_fail_preview' => "'''Üzr istəyirik! Sizin redaktəniz saxlanılmadı. Serverdə identifikasiyanızla bağlı problemlər yaranmışdır. Lütfən bir daha təkrar edin. Problem həll olunmazsa hesabınızdan çıxın və yenidən daxil olun.'''",
 'editing' => 'Redaktə $1',
@@ -818,6 +818,7 @@ Belə ki, bu adda səhifə artıq mövcuddur.',
 'post-expand-template-inclusion-warning' => "'''DİQQƏT!''' Daxil edilən şablonların həcmi həddindən artıq böyükdür.
 Bəzi şablonlar əlavə olunmayacaq.",
 'post-expand-template-inclusion-category' => 'Şablonun daxil olduğu səhifələrin ölçüsü böyükdür.',
+'post-expand-template-argument-warning' => '<strong>Diqqət:</strong> bu səhifədə açılma ölçüsü həddən artıq böyük olan ən azı bir şablon arqumenti var. Həmin arqumentlər buraxılıb.',
 'post-expand-template-argument-category' => 'Şablonlarda buraxılmış arqumentlərin mövcud olduğu səhifələr',
 'parser-template-loop-warning' => '[[$1]]: Şablonda düyün tapıldı',
 'parser-template-recursion-depth-warning' => '($1) Şablonda dərinlik limiti keçildi',
@@ -843,7 +844,7 @@ $3 tərəfindən verilən səbəb ''$2''",
 'revision-info' => '$2 tərəfindən yaradılmış $1 tarixli dəyişiklik',
 'previousrevision' => '←Əvvəlki versiya',
 'nextrevision' => 'Sonrakı versiya→',
-'currentrevisionlink' => 'Hal-hazırkı versiyanı göstər',
+'currentrevisionlink' => 'Hal-hazırkı versiya',
 'cur' => 'hh',
 'next' => 'sonrakı',
 'last' => 'son',
@@ -862,7 +863,7 @@ Açıqlama: <strong>({{int:cur}})</strong> = hal-hazırkı versiya ilə olan fə
 # Revision feed
 'history-feed-title' => 'Redaktə tarixçəsi',
 'history-feed-description' => 'Vikidə bu səhifənin dəyişikliklər tarixçəsi',
-'history-feed-item-nocomment' => '$1-dən $2-yə',
+'history-feed-item-nocomment' => '$1 $2-də',
 'history-feed-empty' => 'Axtardığınız səhifə mövcud deyil.
 Çox guman ki, bu səhifə silinib və ya onun adı dəyişdirilib.
 Vikidə buna bənzər səhifələri [[Special:Search|axtarmağa]] cəhd edin.',
@@ -994,7 +995,7 @@ $1",
 'search-interwiki-more' => '(yenə)',
 'search-relatedarticle' => 'əlaqədar',
 'searcheverything-enable' => 'Ad aralığında axtar:',
-'searchrelated' => 'əlaqədar',
+'searchrelated' => 'əlaqəli',
 'searchall' => 'bütün',
 'showingresults' => "Aşağıda #'''$2''' ilə başlayan {{PLURAL:$1|'''$1'''-ə qədər}} nəticə göstərilib.",
 'showingresultsnum' => "Aşağıda #'''$2''' ilə başlayan {{PLURAL:$3|'''$3'''}} nəticə göstərilib.",
@@ -1071,7 +1072,7 @@ $1",
 'prefs-custom-js' => 'Xüsusi JavaScript',
 'prefs-common-css-js' => 'Bütün skinlər üçün ümumi CSS/JavaScript:',
 'prefs-emailconfirm-label' => 'E-poçtun təsdiqlənməsi:',
-'youremail' => 'E-məktub *',
+'youremail' => 'E-məktub:',
 'username' => 'İstifadəçi adı:',
 'uid' => 'İstifadəçi ID:',
 'prefs-memberingroups' => 'Üzvü olduğu {{PLURAL:$1|qrup|qrup}}:',
@@ -1093,8 +1094,8 @@ HTML kodu yoxla.',
 'prefs-help-realname' => 'Həqiqi adınızı daxil etmək məcburi deyil.
 Bu seçimi etdiyiniz halda, adınız redaktələrinizə görə müəlliflik hüququnuzun tanınması üçün istifadə ediləcək.',
 'prefs-help-email' => 'E-poçt ünvanınızı daxil etmək məcburi deyil.
-Bu parolunuzu unutduğunuz halda Sizə yeni parol göndərməyə imkan verir.
-Həmçinin kimliyinizi gostərmədən belə, başqalarının sizinlə istifadəçi və ya istifadəçi müzakirəsi səhifələriniz vasitəsi ilə əlaqə yaratmalarını seçə bilərsiniz.',
+Bu, parolunuzu unutduğunuz halda, sizə yeni parol göndərməyə imkan verir.',
+'prefs-help-email-others' => 'Həmçinin, istifadəçi və ya müzakirə səhifənizdəki link vasitəsilə başqa istifadəçilərin sizinlə əlaqə yaratmasını seçə bilərsiniz. Bu halda sizin e-poçt ünvanınız heç kimə görünməyəcək.',
 'prefs-help-email-required' => 'Elektron ünvan tələb olunur.',
 'prefs-info' => 'Əsas məlumatlar',
 'prefs-i18n' => 'Beynəlxalqlaşdırma',
@@ -1267,18 +1268,18 @@ Həmçinin kimliyinizi gostərmədən belə, başqalarının sizinlə istifadə
 'recentchanges-label-bot' => 'Bu redaktə bot tərəfindən edilmişdir',
 'recentchanges-label-unpatrolled' => 'Bu redaktə hələ nəzərdən keçirilməmişdir',
 'recentchanges-legend-newpage' => '$1 - yeni səhifə',
-'rcnotefrom' => "Aşağıda '''$2'''-dən ('''$1'''-ə qədər) dəyişikliklər sadalanmışdır.",
+'rcnotefrom' => 'Aşağıda <strong>$2</strong>-dən bu yana olan dəyişikliklər göstərilib (<strong>$1</strong>-dən çox olmayaraq).',
 'rclistfrom' => '$1 vaxtından başlayaraq yeni dəyişiklikləri göstər',
 'rcshowhideminor' => 'Kiçik redaktələri $1',
 'rcshowhidebots' => 'Botları $1',
 'rcshowhideliu' => 'Qeydiyyatlı istifadəçiləri $1',
 'rcshowhideanons' => 'Anonim istifadəçiləri $1',
-'rcshowhidepatr' => 'Nəzarət edilən redaktələri $1',
+'rcshowhidepatr' => 'Yoxlanılmış redaktələri $1',
 'rcshowhidemine' => 'Mənim redaktələrimi $1',
 'rclinks' => 'Son $2 gün ərzindəki son $1 dəyişikliyi göstər <br />$3',
 'diff' => 'fərq',
 'hist' => 'tarixçə',
-'hide' => 'Gizlət',
+'hide' => 'Gizlə',
 'show' => 'Göstər',
 'minoreditletter' => 'k',
 'newpageletter' => 'Y',
@@ -1327,7 +1328,7 @@ Məqaləyə fayl yerləşdirmək üçün aşağıdaki formalardan birini istifad
 'upload-preferred' => 'İcazə verilən fayl tipləri: $1.',
 'upload-prohibited' => 'İcazə verilməyən fayl tipləri: $1.',
 'uploadlog' => 'yükləmə qeydi',
-'uploadlogpage' => 'Yükləmə qeydi',
+'uploadlogpage' => 'Yükləmə qeydləri',
 'uploadlogpagetext' => 'Aşağıda ən yeni yükləmə jurnal qeydləri verilmişdir.',
 'filename' => 'Fayl adı',
 'filedesc' => 'Xülasə',
@@ -1361,7 +1362,7 @@ Lütfən <strong>[[:$1]]</strong> keçidini yoxlayın və bu faylı yükləmək
 [[$1|thumb]]',
 'uploadwarning' => 'Yükləmə xəbərdarlığı',
 'savefile' => 'Faylı qeyd et',
-'uploadedimage' => 'yükləndi "[[$1]]"',
+'uploadedimage' => '"[[$1]]" yükləndi',
 'overwroteimage' => '"[[$1]]"-in yeni versiyası yükləndi',
 'uploaddisabled' => 'Yükləmə baş tutmadı',
 'copyuploaddisabled' => 'URL-dən yükləmə baş tutmadı.',
@@ -1459,7 +1460,7 @@ $1',
 'filehist-help' => 'Faylın əvvəlki versiyasını görmək üçün gün/tarix bölməsindəki tarixləri tıqlayın.',
 'filehist-deleteall' => 'hamısını sil',
 'filehist-deleteone' => 'sil',
-'filehist-revert' => 'əvvəlki vəziyyətinə',
+'filehist-revert' => 'geri qaytar',
 'filehist-current' => 'indiki',
 'filehist-datetime' => 'Tarix/Vaxt',
 'filehist-thumb' => 'Kiçik şəkil',
@@ -1475,9 +1476,11 @@ $1',
 'nolinkstoimage' => 'Bu fayla keçid verən səhifə yoxdur.',
 'linkstoimage-redirect' => '$1 (fayl istiqamətləndirilir) $2',
 'sharedupload' => 'Bu fayl $1-dandır və ola bilsin ki, başqa layihələrdə də istifadə edilir.',
+'sharedupload-desc-here' => 'Bu fayl $1dandır və başqa layihələrdə də istifadə edilə bilər.
+Faylın [$2 təsvir səhifəsindəki] məlumat aşağıda göstərilib.',
 'uploadnewversion-linktext' => 'Bu faylın yeni versiyasını yüklə',
 'shared-repo-from' => '$1-dən',
-'shared-repo' => 'ümumi anbar',
+'shared-repo' => 'ümumi fayl anbarı',
 'shared-repo-name-wikimediacommons' => 'Wikimedia Commons',
 
 # File reversion
@@ -1697,7 +1700,7 @@ Fərdi hüquqlar haqqında əlavə məlumatı [[{{MediaWiki:Listgrouprights-help
 'listgrouprights-group' => 'Qrup',
 'listgrouprights-rights' => 'Hüquqlar',
 'listgrouprights-helppage' => 'Help:Qrup hüquqları',
-'listgrouprights-members' => '(üzvləri)',
+'listgrouprights-members' => '(üzvlər)',
 'listgrouprights-right-display' => '<span class="listgrouprights-granted">$1 <code>($2)</code></span>',
 'listgrouprights-right-revoked' => '<span class="listgrouprights-revoked">$1 <code>($2)</code></span>',
 'listgrouprights-addgroup' => '{{PLURAL:$2|Qrupu}} əlavə et: $1',
@@ -1711,7 +1714,7 @@ Fərdi hüquqlar haqqında əlavə məlumatı [[{{MediaWiki:Listgrouprights-help
 
 # Email user
 'mailnologin' => 'Ünvan yoxdur',
-'emailuser' => 'İstifadəçiyə e-məktub yolla',
+'emailuser' => 'İstifadəçiyə e-məktub göndər',
 'emailpage' => 'İstifadəçiyə e-məktub yolla',
 'usermailererror' => 'Elektron poçtla məlumat göndərilən zaman xəta baş vermişdir:',
 'defemailsubject' => '"$1" adlı istifadəçidən {{SITENAME}} e-məktubu',
@@ -1739,7 +1742,7 @@ Fərdi hüquqlar haqqında əlavə məlumatı [[{{MediaWiki:Listgrouprights-help
 'usermessage-template' => 'MediaWiki:İstifadəçi müzakirəsi',
 
 # Watchlist
-'watchlist' => 'İzlədiyim səhifələr',
+'watchlist' => 'İzləmə siyahısı',
 'mywatchlist' => 'İzləmə siyahısı',
 'watchlistfor2' => '$1 $2 üçün',
 'nowatchlist' => 'İzləmə siyahınız böşdur.',
@@ -1756,7 +1759,7 @@ Fərdi hüquqlar haqqında əlavə məlumatı [[{{MediaWiki:Listgrouprights-help
 'unwatchthispage' => 'İzləmə',
 'notanarticle' => 'Səhifə boşdur',
 'notvisiblerev' => 'Başqa istifadıçinin son dəyişikliyi silinib',
-'watchlist-details' => 'Müzakirə səhifələrini çıxmaq şərtilə {{PLURAL:$1|$1 səhifəni|$1 səhifəni}} izləyirsiniz.',
+'watchlist-details' => 'İzləmə siyahınızda, müzakirə səhifələrini çıxmaq şərtilə, {{PLURAL:$1|$1 səhifə|$1 səhifə}} var.',
 'wlheader-enotif' => ' E-məktubla bildiriş aktivdir.',
 'wlheader-showupdated' => "Son ziyarətinizdən sonra edilən dəyişikliklər '''qalın şriftlərlə''' göstərilmişdir.",
 'watchmethod-recent' => 'yeni dəyişikliklər izlənilən səhifələr üçün yoxlanılır',
@@ -1764,7 +1767,7 @@ Fərdi hüquqlar haqqında əlavə məlumatı [[{{MediaWiki:Listgrouprights-help
 'watchlistcontains' => 'İzləmə siyahınızda $1 {{PLURAL:$1|səhifə|səhifə}} var.',
 'iteminvalidname' => "'$1' ilə bağlı problem, adı düzgün deyil...",
 'wlshowlast' => 'Bunları göstər: son $1 saatı $2 günü $3',
-'watchlist-options' => 'İzlədiyim səhifələrin nizamlamaları',
+'watchlist-options' => 'İzləmə siyahısının nizamlamaları',
 
 # Displayed when you click the "watch" button and it is in the process of watching
 'watching' => 'İzlənilir...',
@@ -1844,7 +1847,7 @@ Sonuncu silinmələrə bax: $2.',
 
 # Protect
 'protectlogpage' => 'Mühafizə etmə qeydləri',
-'protectedarticle' => 'mühafizə edildi "[[$1]]"',
+'protectedarticle' => '"[[$1]]" səhifəsi mühafizə edildi',
 'modifiedarticleprotection' => '"[[$1]]" səhifəsi üçün mühafizə səviyyəsi dəyişildi',
 'unprotectedarticle' => 'mühafizə kənarlaşdırıldı "[[$1]]"',
 'protect-title' => '"$1" üçün mühafizə səviyyəsinin dəyişdirilməsi',
@@ -1945,9 +1948,9 @@ $1',
 'contributions' => '{{GENDER:$1|İstifadəçinin}} fəaliyyəti',
 'contributions-title' => '$1 istifadəçi fəaliyyətləri',
 'mycontris' => 'Fəaliyyətim',
-'contribsub2' => '$1 ($2)',
+'contribsub2' => '{{GENDER:$3|$1}} ($2) adlı istifadəçinin fəaliyyəti',
 'nocontribs' => 'Bu kriteriyaya uyğun redaktələr tapılmadı',
-'uctop' => '(son)',
+'uctop' => '(hal-hazırkı)',
 'month' => 'Ay',
 'year' => 'Axtarışa bu tarixdən etibarən başla:',
 
@@ -1966,7 +1969,7 @@ Bloklama qeydlərinin sonuncusu aşağıda göstərilmişdir:',
 Bloklama qeydlərinin sonuncusu aşağıda göstərilmişdir:',
 'sp-contributions-search' => 'Fəaliyyətləri axtar',
 'sp-contributions-username' => 'IP-ünvanı və ya istifadəçi adı:',
-'sp-contributions-toponly' => 'Yalnız ən son dəyişiklikləri göstər',
+'sp-contributions-toponly' => 'Son redaktə olan dəyişiklikləri göstər',
 'sp-contributions-submit' => 'Axtar',
 
 # What links here
@@ -1974,7 +1977,7 @@ Bloklama qeydlərinin sonuncusu aşağıda göstərilmişdir:',
 'whatlinkshere-title' => '"$1" məqaləsinə keçid verən səhifələr',
 'whatlinkshere-page' => 'Səhifə:',
 'linkshere' => "'''[[:$1]]''' səhifəsinə istinad edən səhifələr:",
-'nolinkshere' => "'''[[:$1]]''' səhifəsinə keçid verən səhifə yoxdur.",
+'nolinkshere' => '<strong>[[:$1]]</strong> səhifəsinə keçid verən səhifə yoxdur.',
 'nolinkshere-ns' => "Seçilmiş ad aralığında heç bir səhifə '''[[:$1]]''' səhifəsinə keçid vermir.",
 'isredirect' => 'İstiqamətləndirmə səhifəsi',
 'istemplate' => 'daxil olmuş',
@@ -2068,13 +2071,13 @@ $1 adlı istifadəçinin bloklanma səbəbi: "$2"',
 'blocklog-showlog' => 'Bu istifadəçi daha əvvəl bloklanmışdır. Bloklama gündəliyi referans üçün aşağıda göstərilib:',
 'blocklog-showsuppresslog' => 'Bu istifadəçi daha əvvəl bloklanmışdır. Bloklama gündəliyi referans üçün aşağıda göstərilib:',
 'blocklogentry' => 'tərəfindən [[$1]] bloklandı, blok müddəti: $2 $3',
-'reblock-logentry' => '[[$1]] üçün son tarixi $2 $3 olmaq üzərə blok parametrləri dəyişdirildi',
+'reblock-logentry' => '[[$1]] üçün bloklama parametrlərini, başa çatma tarixi $2 $3 olmaqla, dəyişdirdi',
 'blocklogtext' => 'İstifadəçilərin bloklanması və blokun götürülməsi siyahısı.
 Avtomatik bloklanmış IP-ünvanlar burada göstərilmir.
 Hal-hazırkı [[Special:BlockList|qadağaların və bloklamaların siyahısı]]na bax.',
 'unblocklogentry' => '$1 üzərindəki blok götürüldü',
 'block-log-flags-anononly' => 'yalnız qeydiyyatsız istifadəçilər',
-'block-log-flags-nocreate' => 'Yeni hesab yaratma bloklanıb',
+'block-log-flags-nocreate' => 'yeni hesab yaratma bloklanıb',
 'block-log-flags-noautoblock' => 'avtobloklama qeyri-mümkündür',
 'block-log-flags-noemail' => 'E-mail bloklanıb',
 'block-log-flags-nousertalk' => 'Müzakirə səhifəsini redaktə edə bilməz.',
@@ -2246,7 +2249,7 @@ Zəhmət olmasa başqa ad seçin.',
 'tooltip-ca-unprotect' => 'Bu səhifənin mühafizəsini kənarlaşdır',
 'tooltip-ca-delete' => 'Bu səhifəni sil',
 'tooltip-ca-undelete' => 'Bu səhifəni silinmədən əvvəlki halına qaytarın',
-'tooltip-ca-move' => 'Bu səhifənin adını dəyiş',
+'tooltip-ca-move' => 'Səhifənin adını dəyiş',
 'tooltip-ca-watch' => 'Bu səhifəni izlə',
 'tooltip-ca-unwatch' => 'Bu səhifənin izlənməsini bitir',
 'tooltip-search' => '{{SITENAME}} səhifəsində axtar',
@@ -2797,7 +2800,7 @@ Variants for Chinese language
 
 # 'all' in various places, this might be different for inflected languages
 'watchlistall2' => 'hamısını',
-'namespacesall' => 'bütün',
+'namespacesall' => 'hamısı',
 'monthsall' => 'hamısı',
 
 # Email address confirmation
@@ -2872,11 +2875,11 @@ Variants for Chinese language
 # Watchlist editing tools
 'watchlisttools-view' => 'Siyahıdakı səhifələrdə edilən dəyişikliklər',
 'watchlisttools-edit' => 'İzlədiyim səhifələri göstər və redaktə et',
-'watchlisttools-raw' => 'Mətn kimi redaktə et',
+'watchlisttools-raw' => 'Adi mətn kimi redaktə et',
 
 # Core parser functions
 'unknown_extension_tag' => '"$1" Naməlum ayırma teqi',
-'duplicate-defaultsort' => '\'\'\'Diqqət:\'\'\' Ehtimal edilən "$2" klassifikasiya açarı əvvəlki "$1" klassifikasiya açarını keçərsiz edir.',
+'duplicate-defaultsort' => '<strong>Diqqət:</strong> Susmaya görə "$2" çeşidləmə açarı susmaya görə əvvəlki "$1" çeşidləmə açarını inkar edir.',
 
 # Special:Version
 'version' => 'Versiya',
@@ -2928,6 +2931,16 @@ Variants for Chinese language
 'blankpage' => 'Boş səhifə',
 'intentionallyblankpage' => 'Bu səhifə xüsusilə boşdur.',
 
+# External image whitelist
+'external_image_whitelist' => ' #Bu sətiri olduğu kimi saxlayın<pre>
+#Burada ardıcıl ifadələrin fraqmentlərini yerləşdirin (// simvolları arasında yerləşən hissələri).
+#Onlar kənar şəkillərin URL ünvanları ilə tutuşdurulacaq.
+#Uyğun gələnlər şəkil kimi, yerdə qalanlar isə şəkillərə keçid kimi göstəriləcək.
+#Sətirlərdən # simvolu ilə başlayanlar şərh hesab ediləcək.
+#Sətirlər böyük-kiçik şriftə həsass deyillər.
+
+#Ardıcıl ifadələrin fraqmentlərini bu sətirdən yuxarıda yerləşdirin. Bu sətiri olduğu kimi saxlayın.</pre>',
+
 # Special:Tags
 'tags' => 'Mümkün dəyişiklik etiketləri',
 'tag-filter' => '[[Special:Tags|Etiket]] süzgəci:',
index 60445cb..54aee58 100644 (file)
@@ -1351,7 +1351,7 @@ $1",
 'recentchanges-legend-newpage' => '$1 - новая старонка',
 'rcnotefrom' => 'Ніжэй знаходзяцца змены з <b>$2</b> (паказана не больш чым <b>$1</b>).',
 'rclistfrom' => 'Паказаць змены з $1',
-'rcshowhideminor' => '$1 Ð´Ñ\80обнÑ\8bÑ\85 Ð¿Ñ\80авак',
+'rcshowhideminor' => '$1 Ð´Ñ\80обнÑ\8bÑ\8f Ð¿Ñ\80аÑ\9eкÑ\96',
 'rcshowhideminor-hide' => 'Схаваць',
 'rcshowhidebots' => '$1 робатаў',
 'rcshowhidebots-show' => 'Паказаць',
@@ -1362,10 +1362,10 @@ $1",
 'rcshowhideanons' => '$1 ананімных удзельнікаў',
 'rcshowhideanons-show' => 'Паказаць',
 'rcshowhideanons-hide' => 'Схаваць',
-'rcshowhidepatr' => '$1 Ñ\83Ñ\85валенÑ\8bÑ\85 Ð¿Ñ\80авак',
+'rcshowhidepatr' => '$1 Ñ\83Ñ\85валенÑ\8bÑ\8f Ð¿Ñ\80аÑ\9eкÑ\96',
 'rcshowhidepatr-show' => 'Паказаць',
 'rcshowhidepatr-hide' => 'Схаваць',
-'rcshowhidemine' => '$1 Ñ\9eлаÑ\81нÑ\8bÑ\85 Ð¿Ñ\80авак',
+'rcshowhidemine' => '$1 Ñ\83лаÑ\81нÑ\8bÑ\8f Ð¿Ñ\80аÑ\9eкÑ\96',
 'rcshowhidemine-show' => 'Паказаць',
 'rcshowhidemine-hide' => 'Схаваць',
 'rclinks' => 'Паказаць апошнія $1 змен за мінулыя $2 дзён<br />$3',
@@ -1382,7 +1382,7 @@ $1",
 'rc-change-size-new' => '$1 {{PLURAL:$1|байт|байта|байтаў}} пасля змены',
 'newsectionsummary' => '/* $1 */ новы падраздзел',
 'rc-enhanced-expand' => 'Паказаць падрабязнасці',
-'rc-enhanced-hide' => 'Не паказваць падрабязнасцяў',
+'rc-enhanced-hide' => 'Не паказваць падрабязнасцей',
 
 # Recent changes linked
 'recentchangeslinked' => 'Звязаныя праўкі',
index be8fcaa..2d3298d 100644 (file)
@@ -1214,6 +1214,8 @@ $2
 'revdelete-show-file-submit' => 'Так',
 'revdelete-selected' => "'''{{PLURAL:$2|1=Выбраная вэрсія|Выбраныя вэрсіі}} старонкі [[:$1]]:'''",
 'logdelete-selected' => "'''{{PLURAL:$1|1=Выбраны запіс|Выбраныя запісы}} журнала:'''",
+'revdelete-text-text' => 'Выдаленыя вэрсіі будуць па-ранейшаму бачныя ў гісторыі старонкі, але некаторыя часткі іх зьместу будуць недаступныя для ўдзельнікаў.',
+'revdelete-text-file' => 'Выдаленыя вэрсіі файла будуць па-ранейшаму бачныя ў гісторыі старонкі, але часткі іх зьместу будуць недаступныя для ўдзельнікаў.',
 'revdelete-confirm' => 'Калі ласка, пацьвердзіце, што Вы сапраўды жадаеце зрабіць гэта, разумееце наступствы і робіце гэта ў адпаведнасьці з [[{{MediaWiki:Policy-url}}|правіламі]].',
 'revdelete-suppress-text' => "Скрываньне можа выкарыстоўвацца '''толькі''' ў наступных выпадках:
 * патэнцыйна паклёпніцкая інфармацыя
index 976d028..e769e62 100644 (file)
@@ -521,6 +521,8 @@ $1 རྒྱུ་རྐྱེན་འདི་འོག་དོ་དམ་
 'rev-delundel' => 'སྟོན། / སྦས།',
 'rev-showdeleted' => 'སྟོན།',
 'revdelete-show-file-submit' => 'ཡིན།',
+'logdelete-text' => 'སུབས་ཚར་པའི་ཐོ་འགོད་རྣམས་ད་དུང་ཡང་ཐོ་འགོད་རེའུ་མིག་ནང་འཆར་འདུག། ཡིན་ན་འང་ནང་དོན་ཆ་ཤས་རྣམས་ལ་ཚོགས་མི་གཞན་གྱི་འཛུལ་ཞུགས་བྱེད་མི་ཐུབ།',
+'revdelete-text-others' => 'ནང་དོན་ལ་ཁ་སྣོན་གྱི་བཀག་སྡོམས་བྱས་ན་མ་གཏོགས།{{SITENAME}}ནང་ཡོད་པའི་དོ་དམ་པ་གཞན་རྣམས་ནས་སྦས་སྐུང་བྱས་པའི་ནང་དོན་ལ་ད་དུང་ཡང་འཛུལ་ཞུགས་བྱེད་ལ། མ་ཟད་བསྐྱར་དུ་མི་བསུབས་པ་འཟོ་ཐུབ།',
 'revdelete-radio-same' => 'བཟོ་བཅོས་མ་བྱེད།',
 'revdelete-radio-set' => 'མངོན་མེད་ཀྱི།',
 'revdel-restore' => 'བཅོས་སུ་རུང་བ།',
index 78659e6..d23f8b9 100644 (file)
@@ -812,6 +812,8 @@ Molimo Vas da sačekate $1 prije nego što pokušate ponovo.',
 'suspicious-userlogout' => 'Vaš zahtjev za odjavu je odbijen jer je poslan preko pokvarenog preglednika ili keširanog proksija.',
 'createacct-another-realname-tip' => 'Pravo ime nije obavezno.
 Ako izaberete da date ime, biće korišteno za pripisivanje za vaš rad.',
+'pt-login-button' => 'Prijavi me',
+'pt-createaccount' => 'Napravi korisnički račun',
 
 # Email sending
 'php-mail-error-unknown' => 'Nepoznata greška u PHP funkciji mail()',
index 86be5e5..0d10bc3 100644 (file)
@@ -694,7 +694,7 @@ URL язъеш гӀалат даьлла хила мега.
 'viewsource-title' => 'Агӏона $1 дуьххьарлера йозане хьажар',
 'actionthrottled' => 'Сиххалин доза тохар',
 'actionthrottledtext' => 'Спам цахилийта хӀара дешдерг кӀезиг хенахь дукху ца дайта дихкина ду. Дехар до массийта минот яьлча гӀорта.',
-'protectedpagetext' => 'ХӀара агӀо дӀакъойлина йу рé цадаккхийта.',
+'protectedpagetext' => 'ХӀара агӀо дӀакъоьвлина ю тадарш ца дайта.',
 'viewsourcetext' => 'Хьоьга далундерг хьажар а дезахь хlокху агlон чура йоза хьаэцар:',
 'viewyourtext' => "Хьан йиш ю '''хьой нисдинчу''' дӀадолалун йозе хьажа а цуна копи ян а:",
 'protectedinterface' => 'ХӀара схьгайтарна гӀирса хаамаш латтош йолу агӀо ю. Куьйгалхошна бен иза хийца цало.',
index b433a4a..b2eaaeb 100644 (file)
@@ -904,6 +904,7 @@ Než to zkusíte znovu, musíte počkat na vypršení lhůty $1.',
 'createacct-another-realname-tip' => 'Skutečné jméno je nepovinné.
 Pokud se ho rozhodnete uvést, bude použito pro označení autorství vaší práce.',
 'pt-login' => 'Přihlášení',
+'pt-login-button' => 'Přihlásit se',
 'pt-createaccount' => 'Vytvoření účtu',
 'pt-userlogout' => 'Odhlásit se',
 
@@ -1316,6 +1317,10 @@ Můžete si toto porovnání prohlédnout; podrobnosti jsou uvedeny v [{{fullurl
 'revdelete-show-file-submit' => 'Ano',
 'revdelete-selected' => "'''{{PLURAL:$2|Vybraná|Vybrané}} revize stránky [[:$1]]:'''",
 'logdelete-selected' => "'''{{PLURAL:$1|Vybraná protokolovaná událost|Vybrané protokolované události}}:'''",
+'revdelete-text-text' => 'Smazané editace se budou i nadále zobrazovat v historii stránky, ale části jejich obsahu nebudou veřejně přístupné.',
+'revdelete-text-file' => 'Smazané verze souborů se budou i nadále zobrazovat v historii stránky, ale části jejich obsahu nebudou veřejně přístupné.',
+'logdelete-text' => 'Smazané protokolovací záznamy se budou i nadále zobrazovat v historii stránky, ale části jejich obsahu nebudou veřejně přístupné.',
+'revdelete-text-others' => 'Ostatní správci {{grammar:2sg|{{SITENAME}}}} budou i nadále moci ke skrytému obsahu přistupovat a mohou ho pomocí stejného rozhraní obnovit, pokud nejsou nastavena dodatečná omezení.',
 'revdelete-confirm' => 'Prosím potvrďte, že to opravdu chcete učinit, že si uvědomujete důsledky a že je to v souladu s [[{{MediaWiki:Policy-url}}|pravidly]].',
 'revdelete-suppress-text' => "Utajování by se mělo používat '''pouze''' v následujících případech:
 * Potenciálně pomlouvačné informace
index e457635..5b1774f 100644 (file)
@@ -69,6 +69,7 @@
  * @author Tischbeinahe
  * @author UV
  * @author Umherirrender
+ * @author Useopensource tobias
  * @author Vogone
  * @author W (aka Wuzur)
  * @author Wikifan
@@ -429,7 +430,7 @@ $messages = array(
 'tog-hideminor' => 'Kleine Änderungen in den „Letzten Änderungen“ ausblenden',
 'tog-hidepatrolled' => 'Kontrollierte Änderungen in den „Letzten Änderungen“ ausblenden',
 'tog-newpageshidepatrolled' => 'Kontrollierte Seiten bei den „Neuen Seiten“ ausblenden',
-'tog-extendwatchlist' => 'Erweiterte Beobachtungsliste zur Anzeige aller Änderungen',
+'tog-extendwatchlist' => 'Beobachtungsliste erweitern, um statt nur der letzten Änderung alle Änderungen anzuzeigen.',
 'tog-usenewrc' => 'Änderungen auf „Letzte Änderungen“ und Beobachtungsliste nach Seite gruppieren',
 'tog-numberheadings' => 'Überschriften automatisch nummerieren',
 'tog-showtoolbar' => 'Bearbeiten-Werkzeugleiste anzeigen',
@@ -1383,7 +1384,7 @@ Du kannst diesen Versionsunterschied einsehen, sofern du möchtest. Nähere Anga
 'revdelete-text-text' => 'Gelöschte Versionen verbleiben noch in der Versionsgeschichte, jedoch sind Teile ihres Inhalts für die Öffentlichkeit nicht zugänglich.',
 'revdelete-text-file' => 'Gelöschte Dateiversionen verbleiben noch in der Datei-Versionsgeschichte, jedoch sind Teile ihres Inhalts für die Öffentlichkeit nicht zugänglich.',
 'logdelete-text' => 'Gelöschte Logbucheinträge verbleiben noch in den Logbüchern, jedoch sind Teile ihres Inhalts für die Öffentlichkeit nicht zugänglich.',
-'revdelete-text-others' => 'Andere Administratoren auf {{SITENAME}} haben noch Zugriff auf den versteckten Inhalt und können ihn auch mithilfe dieser Spezialseite wiederherstellen, falls keine zusätzlichen Beschränkungen festgelegt wurden.',
+'revdelete-text-others' => 'Andere Administratoren auf {{SITENAME}} haben noch Zugriff auf den versteckten Inhalt und können ihn auch mithilfe dieser Spezialseite wiederherstellen, solange keine zusätzlichen Beschränkungen festgelegt werden.',
 'revdelete-confirm' => 'Bitte bestätige, dass du beabsichtigst, dies zu tun, die Konsequenzen verstehst und es in Übereinstimmung mit den [[{{MediaWiki:Policy-url}}|Richtlinien]] tust.',
 'revdelete-suppress-text' => "Unterdrückungen sollten '''nur''' in den folgenden Fällen vorgenommen werden:
 * Potentiell beleidigende Informationen
index 4b2e88c..4f0a35e 100644 (file)
@@ -4320,7 +4320,7 @@ satır ê ke pê ney # # destpêkenê zey mışore/mıjore muamele vineno.
 
 # Feedback
 'feedback-bugornote' => 'Jew mersela teferruato teknik esta şıma reca malumatê şıma hazıro se [ $1  jew xırab rapor] bıvinê.Zewbi zi, formê cerê xo rê şenê karfiyê. Vatışê xo pela da "[ $3  $2 ]", namey karber dê xoya piya u wasteriya karfiye.',
-'feedback-subject' => 'Mersel:',
+'feedback-subject' => 'Mewzu:',
 'feedback-message' => 'Mesac:',
 'feedback-cancel' => 'Bıtexelne',
 'feedback-submit' => 'Peyxeberdar Bırşe',
index 0929597..f293c95 100644 (file)
@@ -733,9 +733,9 @@ Al tō mudéfichi în MIA incòra stêdi salvêdi.",
 'editingold' => "<strong>Atèinti: a s'é drē mudifichêr 'na versiòun mìa arnuvêda 'd la pàgina.</strong> 
 S'es pèinsa ed salvêrla, tót i cambiamèint fât dōp cla mudéfica ché andrân pêrs.",
 'yourdiff' => 'Diferèinsi',
-'copyrightwarning' => "Per piaşèir tîn cûnt che tót al colaborasiòun a {{SITENAME}} a vînen cunsidrêdi publichêdi sòta la licèinsa $2 (per i particulêr guêrda $1). S' an 't vō mìa che i tō tèst a pôsen èser cambiê e turnê a publichêr da tót sèinsa lémit, an publichêri mìa ché.<br/> In pió, se 't  i póblich ché, a 't dichiâr, sòta la tó responsabilitê, che còl ch' è stê scrét a 't l'ê scrét té personalmèint opór l'é ste cupiê da documèint sèinsa ch' al sìa quacê da nisûn dirét 'd autōr. <strong> Ché insém an pubblichêr mìa materiêl quacê da dirét 'd autōr sèinsa autorişâsiòun! </strong>",
-'copyrightwarning2' => "Per piaşèir tîn cûnt che tót al colaborasiòun a {{SITENAME}} a pōlen èser mudifichê, arversê o scanşlê da êtra gînta cla dà 'na mân. S' an 't vō mìa che i tō tèst a pôsen èser cambiê alōra an publichêri mìa ché.<br/>In pió, se 't  i póblich ché, a 't dichiâr, sòta la tó responsabilitê, che còl ch' è stê scrét a 't l'ê scrét té personalmèint opór l'é ste cupiê da documèint sèinsa ch' al sìa quacê da nisûn dirét 'd autōr (per i particulêr guêrda $1). <strong> Ché insém an pubblichêr mìa materiêl quacê da dirét 'd autōr sèinsa autorişâsiòun! </strong>",
-'longpageerror' => "<strong> Erōr: al tèst spidî l'é lòngh {{PLURAL:$1|1|$1}} kilobyte, ch'l'é pió grôs ed l'amzûra mâsima permésa {{PLURAL:$2|1|$2}} kilobyte). </strong> Al tèst al pôl mìa èser salvê.",
+'copyrightwarning' => "Per piaşèir tîn cûnt che tót al colaborasiòun a {{SITENAME}} a vînen cunsidrêdi publichêdi sòta la licèinsa $2 (per i particulêr guêrda $1). S' an 't vō mìa che i tō tèst a pôsen èser cambiê e turnê a publichêr da tót sèinsa lémit, an publichêri mìa ché.<br /> In pió, se 't  i póblich ché, a 't dichiâr, sòta la tó responsabilitê, che còl ch' è stê scrét a 't l'ê scrét té personalmèint opór l'é ste cupiê da documèint sèinsa ch' al sìa quacê da nisûn dirét 'd autōr. <strong> Ché insém an pubblichêr mìa materiêl quacê da dirét 'd autōr sèinsa autorişâsiòun! </strong>",
+'copyrightwarning2' => "Per piaşèir tîn cûnt che tót al colaborasiòun a {{SITENAME}} a pōlen èser mudifichê, arversê o scanşlê da êtra gînta cla dà 'na mân. S' an 't vō mìa che i tō tèst a pôsen èser cambiê alōra an publichêri mìa ché.<br />In pió, se 't  i póblich ché, a 't dichiâr, sòta la tó responsabilitê, che còl ch' è stê scrét a 't l'ê scrét té personalmèint opór l'é ste cupiê da documèint sèinsa ch' al sìa quacê da nisûn dirét 'd autōr (per i particulêr guêrda $1). <strong> Ché insém an pubblichêr mìa materiêl quacê da dirét 'd autōr sèinsa autorişâsiòun! </strong>",
+'longpageerror' => "<strong> Erōr: al tèst spidî l'é lòngh {{PLURAL:$1|1|$1}} kilobyte, ch'l'é pió grôs ed l'amzûra mâsima permésa ({{PLURAL:$2|1|$2}} kilobyte). </strong> Al tèst al pôl mìa èser salvê.",
 'templatesused' => '{{PLURAL:$1|Mudèl druvê|Mudē druvê}} in cla pàgina ché:',
 'template-protected' => '(prutèt)',
 'template-semiprotected' => '(mèz-prutèt)',
index b038ab2..2f5279a 100644 (file)
@@ -509,7 +509,7 @@ $messages = array(
 'subcategories' => 'Subcategorías',
 'category-media-header' => 'Archivos multimedia en la categoría «$1»',
 'category-empty' => "''La categoría no contiene ninguna página o archivo.''",
-'hidden-categories' => '{{PLURAL:$1|Categoría escondida|Categorías escondidas}}',
+'hidden-categories' => '{{PLURAL:$1|Categoría oculta|Categorías ocultas}}',
 'hidden-category-category' => 'Categorías ocultas',
 'category-subcat-count' => '{{PLURAL:$2|Esta categoría solo contiene la siguiente subcategoría.|Esta categoría contiene {{PLURAL:$1|la siguiente subcategoría|las siguientes $1 subcategorías}}, de un total de $2.}}',
 'category-subcat-count-limited' => 'Esta categoría contiene {{PLURAL:$1|la siguiente subcategoría|las siguientes $1 subcategorías}}.',
@@ -679,7 +679,7 @@ $1',
 'site-rss-feed' => 'Canal RSS de $1',
 'site-atom-feed' => 'Canal Atom de $1',
 'page-rss-feed' => 'Canal RSS «$1»',
-'page-atom-feed' => 'Canal Atom «$1»',
+'page-atom-feed' => 'Canal Atom de «$1»',
 'red-link-title' => '$1 (la página no existe)',
 'sort-descending' => 'Orden descendente',
 'sort-ascending' => 'Orden ascendente',
@@ -3177,7 +3177,7 @@ No hay un directorio temporal.',
 'tooltip-pt-logout' => 'Salir de la sesión',
 'tooltip-ca-talk' => 'Discusión acerca del artículo',
 'tooltip-ca-edit' => 'Puedes editar esta página. Utiliza el botón de previsualización antes de guardar',
-'tooltip-ca-addsection' => 'Inicia una nueva sección',
+'tooltip-ca-addsection' => 'Iniciar una sección nueva',
 'tooltip-ca-viewsource' => 'Esta página está protegida.
 Puedes ver su código fuente',
 'tooltip-ca-history' => 'Versiones anteriores de esta página y sus autores',
@@ -3200,7 +3200,7 @@ Puedes ver su código fuente',
 'tooltip-n-randompage' => 'Cargar una página al azar',
 'tooltip-n-help' => 'El lugar para aprender',
 'tooltip-t-whatlinkshere' => 'Lista de todas las páginas del wiki que enlazan aquí',
-'tooltip-t-recentchangeslinked' => 'Cambios recientes en las páginas que enlazan con ésta',
+'tooltip-t-recentchangeslinked' => 'Cambios recientes en las páginas que enlazan con esta',
 'tooltip-feed-rss' => 'Sindicación RSS de esta página',
 'tooltip-feed-atom' => 'Sindicación Atom de esta página',
 'tooltip-t-contributions' => 'Lista de contribuciones de este usuario',
index 50d4fe9..648653b 100644 (file)
@@ -1006,7 +1006,8 @@ $2',
 'suspicious-userlogout' => 'درخواست شما برای خروج از سامانه رد شد زیرا به نظر می‌رسد که این درخواست توسط یک مرورگر معیوب یا پروکسی میانگیر ارسال شده باشد.',
 'createacct-another-realname-tip' => 'نام واقعی اختیاری است.
 اگر آن را وارد کنید هنگام ارجاع به آثارتان و انتساب آن‌ها به شما از نام واقعی‌تان استفاده خواهد شد.',
-'pt-login' => 'ورود به سامانه',
+'pt-login' => 'ورود',
+'pt-login-button' => 'ورود به سامانه',
 'pt-createaccount' => 'ایجاد حساب کاربری',
 'pt-userlogout' => 'خروج',
 
@@ -1564,7 +1565,7 @@ $1",
 'search-file-match' => '(تشابه محتوی پرونده)',
 'search-suggest' => 'آیا منظورتان این بود: $1',
 'search-interwiki-caption' => 'پروژه‌های خواهر',
-'search-interwiki-default' => '$1 نتیجه:',
+'search-interwiki-default' => 'نتایج از $1 :',
 'search-interwiki-more' => '(بیشتر)',
 'search-relatedarticle' => 'مرتبط',
 'searcheverything-enable' => 'جستجو در تمام فضاهای نام',
index b3d8e2c..07fea44 100644 (file)
@@ -917,7 +917,7 @@ $2',
 'createacct-another-realname-tip' => 'השם האמיתי הוא אופציונאלי.
 אם תבחרו לספקו, הוא ישמש לייחוס עבודת המשתמש אליו.',
 'pt-login' => 'כניסה לחשבון',
-'pt-login-button' => 'כניסה',
+'pt-login-button' => 'כניסה לחשבון',
 'pt-createaccount' => 'יצירת חשבון',
 'pt-userlogout' => 'יציאה מהחשבון',
 
@@ -1342,6 +1342,10 @@ $2
 'revdelete-show-file-submit' => 'כן',
 'revdelete-selected' => "'''ה{{PLURAL:$2|גרסה שנבחרה|גרסאות שנבחרו}} מתוך הדף [[:$1]]:'''",
 'logdelete-selected' => "'''{{PLURAL:$1|פעולת היומנים שנבחרה|פעולות היומנים שנבחרו}}:'''",
+'revdelete-text-text' => 'גרסאות שנמחקו עדיין תופענה בהיסטוריית הדף, אך חלקים מהתוכן שלהן לא יהיו זמינים לציבור.',
+'revdelete-text-file' => 'גרסאות קבצים שנמחקו עדיין תופענה בהיסטוריית הקובץ, אך חלקים מהתוכן שלהן לא יהיו זמינים לציבור.',
+'logdelete-text' => 'פעולות יומנים שנמחקו עדיין תופענה בדפי היומנים, אך חלקים מהתוכן שלהן לא יהיו זמינים לציבור.',
+'revdelete-text-others' => 'מפעילי מערכת אחרים באתר עדיין יוכלו לגשת לתוכן הנסתר ויוכלו לשחזר אותו שוב דרך הממשק הזה, אלא אם כן תוגדרנה הגבלות נוספות.',
 'revdelete-confirm' => 'אנא אשרו שזה אכן מה שאתם מתכוונים לעשות, שאתם מבינים את התוצאות של מעשה כזה, ושהמעשה מבוצע בהתאם ל[[{{MediaWiki:Policy-url}}|נוהלי האתר]].',
 'revdelete-suppress-text' => "יש להשתמש בהסתרה מלאה '''אך ורק''' במקרים הבאים:
 * מידע שעלול להיות לשון הרע
index b5efdb6..03931e2 100644 (file)
@@ -1084,6 +1084,10 @@ Móžeš sej tutón rozdźěl wobhladać; podrobnosće namakaš w [{{fullurl:{{#
 'revdelete-show-file-submit' => 'Haj',
 'revdelete-selected' => "'''{{PLURAL:$2|Wubrana wersija|Wubranej wersiji|Wubrane wersije|Wubranych wersijow}} wot [[:$1]]:'''",
 'logdelete-selected' => "'''{{PLURAL:$1|Wubrany zapisk z protokola|Wubranej zapiskaj z protokola|Wubrane zapiski z protokola|Wubrane zapiski z protokola}} za '''$1:''''''",
+'revdelete-text-text' => 'Zhašane wersije wostanu hišće we wersijowej historiji, ale dźěle jeje wobsaha njebudu přistupne zjawnosći.',
+'revdelete-text-file' => 'Zhašane datajowe wersije wostanu w datajowej historiji, ale dźěle jeje wobsaha njebudu přistupne zjawnosći.',
+'logdelete-text' => 'Zhašane protokolowe zapiski wostanu hišće w protokolach, ale dźěle jich wobsaha njebudu přistupne zjawnosći.',
+'revdelete-text-others' => 'Druzy administratorojo na {{GRAMMAR:lokatiw|{{SITENAME}}}} móža hišće na schowany wobsah přistup měć a móža jón zaso přez samsny wužiwarski powjerch wobnowić, chibazo su přidatne wobmjezowanja.',
 'revdelete-confirm' => 'Prošu potwjerdź, zo chceš to činić, zo rozumiš konsekwency a zo činiš to po [[{{MediaWiki:Policy-url}}|prawidłach]].',
 'revdelete-suppress-text' => "Potłóčenje dyrbjało so '''jenož''' za slědowace pady wužiwać:
 * Potencielnje křiwdźace informacije
index 171134f..d120a65 100644 (file)
@@ -590,6 +590,7 @@ Pangngaasi nga agurayka ti $1 sakbay a padasem manen.',
 'createacct-another-realname-tip' => 'Saan a nasken ti pudno a nagan.
 No kayatmo nga ited, mausarto daytoy para iti panangited ti pammadayaw para kadagiti obrada.',
 'pt-login' => 'Sumrek',
+'pt-login-button' => 'Sumrek',
 'pt-createaccount' => 'Agaramid ti pakabilangan',
 'pt-userlogout' => 'Rummuar',
 
@@ -1025,6 +1026,10 @@ awan ti naibaga a panagbaliw, wenno padpadasem nga ilemlemmeng ti agdama a panag
 'revdelete-show-file-submit' => 'Wen',
 'revdelete-selected' => "'''{{PLURAL:$2|Napili a nabaliwan|Dagiti napili a nabaliwan}} iti [[:$1]]:'''",
 'logdelete-selected' => "'''{{PLURAL:$1|Ti napili a listaan ti napasamak|Dagiti napili a listaan ti napasamak}}:'''",
+'revdelete-text-text' => 'Dagiti naikkat a rebision ket agparangto pay laeng iti panid ti pakasaritaan, ngem dagiti paset ti linaonda ket saanton a publiko a maserrekan.',
+'revdelete-text-file' => 'Dagiti naikkat a bersion ti papeles ket agparangto pay laeng iti pakasaritaan ti papeles, ngem dagiti paset ti linaonda ket saanton a publiko a maserrekan.',
+'logdelete-text' => 'Dagiti naikkat a listaan ti pasamak ket agparangto pay laeng kadagiti listaan, ngem dagiti paset ti linaonda ket saanton a publiko a maserrekan.',
+'revdelete-text-others' => 'Dagiti sabali nga administrador iti {{SITENAME}} ket mabalindanto pay laeng a maserrekan ti nailemmeng a linaon ken mabalindanto manen ti mangisubli ti pannakaikkat babaen iti daytoy nga isu met laeng nga interface, malaksid no adda dagiti maipatinayon a maisaad a panangigawid.',
 'revdelete-confirm' => 'Pangngaasi a pasingkedam a kayatmo nga aramiden daytoy, a maawatam dagiti pagbanagan, ket araramidem daytoy a segun iti [[{{MediaWiki:Policy-url}}|ti annuroten]].',
 'revdelete-suppress-text' => "Ti panagdepdep ket usaren '''laeng''' kadagiti sumaganad a kaso;
 * Makapataud ti libelo a pakaammo
@@ -1160,7 +1165,7 @@ Dagiti salaysay ket mabalin a mabirukan idiay [{{fullurl:{{#Special:Log}}/delete
 'search-file-match' => '(maipada ti linaon a papeles)',
 'search-suggest' => 'Daytoy kadi: $1',
 'search-interwiki-caption' => 'Dagiti kakabsat a gandat',
-'search-interwiki-default' => '$1 dagiti nagbanagan:',
+'search-interwiki-default' => 'Dagiti resulta manipud ti $1:',
 'search-interwiki-more' => '(adu pay)',
 'search-relatedarticle' => 'Mainaig',
 'searcheverything-enable' => 'Agbirukka kadagiti amin a nagan ti espasio',
index 2b92a13..ee5f8fc 100644 (file)
@@ -830,6 +830,7 @@ Attendi $1 e riprova in seguito.',
 'suspicious-userlogout' => 'La tua richiesta di disconnessione è stata negata perché sembra inviata da un browser non funzionante o un proxy di caching.',
 'createacct-another-realname-tip' => "L'indicazione del proprio nome vero è opzionale; se si sceglie di inserirlo, verrà utilizzato per attribuire la paternità dei contenuti inviati.",
 'pt-login' => 'Entra',
+'pt-login-button' => 'Entra',
 'pt-createaccount' => 'Registrati',
 'pt-userlogout' => 'Esci',
 
@@ -1238,6 +1239,10 @@ In quanto amministratore puoi visualizzare questo confronto di versioni; potrebb
 'revdelete-show-file-submit' => 'Sì',
 'revdelete-selected' => "'''{{PLURAL:$2|Versione selezionata|Versioni selezionate}} di [[:$1]]:'''",
 'logdelete-selected' => "'''{{PLURAL:$1|Evento del registro selezionato|Eventi del registro selezionati}}:'''",
+'revdelete-text-text' => 'Le versioni cancellate appariranno ancora nella cronologia della pagina, ma parti del loro contenuto sarà inaccessibile al pubblico.',
+'revdelete-text-file' => 'Le versioni di file cancellati appariranno ancora nella cronologia del file, ma parti del loro contenuto sarà inaccessibile al pubblico.',
+'logdelete-text' => 'Gli eventi cancellati appariranno ancora nei registri, ma parti del loro contenuto sarà inaccessibile al pubblico.',
+'revdelete-text-others' => 'Altri amministratori di {{SITENAME}} saranno ancora in grado di accedere ai contenuti nascosti e potranno ripristinarli nuovamente attraverso questa stessa interfaccia, se non sono state impostate restrizioni aggiuntive.',
 'revdelete-confirm' => 'Per favore conferma che questo è quanto intendi fare, che sei consapevole delle conseguenze, e che stai facendo questo nel rispetto delle [[{{MediaWiki:Policy-url}}|linee guida]].',
 'revdelete-suppress-text' => "La rimozione dovrebbe essere utilizzata '''unicamente''' nei seguenti casi:
 * informazioni potenzialmente diffamatorie
index e196d0f..a6d123e 100644 (file)
@@ -734,8 +734,8 @@ $1',
 'protectedpagetext' => 'Бұл бет өңдеу немесе басқа өзгерістер енгізілмес үшін қорғалған.',
 'viewsourcetext' => 'Бұл беттің қайнарын қарауыңызға және көшіріп алуыңызға болады:',
 'viewyourtext' => 'Осы бет арқылы "өзіңіз жасаған өңдеулердің" бастапқы мәтінін көруге және көшіруге мүмкіндігіңіз болады.',
-'protectedinterface' => 'Бұл MediaWiki-дің [[Уикипедия:Интерфейсті аудару|жүйе хабарламасы]], оны тек жоба [[Уикипедия:Әкімшілер|әкімшілер]] ғана өзгерте алады. 
-Кейбір хабарламалар [[translatewiki:{{FULLPAGENAME}}/qqq|құжаттамада]] [[mw:Manual:Interface/{{PAGENAME}}|бар]].',
+'protectedinterface' => 'This page provides interface text for the software on this wiki, and is protected to prevent abuse.
+To add or change translations for all wikis, please use [//translatewiki.net/ translatewiki.net], the MediaWiki localisation project.',
 'editinginterface' => "'''Ескерту:''' Бағдарламалық жасақтаманың тілдесу мәтінін жетістіретін бетін өңдеп жатырсыз.
 Бұл беттің өзгертуі басқа қатысушыларға пайдаланушылық тілдесуі қалай көрінетіне әсер етеді.
 Барлық уикилер үшін аудармаларды өзгерту немесе қосу үшін [//translatewiki.net/ translatewiki.net] МедиаУики жерлестіру жобасын пайдаланыңыз.",
@@ -1303,6 +1303,9 @@ $1",
 'showhideselectedversions' => 'Бөлектенген нұсқаларды көрсет/жасыр',
 'editundo' => 'жоққа шығару',
 'diff-empty' => '(айырмашылығы жоқ)',
+'diff-multi-sameuser' => '(Жоғарыда көрсетілген қатысушының (бір ғана қатысушының) арадағы {{PLURAL:$1|бір түзетуі|$1 түзетуі}} көрсетілмеген)',
+'diff-multi-otherusers' => '({{PLURAL:$2|басқа бір қатысуышының|$2 қатысушының}} арадағы {{PLURAL:$1|бір түзетуі|$1 түзетуі}} көрсетілмеген)',
+'diff-multi-manyusers' => '($2-(ден<sup>4</sup>) көп {{PLURAL:$2|қатысуышының|қатысушының}} арадағы {{PLURAL:$1|бір түзетуі|$1 түзетуі}} көрсетілмеген)',
 'difference-missing-revision' => 'Бұл ($1) {{PLURAL:$2|нұсқа|$2 нұсқалар}} айырмашылығы табылмады.
 
 
@@ -1882,14 +1885,14 @@ URL дұрыс екендігін және торап істеп тұрғаны
 'linkstoimage-redirect' => '$1 (файл айдатылуы) $2',
 'duplicatesoffile' => 'Келесі {{PLURAL:$1|файл бұл файлдың телнұсқасы|$1 файл бұл файлдың телнұсқалары}} ([[Special:FileDuplicateSearch/$2|толығырақ көру]]):',
 'sharedupload' => 'Бұл файл $1 жобасынан сондықтан басқа жобаларда қолдануы мүмкін.',
-'sharedupload-desc-there' => 'Бұл файл $1 жобасынан және сондықтан басқа жобаларда қолдануы мүмкін.
+'sharedupload-desc-there' => 'Бұл файл $1 жобасынан, сондықтан басқа жобаларда lf қолдануы мүмкін.
 Қосымша мәліметтер үшін [$2 файл сипаттама бетін] қараңыз.',
-'sharedupload-desc-here' => 'Бұл файл $1 жобасынан және сондықтан басқа жобаларда қолдануы мүмкін.
+'sharedupload-desc-here' => 'Бұл файл $1 жобасынан сондықтан басқа жобаларда қолдануы мүмкін.
 Бұның сипатамасы [$2 файл сипаттама беті] төменде көрсетілген.',
-'sharedupload-desc-edit' => 'Бұл файл $1 жобасынан және сондықтан басқа жобаларда қолдануы мүмкін.
-СипаÑ\82Ñ\82амаÑ\81Ñ\8bн Ó©Ò£Ð´ÐµÐ³Ñ\96Ò£Ñ\96з ÐºÐµÐ»Ñ\81е Ð¼Ò±Ð½Ð´Ð° [$2 Ñ\84айл Ñ\81ипаÑ\82Ñ\82ама Ð±ÐµÑ\82Ñ\96].',
-'sharedupload-desc-create' => 'Бұл файл $1 жобасынан және сондықтан басқа жобаларда қолдануы мүмкін.
-Сипаттамасын өңдегіңіз келсе мұнда [$2 файл сипаттама беті].',
+'sharedupload-desc-edit' => 'Бұл файл $1 жобасынан, сондықтан басқа жобаларда да қолдануы мүмкін.
+СипаÑ\82Ñ\82амаÑ\81Ñ\8bн Ó©Ò£Ð´ÐµÐ³Ñ\96Ò£Ñ\96з ÐºÐµÐ»Ñ\81е Ð¾Ð» [$2 Ñ\84айл Ñ\81ипаÑ\82Ñ\82ама Ð±ÐµÑ\82Ñ\96нде].',
+'sharedupload-desc-create' => 'Бұл файл $1 жобасынан, сондықтан басқа жобаларда да қолдануы мүмкін.
+Сипаттамасын өңдегіңіз келсе [$2 файл сипаттама бетіне] өтіңіз.',
 'filepage-nofile' => 'Бұл атаумен файл жоқ.',
 'filepage-nofile-link' => 'Бұл атаумен файл жоқ, бірақ сіз оны [$1 жүктей аласыз].',
 'uploadnewversion-linktext' => 'Бұл файлдың жаңа нұсқасын жүктеу',
@@ -2218,6 +2221,7 @@ URL дұрыс екендігін және торап істеп тұрғаны
 'watchmethod-list' => 'жуықтағы өзгерістер үшін бақылаулы беттерді тексеру',
 'watchlistcontains' => 'Бақылау тізіміңізде $1 бет бар.',
 'iteminvalidname' => "'$1' данада ақау бар — жарамсыз атау…",
+'wlnote2' => 'Төменде $2, $3 кезіне дейінгі соңғы {{PLURAL:$1|сағаттағы|<strong>$1</strong> сағаттағы}} өзгерістер көрсетілген.',
 'wlshowlast' => 'Соңғы $1 сағаттағы, $2 күндегі, $3 болған өзгерісті көрсету',
 'watchlist-options' => 'Бақылау тізімінің баптаулары',
 
index d6ffe20..f59ba71 100644 (file)
@@ -1142,6 +1142,7 @@ Dir kënnt dësen Ënnerscheed gesinn; Detailer fannt Dir am [{{fullurl:{{#Speci
 'revdelete-show-file-submit' => 'Jo',
 'revdelete-selected' => "'''{{PLURAL:$2|Gewielt Versioun|Gewielt Versioune}} vu(n) [[:$1]] :'''",
 'logdelete-selected' => "'''Ausgewielten {{PLURAL:$1|Evenement|Evenementer}} aus dem Logbuch:'''",
+'revdelete-text-others' => 'Aner Administrateuren op {{SITENAME}} kënnen nach ëmmer de verstoppten Inhalt gesinn an en iwwer deeselwechten Interface nees restauréieren, ausser wann zousätzlech Limitatiounen agestallt sinn.',
 'revdelete-confirm' => "Confirméiert w.e.g. datt Dir dat maache wëllt, datt Dir d'Konsequenze verstitt an datt Dir dëst an Aklang mat de [[{{MediaWiki:Policy-url}}|Richtlinne]] maacht.",
 'revdelete-suppress-text' => "Ënnerdréckung sollt '''nëmmen''' an dëse Fäll benotzt ginn:
 * Informatiounen déi beleidege kéinten
@@ -1603,7 +1604,7 @@ Dës Informatioun ass ëffentlech.",
 'recentchanges-legend-heading' => "'''Legend:'''",
 'recentchanges-legend-newpage' => '(kuckt och [[Special:NewPages|Lëscht vun den neie Säiten]])',
 'recentchanges-legend-plusminus' => "''(±123)''",
-'rcnotefrom' => "Ugewise ginn d'Ännerunge vum '''$2''' un (maximal '''$1''' Ännerunge gi gewisen).",
+'rcnotefrom' => "Ugewise ginn d'Ännerunge vum <strong>$2</strong> un (maximal <strong>$1</strong> Ännerunge gi gewisen).",
 'rclistfrom' => 'Nei Ännerunge vu(n) $1 u weisen',
 'rcshowhideminor' => 'Kleng Ännerunge $1',
 'rcshowhideminor-show' => 'Weisen',
@@ -2335,7 +2336,7 @@ E-Mail: $PAGEEDITOR_EMAIL
 Wiki: $PAGEEDITOR_WIKI
 
 Et gi soulaang keng weider Maile geschéckt, bis Dir d\'Säit nees emol besicht hutt wärend deem Dir ageloggt sidd.
-Op Ärer Iwwerwaachungslëscht kënnt Dir all Benoorichtigungsmarkeren zesummen zErécksetzen.
+Op Ärer Iwwerwaachungslëscht kënnt Dir all Benoorichtigungsmarkeren zesummen zrécksetzen.
 
 
 Äre frëndleche {{SITENAME}} Benoriichtigungssystem
@@ -2393,14 +2394,14 @@ D'Läsche vu sou Säite gouf limitéiert fir ongewollte Stéierungen op {{SITENA
 'delete-warning-toobig' => "Dës Säit huet eng laang Versiounsgeschicht, méi wéi $1 {{PLURAL:$1|Versioun|Versiounen}}.
 D'Läschen dovu kann zu Stéierungen am Fonctionnement vun {{SITENAME}} féieren;
 dës Aktioun soll mat Virsiicht gemaach ginn.",
-'deleting-backlinks-warning' => "'''Opgepasst:''' Aner Säite linken op déi Säit déi Dir am Gaang sidd ze läschen oder déi säit Déi Dir am Gaang sidd ze läschen ass an aner Säiten agebonn.",
+'deleting-backlinks-warning' => "'''Opgepasst:''' [[Special:WhatLinksHere/{{FULLPAGENAME}}|Aner Säite]] linken op déi Säit déi Dir am Gaang sidd ze läschen oder déi Säit Déi Dir am Gaang sidd ze läschen ass an aner Säiten agebonn.",
 
 # Rollback
 'rollback' => 'Ännerungen zrécksetzen',
 'rollback_short' => 'Zrécksetzen',
 'rollbacklink' => 'Zrécksetzen',
-'rollbacklinkcount' => '{{PLURAL:$1|Eng Ännerung|$1 Ännerungen}} zerécksetzen',
-'rollbacklinkcount-morethan' => 'méi wéi {{PLURAL:$1|Eng Ännerung|$1 Ännerungen}} zerécksetzen',
+'rollbacklinkcount' => '{{PLURAL:$1|Eng Ännerung|$1 Ännerungen}} zrécksetzen',
+'rollbacklinkcount-morethan' => 'méi wéi {{PLURAL:$1|Eng Ännerung|$1 Ännerungen}} zrécksetzen',
 'rollbackfailed' => 'Zrécksetzen huet net geklappt',
 'cantrollback' => 'Lescht Ännerung kann net zréckgesat ginn. De leschten Auteur ass deen eenzegen Auteur vun dëser Säit.',
 'alreadyrolled' => 'Déi lescht Ännerung vun der Säit [[:$1]] vum [[User:$2|$2]] ([[User talk:$2|talk]]{{int:pipe-separator}}[[Special:Contributions/$2|{{int:contribslink}}]]);; kann net zeréckgesat ginn;
index 3327e9b..b73e4a7 100644 (file)
@@ -22,6 +22,7 @@
  * @author Marozols
  * @author Papuass
  * @author Reedy
+ * @author Srolanh
  * @author Xil
  * @author Yyy
  * @author לערי ריינהארט
@@ -428,6 +429,7 @@ Lai pievienotu izmaiņas tulkojumā visās ''wiki'', lūdzam izmantot ''MediaWik
 'ns-specialprotected' => 'Nevar izmainīt īpašās lapas.',
 'titleprotected' => "Šī lapa ir aizsargāta pret izveidošanu. To aizsargāja [[User:$1|$1]].
 Norādītais iemesls bija ''$2''.",
+'exception-nologin' => 'Neesat pieslēdzies',
 
 # Virus scanner
 'virus-badscanner' => "Nekorekta konfigurācija: nezināms vīrusu skeneris: ''$1''",
@@ -548,9 +550,15 @@ Tādēļ šobrīd no šīs IP adreses vairs nevar izveidot jaunus kontus.',
 Lūdzu, uzgaidiet $1 pirms mēģiniet vēlreiz.',
 'login-abort-generic' => 'Jūsu pieteikšanās bija neveiksmīga — Darbība pārtraukta',
 'loginlanguagelabel' => 'Valoda: $1',
+'pt-login' => 'Pieslēgties',
+'pt-login-button' => 'Pieslēgties',
+'pt-createaccount' => 'Reģistrēties',
+'pt-userlogout' => 'Iziet',
 
 # Email sending
 'php-mail-error-unknown' => 'Nezināma kļūda PHP mail() funkcijā',
+'user-mail-no-addy' => 'Mēģināja sūtīt e-pastu bez e-pasta adreses.',
+'user-mail-no-body' => 'Mēģināja sūtīt e-pastu ar tukšu vai nepamatoti īsu pamata daļu.',
 
 # Change password dialog
 'changepassword' => 'Mainīt paroli',
@@ -596,6 +604,7 @@ Pagaidu parole: $2',
 'changeemail-cancel' => 'Atcelt',
 
 # Special:ResetTokens
+'resettokens-tokens' => 'Žetoni:',
 'resettokens-token-label' => '$1 (šībrīža vērtība: $2)',
 
 # Edit page toolbar
index 10b0361..721f280 100644 (file)
@@ -1338,6 +1338,10 @@ $3 ја наведе следнава причина: ''$2''",
 'revdelete-show-file-submit' => 'Да',
 'revdelete-selected' => "'''{{PLURAL:$2|Избрана ревизија|Избрани ревизии}} од [[:$1]]:'''",
 'logdelete-selected' => "'''{{PLURAL:$1|Одбран настан од дневник|Одбрани настани од дневник}}:'''",
+'revdelete-text-text' => 'Избришаните ревизии сепак се појавуваат во историјата, но делови од нивната содржина ќе бидат недостапни за јавноста.',
+'revdelete-text-file' => 'Избришаните верзии на податотеките сепак се појавуваат во нејзината историја, но делови од нивната содржина ќе бидат недостапни за јавноста.',
+'logdelete-text' => 'Избришаните дневнички ставки сепак се појавуваат во дневниците, но делови од нивната содржина ќе бидат недостапни за јавноста.',
+'revdelete-text-others' => 'Другите администратори на {{SITENAME}} сепак ќе имаат пристап до скриените содржини и ќе можат да го повратат избришаното преку овој ист посредник, доколку не ставите дополнителни ограничувања.',
 'revdelete-confirm' => 'Потврдете дека сакате да го направите ова, дека ги сфаќате последиците, и дека тоа го правите во согласност со [[{{MediaWiki:Policy-url}}|правилата]].',
 'revdelete-suppress-text' => "Притајувањето се користи '''само''' во следниве случаи:
 * Потенцијално клеветнички информации
index 7733256..eeb1f18 100644 (file)
@@ -887,6 +887,7 @@ $2',
 
 എങ്കിലും അങ്ങനെ ചെയ്താൽ, ഉപയോക്താക്കൾക്ക് അവരരവരുടെ പേരിൽ തന്നെ തങ്ങളുടെ സൃഷ്ടിക്ക് കടപ്പാട് ലഭിക്കുന്നതാണ്.',
 'pt-login' => 'പ്രവേശിക്കുക',
+'pt-login-button' => 'പ്രവേശിക്കുക',
 'pt-createaccount' => 'അംഗത്വമെടുക്കുക',
 'pt-userlogout' => 'ലോഗൗട്ട്',
 
@@ -1293,6 +1294,10 @@ $3 നൽകിയിരിക്കുന്ന കാരണം ''$2'' എന
 'revdelete-show-file-submit' => 'അതെ',
 'revdelete-selected' => "'''[[:$1]] എന്ന താളിന്റെ {{PLURAL:$2|തിരഞ്ഞെടുത്ത പതിപ്പ്|തിരഞ്ഞെടുത്ത പതിപ്പുകൾ}}:'''",
 'logdelete-selected' => "'''{{PLURAL:$1|തിരഞ്ഞെടുത്ത രേഖയിലുള്ളത്|തിരഞ്ഞെടുത്ത രേഖയിലുള്ളവ}}:'''",
+'revdelete-text-text' => 'മായ്ക്കപ്പെട്ട നാൾപ്പതിപ്പുകൾ താളിന്റെ നാൾവഴിയിൽ കാണാവുന്നതായിരിക്കുമെങ്കിലും, അവയുടെ ഉള്ളടക്കത്തിന്റെ ചില ഭാഗങ്ങൾ പൊതുജനങ്ങൾക്ക് ലഭ്യമായിരിക്കണമെന്നില്ല.',
+'revdelete-text-file' => 'പ്രമാണത്തിന്റെ മായ്ക്കപ്പെട്ട പതിപ്പുകൾ താളിന്റെ നാൾവഴിയിൽ കാണാവുന്നതായിരിക്കുമെങ്കിലും, അവയുടെ ഉള്ളടക്കത്തിന്റെ ചില ഭാഗങ്ങൾ പൊതുജനങ്ങൾക്ക് ലഭ്യമായിരിക്കണമെന്നില്ല.',
+'logdelete-text' => 'മായ്ക്കപ്പെട്ട പ്രവൃത്തികൾ പ്രവർത്തന രേഖകളിൽ കാണാവുന്നതായിരിക്കുമെങ്കിലും, അവയുടെ ഉള്ളടക്കത്തിന്റെ ചില ഭാഗങ്ങൾ പൊതുജനങ്ങൾക്ക് ലഭ്യമായിരിക്കണമെന്നില്ല.',
+'revdelete-text-others' => '{{SITENAME}} സംരംഭത്തിലെ മറ്റ് കാര്യനിർവ്വാഹകർക്ക് മറയ്ക്കപ്പെട്ട ഉള്ളടക്കം ഇപ്പോഴും എടുക്കാവുന്നതും ആവശ്യമെങ്കിൽ ഇതേ സമ്പർക്കമുഖം ഉപയോഗിച്ച് പുനഃസ്ഥാപിക്കാനോ അല്ലെങ്കിൽ കൂടുതൽ നിബന്ധനകൾ ചേർക്കാനോ കഴിയുന്നതുമാണ്.',
 'revdelete-confirm' => 'ഇതിന്റെ അനന്തരഫലങ്ങളെക്കുറിച്ചറിയാമെന്നും, [[{{MediaWiki:Policy-url}}|നയങ്ങൾ]] പാലിച്ചാണ് താങ്കളിത് ചെയ്യുന്നതെന്നും ഉറപ്പാക്കുക.',
 'revdelete-suppress-text' => "താഴെ പറയുന്ന സാഹചര്യങ്ങളിൽ '''മാത്രമേ''' ഒതുക്കൽ ഉപയോഗിക്കാവൂ:
 * അപകീർത്തികരമായ വിവരങ്ങൾ അടങ്ങിയവ
@@ -1427,7 +1432,7 @@ $1",
 'search-file-match' => '(പ്രമാണ ഉള്ളടക്കവുമായി ഒത്തുപോകുന്നുണ്ട്)',
 'search-suggest' => 'താങ്കൾ ഉദ്ദേശിച്ചത് $1 എന്നാണോ',
 'search-interwiki-caption' => 'സഹോദര സംരംഭങ്ങൾ',
-'search-interwiki-default' => '$1 ഫലങ്ങൾ:',
+'search-interwiki-default' => '$1 à´µà´¿à´\95àµ\8dà´\95ിയിൽ à´¨à´¿à´¨àµ\8dà´¨àµ\81à´³àµ\8dà´³ à´«à´²à´\99àµ\8dà´\99ൾ:',
 'search-interwiki-more' => '(കൂടുതൽ)',
 'search-relatedarticle' => 'ബന്ധപ്പെട്ടവ',
 'searcheverything-enable' => 'എല്ലാ നാമമേഖലകളും തിരയുക',
index a5e8803..6cc5215 100644 (file)
@@ -213,7 +213,7 @@ $messages = array(
 'vector-action-unprotect' => 'Хамгаалалтаа солих',
 'vector-view-create' => 'Үүсгэх',
 'vector-view-edit' => 'Засварлах',
-'vector-view-history' => 'Ð\97аÑ\81ваÑ\80Ñ\8bн Ñ\82үүх',
+'vector-view-history' => 'Түүх',
 'vector-view-view' => 'Унших',
 'vector-view-viewsource' => 'Кодыг харах',
 'actions' => 'Үйлдлүүд',
@@ -327,7 +327,7 @@ $1',
 'editlink' => 'загварыг засах',
 'viewsourcelink' => 'кодыг харах',
 'editsectionhint' => 'Хэсгийг засварлах: $1',
-'toc' => 'Ð\90гÑ\83Ñ\83лга',
+'toc' => 'Ð\93аÑ\80Ñ\87иг',
 'showtoc' => 'дэлгэх',
 'hidetoc' => 'хумих',
 'collapsible-collapse' => 'хумих',
@@ -1387,12 +1387,15 @@ $1 тэмдэгтээс богино байх ёстой.',
 'recentchanges-label-bot' => 'Робот гүйцэтгэсэн засвар',
 'recentchanges-label-unpatrolled' => 'Энэ засварыг одоогийн байдлаар манаагүй байна',
 'recentchanges-label-plusminus' => 'Өөрчлөгдсөн байт хэмжээ',
+'recentchanges-legend-heading' => "'''Таних үсэг:'''",
 'recentchanges-legend-newpage' => '([[Special:NewPages|жагсааж харах]])',
 'rcnotefrom' => "Доорх нь '''$2'''-с хойших өөрчлөлтүүд ('''$1''' хүртэлхийг харуулав) юм.",
 'rclistfrom' => '$1-с хойших шинэ засваруудыг үзүүлэх',
 'rcshowhideminor' => 'Бага зэргийн засваруудыг $1',
 'rcshowhidebots' => 'Роботуудыг $1',
 'rcshowhideliu' => 'Нийт $1 бүртгэгдсэн хэрэглэгчид',
+'rcshowhideliu-show' => 'үзүүлэх',
+'rcshowhideliu-hide' => 'нуух',
 'rcshowhideanons' => 'Бүртгэлгүй хэрэглэгчдийг $1',
 'rcshowhideanons-show' => 'үзүүлэх',
 'rcshowhideanons-hide' => 'нуух',
@@ -2231,7 +2234,7 @@ $UNWATCHURL
 'undeletebtn' => 'Сэргээх',
 'undeletelink' => 'үзэх/сэргээх',
 'undeleteviewlink' => 'харах',
-'undeleteinvert' => 'ЭÑ\81Ñ\80Ñ\8dгÑ\8dÑ\8dÑ\80 Ð½Ñ\8c Ð±Ð¾Ð»Ð³Ð¾Ñ\85',
+'undeleteinvert' => 'Ð\97ааÑ\81нааÑ\81 Ð±Ñ\83Ñ\81ад',
 'undeletecomment' => 'Шалтгаан:',
 'undeletedrevisions' => '{{PLURAL:$1|1 хувилбар|$1 хувилбар}}  сэргээгдлээ',
 'undeletedrevisions-files' => '{{PLURAL:$1|1 засвар|$1 засвар}} ба {{PLURAL:$2|1 файл|$2 файл}} сэргээгдлээ',
@@ -2262,7 +2265,8 @@ $1',
 
 # Namespace form on various pages
 'namespace' => 'Нэрний зай:',
-'invert' => 'Эсрэгээр нь болгох',
+'invert' => 'Зааснаас бусад',
+'namespace_association' => 'Заасан төрлөөс',
 'blanknamespace' => '(Гол)',
 
 # Contributions
@@ -2644,9 +2648,9 @@ $1',
 'tooltip-pt-mycontris' => 'Таны оруулсан хувь нэмрийн жагсаалт',
 'tooltip-pt-login' => 'Заавал хийх ёстой зүйл биш боловч таныг нэвтрэхийг зөвлөж байна.',
 'tooltip-pt-logout' => 'Гарах',
-'tooltip-ca-talk' => 'Өгүүлснийг зөвшин хэлэлцэх',
+'tooltip-ca-talk' => 'Хуудсыг зөвшин хэлэлцэх',
 'tooltip-ca-edit' => 'Та энэ хуудсыг засч янзалж болно. Хадгалахаасаа өмнө урьдчилан харах товчийг дардаг юм шүү.',
-'tooltip-ca-addsection' => 'ШинÑ\8d Ñ\85Ñ\8dÑ\81Ñ\8dг Ò¯Ò¯Ñ\81гэх',
+'tooltip-ca-addsection' => 'ШинÑ\8d Ñ\81Ñ\8dдвÑ\8dÑ\8dÑ\80 Ñ\8fÑ\80Ñ\8cж Ñ\8dÑ\85лэх',
 'tooltip-ca-viewsource' => 'Энэ хуудас хамгаалагдсан байна. Та зөвхөн кодыг нь харах боломжтой.',
 'tooltip-ca-history' => 'Энэ хуудсыг зассан түүхийг сөхөн нягтлах',
 'tooltip-ca-protect' => 'Энэ хуудсыг хамгаалах',
@@ -2677,7 +2681,7 @@ $1',
 'tooltip-t-specialpages' => 'Тусгай хуудаснуудын жагсаалт',
 'tooltip-t-print' => 'Энэ хуудасны хувилж болох хувилбар',
 'tooltip-t-permalink' => 'Хуудасны одоогийн хувилбар луу очих тогтмол линк',
-'tooltip-ca-nstab-main' => 'Өгүүлснийг үзэх',
+'tooltip-ca-nstab-main' => 'Өгүүлсэн хуудас',
 'tooltip-ca-nstab-user' => 'Хэрэглэгчийн хуудсыг үзэх',
 'tooltip-ca-nstab-media' => 'Медиа хуудсыг үзэх.',
 'tooltip-ca-nstab-special' => 'Энэ бол тусгай хуудас, та үүнийг шууд засварлах боломжгүй.',
@@ -2686,7 +2690,7 @@ $1',
 'tooltip-ca-nstab-mediawiki' => 'Системийн мэдэгдлийг үзэх.',
 'tooltip-ca-nstab-template' => 'Загварыг үзэх',
 'tooltip-ca-nstab-help' => 'Тусламжийн хуудсыг үзэх',
-'tooltip-ca-nstab-category' => 'Анги үзэх',
+'tooltip-ca-nstab-category' => 'Анги, бүлгийн хуудас',
 'tooltip-minoredit' => 'Бага зэргийн засвар гэж тэмдэглэх',
 'tooltip-save' => 'Засваруудаа хадгалах',
 'tooltip-preview' => 'Өөрийн оруулах гэж буй өөрчлөлтүүдийг урьдчилан харах. Үүнийг ашиглана уу!',
index 2d4662a..85e0ad2 100644 (file)
@@ -220,7 +220,7 @@ $messages = array(
 'articlepage' => 'Khoàⁿ loē-iông ia̍h',
 'talk' => 'thó-lūn',
 'views' => 'Khoàⁿ',
-'toolbox' => 'Ke-si kheh-á',
+'toolbox' => 'Ke-si',
 'userpage' => 'Khoàⁿ iōng-chiá ê Ia̍h',
 'projectpage' => 'Khoàⁿ sū-kang ia̍h',
 'imagepage' => 'Khoàⁿ tóng-àn ia̍h',
@@ -496,6 +496,9 @@ Lîm-sî ê bi̍t-bé: $2',
 'newarticle' => '(Sin)',
 'newarticletext' => "Lí tòe 1 ê liân-kiat lâi kàu 1 bīn iáu-bōe chûn-chāi ê ia̍h. Beh khai-sí pian-chi̍p chit ia̍h, chhiáⁿ tī ē-kha ê bûn-jī keh-á lāi-té phah-jī. ([[{{MediaWiki:Helppage}}|Bo̍k-lio̍k]] kà lí án-choáⁿ chìn-hêng.) Ká-sú lí bô-tiuⁿ-tî lâi kàu chia, ē-sai chhi̍h liû-lám-khì ê '''téng-1-ia̍h''' tńg--khì.",
 'anontalkpagetext' => "----''Pún thó-lūn-ia̍h bô kò·-tēng ê kháu-chō/hō·-thâu, kan-na ū 1 ê IP chū-chí (chhin-chhiūⁿ 123.456.789.123). In-ūi bô kāng lâng tī bô kāng sî-chūn ū khó-lêng tú-hó kong-ke kāng-ê IP, lâu tī chia ê oē ū khó-lêng hō· bô kāng lâng ê! Beh pī-bián chit khoán būn-tê, ē-sái khì [[Special:UserLogin|khui 1 ê hō·-thâu a̍h-sī teng-ji̍p]].''",
+'noarticletext' => '這頁這馬無內容,你會使佇別頁[[Special:Search/{{PAGENAME}}|揣這頁標題]],
+<span class="plainlinks">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} 揣相關日誌],
+抑[{{fullurl:{{FULLPAGENAME}}|action=edit}} 改這頁]</span>。',
 'clearyourcache' => "'''Chù-ì:''' Pó-chûn liáu-āu, tio̍h ē-kì leh kā liû-lám-khì ê cache piàⁿ tiāu chiah khoàⁿ-ē-tio̍h kái-piàn: *'''Firefox / Safari:''' chhi̍h tiâu \"Shift\" kâng-sî-chūn tiám-kik ''Reload/têng-sin chài-ji̍p'' a̍h-sī chhi̍h ''Ctrl-F5'' \"Ctrl-R\" kî-tiong chi̍t ê (''Command-R'' tī Mac) 
 * '''Google Chrome:''' chhi̍h ''Ctrl-Shift-R'' (''Command-Shift-R'' tī Mac)
 '''Internet Explorer :'''chhi̍h tiâu \"Ctrl\" kâng-sî-chūn tiám-kek ''Refresh/têng-sin chài-ji̍p'' a̍h-sī chhi̍h \"Ctrl-F5\" 
@@ -563,6 +566,12 @@ Lí ê kái-piàn tī ē-kha ê bûn-jī-keh. Lí su-iàu chiōng lí chò ê k
 # Revision feed
 'history-feed-item-nocomment' => '$1 tī $2',
 
+# Revision deletion
+'revdel-restore' => '改會當看無',
+
+# Merge log
+'revertmerge' => '取消合併',
+
 # Diffs
 'history-title' => '"$1"的歷史版本',
 'lineno' => 'Tē $1 chōa:',
@@ -580,16 +589,22 @@ Lí ê kái-piàn tī ē-kha ê bûn-jī-keh. Lí su-iàu chiōng lí chò ê k
 'shown-title' => 'Múi ia̍h hián-sī $1 {{PLURAL:$1|kiat-kó|kiat-kó}}',
 'viewprevnext' => 'Khoàⁿ ($1 {{int:pipe-separator}} $2) ($3)',
 'searchprofile-articles' => 'Loē-iông ia̍h',
+'searchprofile-project' => '幫助佮事工的頁',
 'searchprofile-images' => 'To-mûi-thé',
 'searchprofile-everything' => 'Só͘-ū ê',
 'searchprofile-advanced' => 'chìn-chi̍t-pō͘',
 'searchprofile-articles-tooltip' => 'Tī $1 chhoé',
+'searchprofile-project-tooltip' => 'Tī $1 chhoé',
 'searchprofile-images-tooltip' => 'Chhoé tóng-àn',
+'searchprofile-everything-tooltip' => '揣全部(包括討論頁)',
+'searchprofile-advanced-tooltip' => '佇你家己設的名空間內底揣',
 'search-result-size' => '$1 ({{PLURAL:$2|1 jī-goân|$2 jī-goân}})',
+'search-redirect' => '(轉去 $1)',
 'search-section' => '(toān-lo̍h $1)',
 'searchall' => 'choân-pō·',
 'showingresults' => 'Ē-kha tùi #<b>$2</b> khai-sí hián-sī <b>$1</b> hāng kiat-kó.',
 'showingresultsnum' => 'Ē-kha tùi #<b>$2</b> khai-sí hián-sī <b>$3</b> hāng kiat-kó.',
+'showingresultsheader' => "對'''$4'''的{{PLURAL:$5|第 '''$1''' 到第 '''$3''' 項結果|第 '''$1 - $2''' 項,總共 '''$3''' 項結果}}",
 'powersearch-legend' => 'Kiám-sek',
 
 # Preferences page
@@ -709,7 +724,7 @@ Tī pat-lâng liân-lo̍k lí ê sî-chūn bē kā e-mail tsū-tsí siá chhut--
 'filehist-datetime' => 'Ji̍t-kî/ Sî-kan',
 'filehist-thumb' => '細張圖',
 'filehist-user' => 'Iōng-chiá',
-'imagelinks' => 'Iáⁿ-siōng liân-kiat',
+'imagelinks' => 'tóng-àn sù-iōng ê chōng-hòng',
 'linkstoimage' => 'Í-hā ê ia̍h liân kàu chit ê iáⁿ-siōng:',
 'nolinkstoimage' => 'Bô poàⁿ ia̍h liân kàu chit tiuⁿ iáⁿ-siōng.',
 
@@ -888,6 +903,7 @@ Also see [[Special:WantedCategories|wanted categories]].',
 # Undelete
 'undelete' => 'Kiù thâi tiāu ê ia̍h',
 'undeletepage' => 'Khoàⁿ kap kiù thâi tiāu ê ia̍h',
+'undeletelink' => '看/復原',
 'undeleteviewlink' => 'Khoàⁿ',
 
 # Namespace form on various pages
@@ -932,6 +948,8 @@ Also see [[Special:WantedCategories|wanted categories]].',
 'ipusubmit' => 'Chhú-siau hong-só chit ê chū-chí',
 'ipblocklist' => 'Siū hong-só ê IP chū-chí kap iōng-chiá miâ-chheng',
 'blocklink' => 'hong-só',
+'unblocklink' => '廢除封鎖',
+'change-blocklink' => '改封鎖',
 'contribslink' => 'kòng-hiàn',
 'autoblocker' => 'Chū-tōng kìm-chí lí sú-iōng, in-ūi lí kap "$1" kong-ke kāng 1 ê IP chū-chí (kìm-chí lí-iû "$2").',
 'blocklogentry' => 'hong-só [[$1]], siat kî-hān chì $2 $3',
@@ -967,6 +985,7 @@ Liâu--lo̍h-khì chìn-chêng, chhiáⁿ seng khak-tēng lí ū liáu-kái chia
 'movepage-page-moved' => '$1 í-keng sóa khì tī $2.',
 'movelogpagetext' => 'Ē-kha lia̍t-chhut hông soá-ūi ê ia̍h.',
 'movereason' => 'Lí-iû:',
+'revertmove' => 'hôe-tńg',
 'selfmove' => 'Goân piau-tê kap sin piau-tê sio-siâng; bô hoat-tō· sóa.',
 'protectedpagemovewarning' => "'''KÉNG-KÒ: Pún ia̍h só tiâu leh. Kan-taⁿ ū hêng-chèng te̍k-koân ê iōng-chiá (sysop) ē-sái soá tín-tāng.'''
 Ē-kha ū choè-kīn ê kì-lio̍k thang chham-khó:",
@@ -993,6 +1012,7 @@ Liâu--lo̍h-khì chìn-chêng, chhiáⁿ seng khak-tēng lí ū liáu-kái chia
 'tooltip-pt-userpage' => 'Lí chit ê iōng-chiá ê ia̍h',
 'tooltip-pt-mytalk' => 'Lí ê thó-lūn ia̍h',
 'tooltip-pt-preferences' => 'Lí ê siat-tēng',
+'tooltip-pt-watchlist' => '你監視的頁有改過的清單',
 'tooltip-pt-mycontris' => 'Lí ê kòng-hiàn lia̍t-toaⁿ',
 'tooltip-pt-login' => 'Hi-bāng lí teng-ji̍p; m̄-ko bô kiông-chè',
 'tooltip-pt-logout' => 'Teng-chhut',
@@ -1003,6 +1023,7 @@ Lí ē-sái khoàⁿ i ê goân-sú-bé.',
 'tooltip-ca-history' => 'Chit ia̍h ê chá-chêng pán-pún',
 'tooltip-ca-delete' => 'Thâi chit ia̍h',
 'tooltip-ca-move' => '徙這頁',
+'tooltip-ca-watch' => '共這頁加入去你的監視單',
 'tooltip-ca-unwatch' => 'Lí ê kàm-sī-toaⁿ soá tiàu chit ia̍h.',
 'tooltip-search' => 'Chhoé {{SITENAME}}',
 'tooltip-search-fulltext' => 'Chhoé ū chia-ê jī ê ia̍h',
@@ -1016,6 +1037,7 @@ Lí ē-sái khoàⁿ i ê goân-sú-bé.',
 'tooltip-n-help' => 'Beh chhoé ê só͘-chāi',
 'tooltip-t-whatlinkshere' => 'Só͘-ū liân kàu chia ê liat-toaⁿ',
 'tooltip-t-recentchangeslinked' => 'Liân kàu chit ia̍h koh choè-kīn ū kái koè--ê',
+'tooltip-feed-atom' => '訂看這頁的修改',
 'tooltip-t-contributions' => 'Khoàⁿ chit ê iōng-chiá ê kòng-hiàn lia̍t-toaⁿ',
 'tooltip-t-upload' => 'Í-keng sàng chiūⁿ-bāng ê tóng-àn',
 'tooltip-t-specialpages' => 'Só͘-ū te̍k-sû-ia̍h ê lia̍t-toaⁿ',
index 833b989..f7ed3bc 100644 (file)
@@ -292,7 +292,7 @@ $linkTrail = "/^([a-zàâçéèêîôû]+)(.*)$/sDu";
 $messages = array(
 # User preference toggles
 'tog-underline' => 'Soslinhar los ligams :',
-'tog-hideminor' => 'Amagar los darrièrs cambiaments menors',
+'tog-hideminor' => 'Amagar los cambiaments menors dins los darrièrs cambiaments',
 'tog-hidepatrolled' => 'Amagar las modificacions susvelhadas dins los darrièrs cambiaments',
 'tog-newpageshidepatrolled' => 'Amagar las paginas susvelhadas de la lista de las paginas novèlas',
 'tog-extendwatchlist' => 'Espandir la lista de seguiment per afichar totas las modificacions e non pas solament las mai recentas',
@@ -619,7 +619,7 @@ Una lista de las paginas especialas pòt èsser trobada sus [[Special:SpecialPag
 'databaseerror-error' => 'Error : $1',
 'laggedslavemode' => '<strong>Atencion :</strong> Aquesta pagina pòt conténer pas totes los darrièrs cambiaments efectuats.',
 'readonly' => 'Mesas a jorn blocadas sus la banca de donadas',
-'enterlockreason' => 'Indicatz la rason del blocatge, e mai una estimacion de sa durada',
+'enterlockreason' => 'Indicatz la rason del varrolhatge, e mai una estimacion de sa durada',
 'readonlytext' => "Los ajustons e mesas a jorn de la banca de donadas son actualament blocats, probablament per permetre la mantenença de la banca, aprèp aquò, tot dintrarà dins l'òrdre.
 
 L’administrator qu'a varrolhat la banca de donadas a balhat l’explicacion seguenta : $1",
@@ -1353,13 +1353,14 @@ Podètz trobar de detalhs dins lo [{{fullurl:{{#Special:Log}}/delete|page={{FULL
 'search-file-match' => '(correspond al contengut del fichièr)',
 'search-suggest' => 'Avètz volgut dire : $1',
 'search-interwiki-caption' => 'Projèctes fraires',
-'search-interwiki-default' => '$1 resultats :',
+'search-interwiki-default' => 'Resultats de $1 :',
 'search-interwiki-more' => '(mai)',
 'search-relatedarticle' => 'Relatat',
 'searcheverything-enable' => 'Recercar dins totes los espacis de noms',
 'searchrelated' => 'relatat',
 'searchall' => 'Totes',
-'showingresults' => "Afichatge {{PLURAL:$1|d''''1''' resultat|de '''$1''' resultats}} a partir del #'''$2'''.",
+'showingresults' => 'Afichatge de <b>$1</b> resultat{{PLURAL:$1||s}} a partir del n°<b>$2</b>.',
+'showingresultsinrange' => 'Afichar çaijós fins a {{PLURAL:$1|<strong>1</strong> resultat|<strong>$1</strong> resultats}} dins la seria #<strong>$2</strong> a #<strong>$3</strong>.',
 'showingresultsnum' => "Afichatge {{PLURAL:$3|d''''1''' resultat|de '''$3''' resultats}} a partir del #'''$2'''.",
 'showingresultsheader' => "{{PLURAL:$5|Resultat '''$1'''|Resultats '''$1 - $2'''}} de '''$3''' per '''$4'''",
 'search-nonefound' => 'I a pas cap de resultat correspondent a la requèsta.',
@@ -1382,7 +1383,7 @@ Atencion, lor indexacion de contengut {{SITENAME}} benlèu es pas a jorn.',
 'prefsnologintext2' => "$1 per definir las preferéncias d'utilizaire.",
 'prefs-skin' => 'Aparéncia',
 'skin-preview' => 'Previsualizar',
-'datedefault' => 'Cap de preferéncia',
+'datedefault' => 'Pas cap de preferéncia',
 'prefs-beta' => 'Foncionalitats bèta',
 'prefs-datetime' => 'Data e ora',
 'prefs-labs' => 'Foncionalitats « labs »',
@@ -1697,7 +1698,7 @@ Tanben podètz causir de permetre a d’autres de vos contactar per vòstra pagi
 'rcshowhidemine' => '$1 mas modificacions',
 'rcshowhidemine-show' => 'Afichar',
 'rcshowhidemine-hide' => 'Amagar',
-'rclinks' => 'Afichar los $1 darrièrs cambiaments efectuats al cors dels $2 darrièrs jorns; $3 cambiaments menors.',
+'rclinks' => 'Afichar los $1 darrièrs cambiaments efectuats al cors dels $2 darrièrs jorns<br />$3.',
 'diff' => 'dif',
 'hist' => 'ist',
 'hide' => 'amagar',
@@ -2156,6 +2157,8 @@ Las entradas <del>barradas</del> son estadas resolgudas.',
 'wantedpages' => 'Paginas mai demandadas',
 'wantedpages-badtitle' => 'Títol invalid dins los resultats : $1',
 'wantedfiles' => 'Fichièrs desirats',
+'wantedfiletext-cat' => "Los fichièrs seguents son utilizats, mas existisson pas localament. Se se tròban sus un depaus partejat, pòdon èsser listats aicí, mentre que sián, de fach, ja disponibles. Totes aqueles falses positius seràn <del>raiats</del>. Amai, las paginas qu'intègran de fichièrs qu'existisson pas son repertoriadas dins [[:$1]].",
+'wantedfiletext-nocat' => 'Los fichièrs seguents son utilizats, mas existisson pas localament. Se se tròban sus un depaus partejat, pòdon èsser listats aicí, mentre que sián, de fach, ja disponibles. Totes aqueles falses positius seràn <del>raiats</del>.',
 'wantedtemplates' => 'Modèls demandats',
 'mostlinked' => 'Paginas mai ligadas',
 'mostlinkedcategories' => 'Categorias mai utilizadas',
index b6a5a9a..8b1d184 100644 (file)
@@ -1300,7 +1300,7 @@ $1",
 'prevn' => '{{PLURAL:$1|$1}}ର ଆଗରୁ',
 'nextn' => '{{PLURAL:$1|$1}} ପର',
 'prevn-title' => 'ଆଗରୁ ମିଳିଥିବା $1ଟି  {{PLURAL:$1|result|ଫଳ}}',
-'nextn-title' => 'à¬\86à¬\97ର $1à¬\9fି  {{PLURAL:$1|result|ଫଳସବୁ}}',
+'nextn-title' => 'ପର $1 {{PLURAL:$1|ଫଳାଫଳ|ଫଳାଫଳସବୁ}}',
 'shown-title' => '$1 ପ୍ରତି ପୃଷ୍ଠାର {{PLURAL:$1|ଫଳାଫଳ|ଫଳାଫଳ}} ଦେଖାଇବେ ।',
 'viewprevnext' => '($1 {{int:pipe-separator}} $2) ($3) ଟି ଦେଖିବେ',
 'searchmenu-exists' => "'''ଏହି ଉଇକିରେ \"[[:\$1]]\" ନାଆଁରେ ପୃଷ୍ଠାଟିଏ ଅଛି ।'''",
@@ -1322,7 +1322,7 @@ $1",
 'search-section' => '(ଭାଗ $1)',
 'search-suggest' => 'ଆପଣ $1 ଭାବି ଖୋଜିଥିଲେ କି?',
 'search-interwiki-caption' => 'ସାଙ୍ଗରେ ଚାଲିଥିବା ବାକି ପ୍ରକଳ୍ପସବୁ',
-'search-interwiki-default' => '$1 ଫଳାଫଳ:',
+'search-interwiki-default' => '$1 à¬°à­\81 à¬«à¬³à¬¾à¬«à¬³:',
 'search-interwiki-more' => '(ଅଧିକ)',
 'search-relatedarticle' => 'ଯୋଡ଼ା',
 'searcheverything-enable' => 'ସବୁଗୁଡ଼ିକ ନେମସ୍ପେସରେ ଖୋଜିବେ',
@@ -2342,11 +2342,11 @@ wiki: $PAGEEDITOR_WIKI
 # Delete
 'deletepage' => 'ପୃଷ୍ଠାଟି ଲିଭାଇଦେବେ',
 'confirm' => 'ନିଶ୍ଚିତ କରନ୍ତୁ',
-'excontent' => 'ଭିତର à¬­à¬¾à¬\97 à¬¥à¬¿à¬²à¬¾: $1',
-'excontentauthor' => 'ଭିତର ଭାଗରେ ଥିଲା: "$1" (ଆଉ "[[Special:Contributions/$2|$2]]" କେବଳ ଜଣେ ମାତ୍ର ଦାତା ଥିଲେ)',
-'exbeforeblank' => 'ଖାଲି କରିବା ଆଗରୁ ଭିତରେ "$1" ଥିଲା',
+'excontent' => 'ଲà­\87à¬\96ା à¬¥à¬¿à¬²à¬¾: "$1"',
+'excontentauthor' => 'ଭିତରେ ଥିଲା: "$1" (ଆଉ "[[Special:Contributions/$2|$2]]" କେବଳ ଜଣେ ଦାତା ଥିଲେ)',
+'exbeforeblank' => 'ଖାଲିକରିବା ଆଗରୁ ଭିତରେ "$1" ଥିଲା',
 'exblank' => 'ପୃଷ୍ଠାଟି ଖାଲି ଅଛି',
-'delete-confirm' => 'ଲିଭେଇବେ $1',
+'delete-confirm' => 'ଲିଭେଇବେ "$1"',
 'delete-legend' => 'ଲିଭାଇବେ',
 'historywarning' => "'''ଚେତାବନୀ:''' ଆପଣ ଲିଭାଇବାକୁ ଯାଉଥିବା ଏହି ପୃଷ୍ଠାଟିର ପାଖାପାଖି $1 {{PLURAL:$1|ଟି ସଙ୍କଳନ|ଗୋଟି ସଙ୍କଳନ}} ରହିଅଛି:",
 'confirmdeletetext' => 'ଆପଣ ଗୋଟିଏ ପୃଷ୍ଠାର ଇତିହାସ ସହ ତାହାକୁ ଲିଭାଇବାକୁ ଯାଉଛନ୍ତି ।
@@ -2446,7 +2446,7 @@ $2ଙ୍କ ଦେଇ ଶେଷଥର ହୋଇଥିବା ସଂସ୍କର
 'protect-dropdown' => '*ସାଧାରଣ ପ୍ରତିରକ୍ଷା କାରଣ
 ** ଅତି ଅଧିକ ଅପବ୍ୟବହାର
 ** ଅତି ଅଧିକ ଅଦରକାରୀ ଚିଜ ପୁରାଇବା
-** ନକରାତ୍ମକ ସମ୍ପାଦନା ତାଗିଦା
+** à¬¨à¬\95ାରାତà­\8dମà¬\95 à¬¸à¬®à­\8dପାଦନା à¬¤à¬¾à¬\97ିଦା
 ** ଅଧିକ ଦେଖାଯାଉଥିବା ପୃଷ୍ଠା',
 'protect-edit-reasonlist' => 'କିଳିବା କାରଣମାନଙ୍କର ସମ୍ପାଦନା କରିବେ',
 'protect-expiry-options' => '୧ ଘଣ୍ଟା:1 hour,ଦିନେ:1 day,ସପ୍ତାହେ:1 week,୨ ସପ୍ତାହ:2 weeks,ମସେ:1 month,୩ ମାସ:3 months,୬ ମାସ:6 months,ବର୍ଷେ:1 year,ଅସିମୀତ କାଳ:infinite',
index c6686ef..4e96a64 100644 (file)
@@ -712,6 +712,7 @@ $2',
 'suspicious-userlogout' => 'ਤੁਹਾਡੀ ਵਿਦਾਇਗੀ ਦੀ ਬੇਨਤੀ ਨਕਾਰ ਦਿੱਤੀ ਗਈ ਕਿਉਂਕਿ ਲੱਗਦਾ ਹੈ ਕਿ ਇਹ ਕਿਸੇ ਟੁੱਟੇ ਹੋਏ ਬਰਾਊਜ਼ਰ ਜਾਂ ਕੈਸ਼ ਹੋਈ ਪ੍ਰਾਕਸੀ ਤੋਂ ਭੇਜੀ ਗਈ ਸੀ।',
 'createacct-another-realname-tip' => 'ਅਸਲੀ ਨਾਂ ਚੋਣਵਾਂ ਹੈ।
 ਜੇਕਰ ਤੁਸੀਂ ਇਹ ਦਿੱਤਾ ਹੈ ਤਾਂ ਤੁਹਾਡੇ ਕੰਮ ਵਾਸਤੇ ਗੁਣ ਦੇ ਤੌਰ ਉੱਤੇ ਵਰਤਿਆ ਜਾਵੇਗਾ।',
+'pt-login-button' => 'ਲਾਗ ਇਨ',
 
 # Email sending
 'php-mail-error-unknown' => 'PHP ਦੇ ਮੇਲ() ਕਰਜ ਵਿੱਚ ਅਣਜਾਣ ਦੋਸ਼',
index abb367e..4bef23f 100644 (file)
@@ -864,6 +864,7 @@ Odczekaj $1 zanim ponowisz próbę.',
 'createacct-another-realname-tip' => 'Wpisanie imienia i nazwiska nie jest obowiązkowe.
 Jeśli zdecydujesz się je podać, zostaną użyte, by udokumentować Twoje autorstwo.',
 'pt-login' => 'Zaloguj się',
+'pt-login-button' => 'Zaloguj się',
 'pt-createaccount' => 'Utwórz konto',
 'pt-userlogout' => 'Wyloguj',
 
@@ -1289,6 +1290,8 @@ wybrana wersja nie istnieje lub próbowano ukryć wersję bieżącą.',
 'revdelete-show-file-submit' => 'Tak',
 'revdelete-selected' => "'''{{PLURAL:$2|Zaznaczona wersja|Zaznaczone wersje}} strony [[:$1]]:'''",
 'logdelete-selected' => "'''Zaznaczone {{PLURAL:$1|zdarzenie|zdarzenia}} z rejestru:'''",
+'revdelete-text-text' => 'Usunięte wersje będą nadal widoczne w historii strony, ale niektóre fragmenty ich treści nie będą dostępne dla wszystkich.',
+'revdelete-text-file' => 'Usunięte wersje pliku będą nadal widoczne w historii pliku, ale niektóre fragmenty ich treści nie będą dostępne dla wszystkich.',
 'revdelete-confirm' => 'Potwierdź, że chcesz to zrobić zgodnie z [[{{MediaWiki:Policy-url}}|zasadami]] i że rozumiesz konsekwencje.',
 'revdelete-suppress-text' => "Ukrywanie powinno być używane '''wyłącznie''' w sytuacji:
 * Informacji, która może być zniesławieniem
@@ -1421,7 +1424,7 @@ Zazwyczaj jest to spowodowane przestarzałym linkiem do usuniętej strony. Powó
 'search-file-match' => '(odpowiada zawartości pliku)',
 'search-suggest' => 'Czy chodziło Ci o: $1',
 'search-interwiki-caption' => 'Projekty siostrzane',
-'search-interwiki-default' => 'Wyniki dla $1:',
+'search-interwiki-default' => 'Wyniki od $1:',
 'search-interwiki-more' => '(więcej)',
 'search-relatedarticle' => 'Pokrewne',
 'searcheverything-enable' => 'Szukaj we wszystkich przestrzeniach nazw',
index 20fb6e8..bf98839 100644 (file)
@@ -666,6 +666,7 @@ $1',
 لطفاً د بيا هڅې نه مخکې $1 شېبې تم شۍ.',
 'login-abort-generic' => 'غونډال کې مو ننوتل نابريالی شو - ناڅاپي بند شو',
 'loginlanguagelabel' => 'ژبه: $1',
+'pt-login-button' => 'ننوتل',
 
 # Email sending
 'user-mail-no-addy' => 'د يوې برېښليک پتې پرته د برېښليک لېږلو هڅه شوې.',
@@ -1002,7 +1003,7 @@ $1',
 'search-section' => '(برخه $1)',
 'search-suggest' => 'آيا همدا مو موخه وه: $1',
 'search-interwiki-caption' => 'خورلڼې پروژې',
-'search-interwiki-default' => '$1 پايلې:',
+'search-interwiki-default' => 'پايلې له $1 څخه:',
 'search-interwiki-more' => '(نور)',
 'search-relatedarticle' => 'اړونده',
 'searcheverything-enable' => 'په ټولو نوم-تشيالونو کې پلټل',
index 71a1e77..bc8052f 100644 (file)
@@ -2746,7 +2746,7 @@ $1',
 'sp-contributions-newbies-title' => 'Contribuições de contas novas',
 'sp-contributions-blocklog' => 'registo de bloqueios',
 'sp-contributions-deleted' => 'contribuições eliminadas',
-'sp-contributions-uploads' => 'uploads',
+'sp-contributions-uploads' => 'carregamentos',
 'sp-contributions-logs' => 'registos',
 'sp-contributions-talk' => 'discussão',
 'sp-contributions-userrights' => 'gestão de privilégios de utilizador',
index 2013b18..237cb0a 100644 (file)
@@ -875,6 +875,7 @@ Por favor aguarde $1 antes de tentar novamente.',
 'createacct-another-realname-tip' => 'O nome verdadeiro é opcional.
 Se você optar por fornecê-lo, este nome será utilizado para dar ao usuário a atribuição de seu trabalho.',
 'pt-login' => 'Entrar',
+'pt-login-button' => 'Entrar',
 'pt-createaccount' => 'Criar conta',
 
 # Email sending
@@ -1298,6 +1299,10 @@ Você pode ver esta comparação; detalhes podem ser encontrados no [{{fullurl:{
 'revdelete-show-file-submit' => 'Sim',
 'revdelete-selected' => "'''{{PLURAL:$2|Edição selecionada|Edições selecionadas}} de [[:$1]]:'''",
 'logdelete-selected' => "'''{{PLURAL:$1|Evento de registro selecionado|Eventos de registro selecionados}}:'''",
+'revdelete-text-text' => 'Revisões apagadas continuarão a aparecer na página de histórico, mas parte de seus conteúdos estarão inacessíveis ao público.',
+'revdelete-text-file' => 'Versões dos arquivos apagados continuarão a aparecer no arquivo de histórico, mas parte de seus conteúdos estarão inacessíveis ao publico.',
+'logdelete-text' => 'Eventos de log apagados continuarão a aparecer nos logs, mas parte de seus conteúdos estarão inacessíveis ao público.',
+'revdelete-text-others' => 'Outros administrador na {{SITENAME}} continuarão capazes de acessar o conteúdo oculto e desocultá-lo pela mesma interface, a menos que restrições adicionais tenha sido feitas.',
 'revdelete-confirm' => 'Por favor confirme que pretende executar esta ação, que compreende as suas consequências e que o faz em concordância com as [[{{MediaWiki:Policy-url}}|políticas e recomendações]].',
 'revdelete-suppress-text' => "A supressão deverá ser usada '''apenas''' para os seguintes casos:
 * Informação potencialmente difamatória
@@ -2284,12 +2289,15 @@ Entradas <del>riscadas</del> foram resolvidas.',
 'deadendpagestext' => 'As seguintes páginas não contêm links para outras páginas no wiki {{SITENAME}}.',
 'protectedpages' => 'Páginas protegidas',
 'protectedpages-indef' => 'Proteções infinitas apenas',
+'protectedpages-summary' => 'Esta página lista as páginas existentes que estão protegidas no momento. Para uma lista de títulos que estão protegidos desde a criação, veja [[{{#special:ProtectedTitles}}]].',
 'protectedpages-cascade' => 'Apenas proteções progressivas',
 'protectedpages-noredirect' => 'Ocultar redirecionamentos',
 'protectedpagesempty' => 'Neste momento, nenhuma das páginas está protegida com estes parâmetros.',
 'protectedpages-timestamp' => 'Data e hora',
 'protectedpages-page' => 'Página',
 'protectedpages-expiry' => 'Expira',
+'protectedpages-performer' => 'Protegendo usuário',
+'protectedpages-params' => 'Parâmetros de proteção.',
 'protectedpages-reason' => 'Motivo',
 'protectedpages-unknown-timestamp' => 'Desconhecido',
 'protectedpages-unknown-performer' => 'Usuário desconhecido',
@@ -2480,6 +2488,7 @@ Futuras modificações em tal página e páginas de discussão relacionadas ser
 'watchmethod-list' => 'verificando páginas vigiadas para edições recentes',
 'watchlistcontains' => 'Sua lista de páginas vigiadas contém $1 {{PLURAL:$1|página|páginas}}.',
 'iteminvalidname' => "Problema com item '$1', nome inválido...",
+'wlnote2' => 'A seguir estão as mudanças nas últimas {{PLURAL:$1|hora|<strong>$1</strong> houras}}, a partir de $2, $3.',
 'wlshowlast' => 'Ver últimas $1 horas $2 dias $3',
 'watchlist-options' => 'Opções da lista de páginas vigiadas',
 
@@ -2569,7 +2578,7 @@ A eliminação de tais páginas foi restrita, a fim de se evitarem problemas aci
 'delete-warning-toobig' => 'Esta página possui um longo histórico de edições, com mais de $1 {{PLURAL:$1|edição|edições}}.
 Eliminá-la poderá causar problemas na base de dados de {{SITENAME}};
 prossiga com cuidado.',
-'deleting-backlinks-warning' => "'''Cuidado:''' Outras páginas se ligam ou redirecionam para a página que você está prestes a deletar.",
+'deleting-backlinks-warning' => "'''Cuidado:'''[[Special:WhatLinksHere/{{FULLPAGENAME}}|Outras páginas]] se ligam ou redirecionam para a página que você está prestes a deletar.",
 
 # Rollback
 'rollback' => 'Reverter edições',
@@ -3051,6 +3060,7 @@ Acesse [https://www.mediawiki.org/wiki/Localisation MediaWiki Localisation] e [/
 'thumbnail_image-type' => 'Tipo de imagem não suportado',
 'thumbnail_gd-library' => 'Configuração da biblioteca GD incompleta: função $1 não encontrada',
 'thumbnail_image-missing' => 'Arquivo aparentemente inexistente: $1',
+'thumbnail_image-failure-limit' => 'Houveram muitas tentativas falhas recentemente ($1 ou mais) de criação desta miniatura. Por favor, tente novamente mais tarde.',
 
 # Special:Import
 'import' => 'Importar páginas',
index 7a8495a..a5e12d0 100644 (file)
@@ -2496,15 +2496,30 @@ See also:
 * {{msg-mw|Revdelete-selected}}',
 'revdelete-text-text' => '{{RevisionDelete}}
 This is the introduction explaining the feature.
-See also: {{msg-mw|revdelete-text-file}}, {{msg-mw|logdelete-text}}, {{msg-mw|revdelete-text-others}}',
+
+See also:
+* {{msg-mw|Revdelete-text-file}}
+* {{msg-mw|Logdelete-text}}
+* {{msg-mw|Revdelete-text-others}}',
 'revdelete-text-file' => '{{RevisionDelete}}
 This is the introduction explaining the feature.
-See also: {{msg-mw|revdelete-text-text}}, {{msg-mw|logdelete-text}}, {{msg-mw|revdelete-text-others}}',
+
+See also:
+* {{msg-mw|Revdelete-text-text}}
+* {{msg-mw|Logdelete-text}}
+* {{msg-mw|Revdelete-text-others}}',
 'logdelete-text' => '{{RevisionDelete}}
 This is the introduction explaining the feature.
-See also: {{msg-mw|revdelete-text-text}}, {{msg-mw|revdelete-text-file}}, {{msg-mw|revdelete-text-others}}',
+
+See also:
+* {{msg-mw|Revdelete-text-text}}
+* {{msg-mw|Revdelete-text-file}}
+* {{msg-mw|Revdelete-text-others}}',
 'revdelete-text-others' => '{{RevisionDelete}}
-This message is shown after one of: {{msg-mw|revdelete-text-text}}, {{msg-mw|revdelete-text-image}}, {{msg-mw|revdelete-text-logging}}',
+This message is shown after one of:
+* {{msg-mw|Revdelete-text-text}}
+* {{msg-mw|Revdelete-text-file}}
+* {{msg-mw|Logdelete-text}}',
 'revdelete-confirm' => 'This message is a part of the [[mw:RevisionDelete|RevisionDelete]] feature.
 
 Refers to {{msg-mw|Policy-url}}.
index 42f9e6a..dc62a32 100644 (file)
@@ -1373,7 +1373,7 @@ Tia adressa dad e-mail na vegn betg mussada sche auters utilisaders ta contactes
 'recentchanges-label-unpatrolled' => "Questa midada n'è anc betg vegnida controllada",
 'recentchanges-legend-heading' => "'''Legenda:'''",
 'recentchanges-legend-newpage' => '(vesair era la [[Special:NewPages|glista da novas paginas]])',
-'rcnotefrom' => 'I vegnan mussadas las modificaziuns a partir da las <strong>$4</strong> dals <strong>$3</strong>(maximalmain <strong>$1</strong>).',
+'rcnotefrom' => 'I vegnan mussadas las midadas a partir da las <strong>$4</strong> dals <strong>$3</strong> (maximalmain <strong>$1</strong>).',
 'rclistfrom' => 'Mussar las novas midadas a partir da las $2 dals $3',
 'rcshowhideminor' => '$1 midadas pitschnas',
 'rcshowhideminor-show' => 'Mussar',
index 4757314..3fec820 100644 (file)
@@ -1263,6 +1263,10 @@ funcție, fie versiunea specificată nu există, ori sunteți pe cale să ascund
 'revdelete-show-file-submit' => 'Da',
 'revdelete-selected' => "'''{{PLURAL:$2|Versiunea aleasă|Versiunile alese}} pentru [[:$1]]:'''",
 'logdelete-selected' => "'''{{PLURAL:$1|Revizia aleasă|Reviziile alese}}:'''",
+'revdelete-text-text' => 'Versiunile șterse vor continua să fie vizibile în istoricul paginii, însă anumite părți ale conținutului acestora vor fi inaccesibile publicului.',
+'revdelete-text-file' => 'Versiunile șterse ale fișierului vor continua să fie vizibile în istoricul fișierului, însă anumite părți ale conținutului acestora vor fi inaccesibile publicului.',
+'logdelete-text' => 'Evenimentele șterse ale jurnalului vor continua să fie vizibile în jurnale, însă anumite părți ale conținutului acestora vor fi inaccesibile publicului.',
+'revdelete-text-others' => 'Alți administratori de la {{SITENAME}} vor avea acces în continuare la conținutul ascuns și îl vor putea restaura prin intermediul acestei interfețe, cu excepția cazurilor în care nu sunt activate și restricții suplimentare.',
 'revdelete-confirm' => 'Vă rugăm să confirmați că intenționați să faceți acest lucru, că înțelegeți consecințele și că faceți asta în conformitate cu [[{{MediaWiki:Policy-url}}|politica]].',
 'revdelete-suppress-text' => "Suprimarea trebuie folosită '''doar''' în următoarele cazuri:
 * Informații potențial calomnioase
index 79a2417..9ed0b92 100644 (file)
@@ -1416,6 +1416,10 @@ $3 {{GENDER:$3|указал|указала}} следующую причину:
 'revdelete-show-file-submit' => 'Да',
 'revdelete-selected' => "'''{{PLURAL:$2|1=Выбранная версия|Выбранные версии}} страницы [[:$1]]:'''",
 'logdelete-selected' => "'''{{PLURAL:$1|1=Выбранная запись|Выбранные записи}} журнала:'''",
+'revdelete-text-text' => 'Удалённые версии будут по-прежнему видны в истории страницы, но части их содержимого будут недоступны для участников.',
+'revdelete-text-file' => 'Удалённые версии файла будут по-прежнему видны в истории страницы, но части их содержимого будут недоступны для участников.',
+'logdelete-text' => 'Удалённые события в журнале будут по-прежнему видны в журналах, но части их содержимого будут недоступны для участников.',
+'revdelete-text-others' => 'Другие администраторы на {{grammar:genitive|{{SITENAME}}}} по-прежнему будет иметь возможность доступа к скрытому содержимому и смогут восстановить его снова через этот же интерфейс, если не установлены дополнительные ограничения.',
 'revdelete-confirm' => 'Пожалуйста, подтвердите, что вы действительно желаете совершить это действие, осознаёте последствия, делаете это в соответствии с [[{{MediaWiki:Policy-url}}|правилами]].',
 'revdelete-suppress-text' => "Сокрытие может производиться '''только''' в следующих случаях:
 * Потенциально клеветническая информация
index 38d3201..c375c74 100644 (file)
@@ -404,11 +404,11 @@ The following {{PLURAL:$1|file is|$1 files are}} in the current category.',
 
 'about' => 'इत्यस्मिन् विषये:',
 'article' => 'लेखः',
-'newwindow' => '(नवà¥\87 à¤\97वाà¤\95à¥\8dषà¥\87 à¤\87दमà¥\8d उद्घाट्यते)',
+'newwindow' => '(à¤\87दà¤\82 à¤¨à¤µà¥\80नà¥\87 à¤\97वाà¤\95à¥\8dषà¥\87 उद्घाट्यते)',
 'cancel' => 'निरस्यताम्',
 'moredotdotdot' => 'अपि च...',
 'mypage' => 'मम पृष्ठम्',
-'mytalk' => 'मम à¤¸à¤®à¥\8dभाषणमà¥\8d',
+'mytalk' => 'सम्भाषणम्',
 'anontalk' => 'अस्य आइ.पी. संकेतस्य कृते सम्भाषणम्',
 'navigation' => 'सञ्चरणम्',
 'and' => '&#32;तथा च',
@@ -419,7 +419,7 @@ The following {{PLURAL:$1|file is|$1 files are}} in the current category.',
 'qbedit' => 'सम्पाद्यताम्',
 'qbpageoptions' => 'इदं पृष्ठम्',
 'qbmyoptions' => 'मम पृष्ठानि',
-'faq' => 'बहà¥\81धा à¤ªà¥\83à¤\9aà¥\8dà¤\9bà¥\8dयमानाà¤\83 à¤ªà¥\8dरशà¥\8dनाà¤\83',
+'faq' => 'सामानà¥\8dयà¤\9cिà¤\9cà¥\8dà¤\9eासाà¤\83 (FAQ)',
 'faqpage' => 'Project:बहुधा पृछ्यमानाः प्रश्नाः',
 
 # Vector skin
@@ -506,12 +506,12 @@ $1',
 'aboutsite' => '{{SITENAME}} विषयकं',
 'aboutpage' => 'Project:विषयकम्',
 'copyright' => 'अस्य घटकानि $1 इत्यस्यान्तर्गतानि उपलब्धानि।',
-'copyrightpage' => '{{ns:project}}:पà¥\8dरतिलिपà¥\8dयधिà¤\95ाराः',
+'copyrightpage' => '{{ns:project}}:पà¥\8dरतिà¤\95à¥\83तà¥\8dयधिà¤\95ारः',
 'currentevents' => 'वर्तमानवार्ताः',
 'currentevents-url' => 'Project:वर्तमानवार्ताः',
 'disclaimers' => 'अस्वीकारः',
 'disclaimerpage' => 'Project:सामान्याऽस्वीकरणम्',
-'edithelp' => 'सम्पादनार्थं सहाय्यम्',
+'edithelp' => 'समà¥\8dपादनारà¥\8dथà¤\82 à¤¸à¤¾à¤¹à¤¾à¤¯à¥\8dयमà¥\8d',
 'helppage' => 'Help:अन्तर्वस्तु',
 'mainpage' => 'मुख्यपृष्ठम्',
 'mainpage-description' => 'मुख्यपृष्ठम्',
@@ -564,7 +564,7 @@ $1',
 
 # Short words for each namespace, by default used in the namespace tab in monobook
 'nstab-main' => 'पृष्ठम्',
-'nstab-user' => 'यà¥\8bà¤\9cà¤\95सà¥\8dय à¤ªà¥\83षà¥\8dठमà¥\8d',
+'nstab-user' => 'योजकपृष्ठम्',
 'nstab-media' => 'माध्यमपृष्ठम्',
 'nstab-special' => 'विशेषपृष्ठम्',
 'nstab-project' => 'प्रकल्पपृष्ठम्',
@@ -832,37 +832,37 @@ $2
 'changeemail-cancel' => 'निवर्तयते',
 
 # Edit page toolbar
-'bold_sample' => 'सà¥\8dथà¥\82लाà¤\95à¥\8dषरà¥\88à¤\83 à¤¯à¥\81à¤\95à¥\8dतà¤\83 à¤­à¤¾à¤\97à¤\83',
-'bold_tip' => 'सà¥\8dथà¥\82लाà¤\95à¥\8dषरà¥\88à¤\83 à¤¯à¥\81à¤\95à¥\8dतà¤\83 à¤­à¤¾à¤\97à¤\83',
+'bold_sample' => 'सà¥\8dथà¥\82लाà¤\95à¥\8dषराणि',
+'bold_tip' => 'सà¥\8dथà¥\82लाà¤\95à¥\8dषराणि',
 'italic_sample' => 'तिर्यक् अक्षरम्',
 'italic_tip' => 'तिर्यक् अक्षरम्',
-'link_sample' => 'सà¤\82बà¤\82धनसà¥\8dय शीर्षकम्',
+'link_sample' => 'परिसनà¥\8dधà¥\87à¤\83 शीर्षकम्',
 'link_tip' => 'आन्तरिकसम्पर्कतन्तुः',
-'extlink_sample' => 'http://www.example.com à¤¸à¤\82बà¤\82धनसà¥\8dय शीर्षकम्',
-'extlink_tip' => 'बाह्य-संबंधनम् (अवश्यमेव  http:// इति पूर्वलग्नं योक्तव्यम्)',
+'extlink_sample' => 'http://www.example.com à¤ªà¤°à¤¿à¤¸à¤¨à¥\8dधà¥\87à¤\83 शीर्षकम्',
+'extlink_tip' => 'बाह्यानुबन्धः (http:// इति पूर्वन्यासम् अग्रे योजनीयम् इति स्मरतु)',
 'headline_sample' => 'शीर्षकम्',
 'headline_tip' => 'द्वितीयस्तरीयं शीर्षकम्',
-'nowiki_sample' => 'à¤\85पà¥\8dरारà¥\82पà¥\80à¤\95à¥\83तà¤\82 à¤ªà¤¾à¤ à¤\82 à¤\85तà¥\8dर à¤¨à¤¿à¤µà¥\87शयतà¥\81',
-'nowiki_tip' => 'विकिप्रारूपणं अवगणना कुरु',
+'nowiki_sample' => 'à¤\85पà¥\8dरारà¥\82पितà¤\82 à¤ªà¤¾à¤ à¤®à¥\8d à¤\85तà¥\8dर à¤¨à¤¿à¤µà¥\87शà¥\8dयतामà¥\8d',
+'nowiki_tip' => 'विकि-प्रारूपस्य अवगणनां करोतु',
 'image_sample' => 'उदाहरणम्.jpg',
-'image_tip' => 'à¤\85नà¥\8dतरà¥\8dà¤\97ता सञ्चिका',
+'image_tip' => 'à¤\85नà¥\8dतरà¥\8dनिहिता सञ्चिका',
 'media_sample' => 'उदाहरणम्.ogg',
-'media_tip' => 'सà¤\82à¤\9aिà¤\95ा-समà¥\8dपरà¥\8dà¤\95तनà¥\8dतà¥\81ः',
-'sig_tip' => 'भवतà¤\83 à¤¹à¤¸à¥\8dताà¤\99à¥\8dà¤\95नà¤\82 à¤¸à¤®à¤¯à¥\8bलà¥\8dलà¥\87à¤\96शà¥\8dà¤\9a',
+'media_tip' => 'सà¤\9eà¥\8dà¤\9aिà¤\95ासमà¥\8dबनà¥\8dधः',
+'sig_tip' => 'समयà¥\8bलà¥\8dलà¥\87न à¤¸à¤¹ à¤­à¤µà¤¤à¤\83/भवतà¥\8dयाà¤\83 à¤¹à¤¸à¥\8dताà¤\95à¥\8dषरà¤\83',
 'hr_tip' => 'क्षैतिज-रेखा (न्यूनतया प्रयोक्तव्या)',
 
 # Edit pages
-'summary' => 'सारांशः :',
+'summary' => 'सारांशः:',
 'subject' => 'विषयः/शीर्षकम् :',
 'minoredit' => 'इदं लघु परिवर्तनम्',
 'watchthis' => 'इदं पृष्ठं निरीक्षताम्',
 'savearticle' => 'पृष्ठं रक्ष्यताम्',
 'preview' => 'प्राग्दृश्यम्',
-'showpreview' => 'पà¥\8dराà¤\97à¥\8dदà¥\83शà¥\8dयà¤\82 à¤¦à¤°à¥\8dश्यताम्',
+'showpreview' => 'पà¥\8dराà¤\97à¥\8dदà¥\83शà¥\8dयà¤\82 à¤¦à¥\83श्यताम्',
 'showlivepreview' => 'प्रत्यक्षं प्राग्दृश्यम्',
-'showdiff' => 'परिवरà¥\8dतनानि à¤¦à¤°à¥\8dश्यन्ताम्',
-'anoneditwarning' => "'''पà¥\8dरबà¥\8bधà¤\83'''भवानà¥\8d à¤¨ à¤ªà¥\8dरविषà¥\8dà¤\9fà¥\8bऽसà¥\8dति !
-समà¥\8dपादनà¤\82 à¤\95रà¥\8dतà¥\81मà¥\8d à¤\85तà¥\8dर à¤ªà¥\8dरवà¥\87शà¤\83 à¤\86वशà¥\8dयà¤\95à¤\83 à¥¤ à¤\85नà¥\8dयथा à¤\85सà¥\8dय à¤ªà¥\83षà¥\8dठसà¥\8dय à¤\87तिहासà¥\87 à¤­à¤µà¤¦à¥\80या IPसà¤\82ख्या अङ्किता भवति ।",
+'showdiff' => 'परिवरà¥\8dतनानि à¤¦à¥\83श्यन्ताम्',
+'anoneditwarning' => "'''पà¥\82रà¥\8dवसà¥\82à¤\9aना''' à¤­à¤µà¤¤à¤¾/भवतà¥\8dया à¤ªà¥\8dरवà¥\87शà¤\83 à¤¨ à¤\95à¥\83तà¤\83 !
+à¤\85तà¥\8dर à¤¸à¤®à¥\8dपादनà¤\82 à¤\95रà¥\8dतà¥\81à¤\82 à¤ªà¥\8dरवà¥\87शà¤\83 à¤\85निवारà¥\8dयà¤\83 à¥¤ à¤\85नà¥\8dयथा à¤\85सà¥\8dय à¤ªà¥\83षà¥\8dठसà¥\8dय à¤\87तिहासà¥\87 à¤­à¤µà¤¤à¤\83/भवतà¥\8dयाà¤\83 à¤\85नà¥\8dतरà¥\8dà¤\9cालसà¤\82विदà¤\83 (IP) à¤¸à¤\99à¥\8dख्या अङ्किता भवति ।",
 'anonpreviewwarning' => "''भवान् प्रवेशितः न अस्ति। रक्षणेन पृष्ठस्य सम्पादनेतिहासे भवतः आइपीसंकेतः अंकितः भविष्यति।''",
 'missingsummary' => "'''अनुस्मारकम्:''' भवता सम्पादनस्य सारः न प्रदत्तः।
 चेद्भवान् \"{{int:savearticle}}\" इत्येतद् पुनः क्लिक्करोति, भवतः सम्पादनानि साराद् ऋते रक्षितीभविष्यन्ति।",
@@ -920,10 +920,10 @@ $2
 सा समाना सङ्ख्याः अन्ययोजकैः अपि विभक्ता । यदि भवान् अनामकयोजकः, भवता असम्बद्धटीकाः श्रुताः, कृपया स्वस्थनं निर्मीय नामाभिलेखं करोतु ।  [[Special:UserLogin/signup|create an account]], [[Special:UserLogin|log in]] अन्यानामकयोजकैः सह सम्भूयमनभ्रमैः विमुक्तः भवतु ।',
 'noarticletext' => 'अस्मिन् पृष्ठे अधुना किमपि न विद्यते । [[Special:Search/{{PAGENAME}}|एषः शब्दः]] येषु पृष्ठेषु अन्तर्भवति, तानि पृष्ठानि अन्वेष्टुं शक्यन्ते । 
 <span class="plainlinks">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}}  सम्बद्धेषु पृष्ठेषु अन्वेषणं]
-[{{fullurl:{{FULLPAGENAME}}|action=edit}} à¤\85सà¥\8dय à¤ªà¥\83षà¥\8dठसà¥\8dय à¤¸à¤®à¥\8dपादनमà¥\8d] वा  शक्यम्</span>.',
-'noarticletext-nopermission' => 'अस्मिन् पृष्ठे अधुना किमपि न विद्यते। भवान् विकिपीडियावर्तिषु अन्येषु पृष्ठेषु इदं [[Special:Search/{{PAGENAME}}|शीर्षकम् अन्वेष्टुम् अर्हति]] 
-<span class="plainlinks">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}}  related logs अन्वेष्टुम् अर्हति],
-अथवा [{{fullurl:{{FULLPAGENAME}}|action=edit}} इदं पृष्ठं स्रष्टुम् अर्हति]</span>.',
+[{{fullurl:{{FULLPAGENAME}}|action=edit}} à¤\85सà¥\8dय à¤ªà¥\83षà¥\8dठसà¥\8dय à¤¸à¤®à¥\8dपादनà¤\82] वा  शक्यम्</span>.',
+'noarticletext-nopermission' => 'अस्मिन् पृष्ठे अधुना किमपि न विद्यते । [[Special:Search/{{PAGENAME}}|एषः शब्दः]] येषु पृष्ठेषु अन्तर्भवति, तानि पृष्ठानि अन्वेष्टुं शक्यन्ते । 
+<span class="plainlinks">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}}  सम्बद्धेषु पृष्ठेषु अन्वेषणं]
+[{{fullurl:{{FULLPAGENAME}}|action=edit}} अस्य पृष्ठस्य सम्पादनं] वा  शक्यम्</span>.',
 'missing-revision' => '{{PAGENAME}} इति नामाङ्कितपुटस्य #$1 इति पुनरावृत्तिः अत्र नाश्ति । 
 पुटेन सह कालातीतानुबन्धकारणेन एतत् अभवत् ।
 विवरणम् अत्र दृश्यते ।[{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} deletion log].',
@@ -1038,9 +1038,8 @@ $2
 'expensive-parserfunction-warning' => "'''प्रबोधः :''' अस्मिन् पृष्ठे प्रभूतानि जटिलानि पार्सर्-फ़ंक्शन्-आह्वानानि सन्ति।
 अत्र $2 संख्यातः  {{PLURAL:$2|न्यूनं आह्वानं|न्यूनानि आह्वानानि}} भवितव्यानि, सद्यः तत्र {{PLURAL:$1 $1 आह्वानं विद्यते|$1 आह्वानानि विद्यन्ते}}।",
 'expensive-parserfunction-category' => 'प्रभूतेभ्यः जटिलेभ्यः पार्सर्-फंक्शन्-आह्वानेभ्यः युक्तानि पृष्ठाणि।',
-'post-expand-template-inclusion-warning' => "'''प्रबोधः:''' फलकानां योजनस्य आकारः अतिविशालः वर्तते ।
-कानिचन फलकानि न योजयिष्यते ।",
-'post-expand-template-inclusion-category' => 'पृष्ठाणि यत्र अतोऽधिकाः बिम्बधराः समाहितीकर्तुं न शक्यन्ते।',
+'post-expand-template-inclusion-warning' => "'''पूर्वसूचना:''' फलकस्य आकारः बृहत् वर्तते । कानिचन फलकानि नान्तर्भविष्यन्ति ।",
+'post-expand-template-inclusion-category' => 'माहितीफलकस्य अपेक्षया पृष्ठं बृहत् वर्तते ।',
 'post-expand-template-argument-warning' => "'''जागरणम्''' अस्मिन् पृष्ठे कश्चन एतादृशं फलकं विद्यते यच्च संवर्धनेन बृहदाकारतां प्राप्नोति ।
 एतादृशानि फलकानि परित्यक्तानि सन्ति ।",
 'post-expand-template-argument-category' => 'परित्यक्तैः फलकैः युक्तानि पृष्ठानि एतानि',
@@ -1071,13 +1070,13 @@ $2
 'viewpagelogs' => 'अस्य पृष्ठस्य लॉंग् इत्येतद् दर्शयतु',
 'nohistory' => 'अस्य पृष्ठस्य कृते पृष्ठेतिहासः न वर्तते।',
 'currentrev' => 'सद्यःकालीना आवृत्तिः',
-'currentrev-asof' => 'वर्तमाना आवृत्तिः $1 इति समये',
+'currentrev-asof' => '$1 समयस्य संस्करणम्',
 'revisionasof' => '$1 इत्यस्य संस्करणं',
 'revision-info' => '$1इति समयस्य आवृत्तिः $2 इत्यनेन',
 'previousrevision' => '← पुरातनानि संस्करणानि',
 'nextrevision' => 'नूतनतरा आवृत्तिः →',
 'currentrevisionlink' => 'सद्यःकालीना आवृत्तिः',
-'cur' => 'सदà¥\8dयà¥\8bà¤\9cातमà¥\8d',
+'cur' => 'वरà¥\8dतमानà¤\83',
 'next' => 'आगामि',
 'last' => 'पूर्वतनम्',
 'page_first' => 'प्रथमम्',
@@ -1120,7 +1119,7 @@ You can still [$1 view this revision]',
 You can still [$1 view this revision]",
 'rev-deleted-diff-view' => 'एतस्मात् अन्तरतः किञ्चिदवतरणं परिमार्जितम् । एतदन्तरं दृष्टुं शक्नुवन्ति । विवरणम् [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} हटाने की लॉग]',
 'rev-suppressed-diff-view' => 'अस्मिन्नन्तरे किञ्चिदवतरणं सङ्गुपतम् । तदन्तरम् अत्र दृष्टुं शक्नुवन्ति । [{{fullurl:{{#Special:Log}}/suppress|page={{FULLPAGENAMEE}}}} suppression log].',
-'rev-delundel' => 'दरà¥\8dशà¥\8dयनà¥\8dतामà¥\8d/à¤\97à¥\8bपà¥\8dयनà¥\8dताम्',
+'rev-delundel' => 'दà¥\83शà¥\8dयतामà¥\8d/à¤\97à¥\8bपà¥\8dयताम्',
 'rev-showdeleted' => 'दर्श्यताम्',
 'revisiondelete' => 'अवतरणं परिमार्जयतु/पुनस्थापयतु',
 'revdelete-nooldid-title' => 'लक्ष्यरूपा आवृत्तिः अमान्याऽस्ति।',
@@ -1153,7 +1152,7 @@ You can still [$1 view this revision]",
 'revdelete-failure' => 'अवतरणदृश्यता उन्नतीकरणं न शक्यते ।$1',
 'logdelete-success' => 'नामाङ्कनदृश्यता साफल्येन योजिता ।',
 'logdelete-failure' => 'नामाभिलेखदृश्यता सपला नाभवत् । $1',
-'revdel-restore' => 'दà¥\83षà¥\8dà¤\9fिविषयà¤\83 परिवर्त्यताम्',
+'revdel-restore' => 'दà¥\83शà¥\8dयता परिवर्त्यताम्',
 'pagehist' => 'पृष्ठस्य इतिहासः',
 'deletedhist' => 'परिमार्जितेतिहासः ।',
 'revdelete-hide-current' => '$2 $1 दिनाङ्कितस्य गोपने दोषः । एतत् प्रकृतावतरणम्, एतत् न गोपनीयम् ।',
@@ -1233,7 +1232,9 @@ You can still [$1 view this revision]",
 'shown-title' => 'प्रत्येकस्मिन् पृष्ठे $1 {{PLURAL:$1|फलितम्|फलितानि}} दर्श्यताम्',
 'viewprevnext' => 'दर्श्यताम् ($1 {{int:pipe-separator}} $2) ($3)',
 'searchmenu-exists' => 'अस्मिन् विकिमध्ये "[[:$1]]"नामकं पृष्ठं विद्यते।',
-'searchmenu-new' => "'''अस्यां विक्यां \"[[:\$1]]\" इति पृष्ठं सृज्यताम्!'''",
+'searchmenu-new' => '<srong> अस्मिन् विकिजालस्थाने "[[:$1]]" इदं पृष्ठं सृज्यताम् ।
+</strong>
+{{PLURAL:$2|0=|तव अन्वेषणस्य परिणामोपि दृश्यताम् ।|तव अन्वेषणस्य परिणामाः अपि दृश्यन्ताम्}}',
 'searchprofile-articles' => 'आन्तर्विषकं पृष्ठं',
 'searchprofile-project' => 'साहाय्यं, प्रकल्पपृष्ठानि च',
 'searchprofile-images' => 'माध्यमसमुच्चयः',
@@ -1249,7 +1250,7 @@ You can still [$1 view this revision]",
 'search-result-score' => 'सम्बन्धः $1% ।',
 'search-redirect' => '($1 तः अनुप्रेषितम्)',
 'search-section' => '(विभागः $1)',
-'search-suggest' => 'किं भवतः आशयः एवमस्ति : $1',
+'search-suggest' => 'किं भवतः/भवत्याः आशयः एवमस्ति : $1',
 'search-interwiki-caption' => 'बन्धु-प्रकल्पाः',
 'search-interwiki-default' => '$1 परिणामाः :',
 'search-interwiki-more' => '(अधिकानि)',
@@ -1260,7 +1261,7 @@ You can still [$1 view this revision]",
 'showingresults' => "निम्नगतक्रमाङ्कस्य '''$2''' तः आरभ्य अधिकतमं परिणामः'''$1''' {{PLURAL:$1| दर्शितः}}।",
 'showingresultsnum' => "निम्नगतक्रमाङ्क'''$2'''तः आरभ्य अधिकतमः '''$3''' परिणामः {{PLURAL:$3|दर्शितः}}।",
 'showingresultsheader' => "'''$4''' इत्येतस्मै {{PLURAL:$5|'''$1''' परिणामः '''$3''' इत्येषु|'''$1 - $2''' परिणामाः '''$3''' इत्येषु}}",
-'search-nonefound' => 'भवतः अपेक्षानुगुणं फलितं न किमपि विद्यते ।',
+'search-nonefound' => 'भवतः/भवत्याः अपेक्षानुगुणं परिणामः न विद्यते ।',
 'powersearch-legend' => 'प्रगतम् अन्वेषणम्',
 'powersearch-ns' => 'नामाकाशेषु अन्विष्यताम्:',
 'powersearch-redir' => 'अनुप्रेषणानां सूचिका दर्श्यताम्',
@@ -1274,7 +1275,7 @@ You can still [$1 view this revision]",
 
 # Preferences page
 'preferences' => 'इष्टतमानि',
-'mypreferences' => 'मम à¤\87षà¥\8dà¤\9fतमानि',
+'mypreferences' => 'इष्टतमानि',
 'prefs-edits' => 'सम्पादनानां सख्याः',
 'prefs-skin' => 'त्वक्',
 'skin-preview' => 'प्राग्दृश्यम्',
@@ -1542,23 +1543,23 @@ You can still [$1 view this revision]",
 'recentchanges-legend' => 'सद्योजातानां परिवर्तनानां विकल्पाः',
 'recentchanges-summary' => 'अस्मिन् विकियोजनायां सद्योजातानि परिवर्तनानि दर्श्यन्ताम्',
 'recentchanges-feed-description' => 'अस्मिन् विकियोजनायां सद्योजातानि परिवर्तनानि दर्श्यन्ताम्',
-'recentchanges-label-newpage' => 'à¤\8fतसà¥\8dमातà¥\8d à¤¸à¤®à¥\8dपादनातà¥\8d à¤¨à¥\82तनà¤\82 à¤ªà¥\83षà¥\8dठà¤\82 à¤¸à¥\83षà¥\8dà¤\9fमसà¥\8dति',
+'recentchanges-label-newpage' => 'à¤\85नà¥\87न à¤¸à¤®à¥\8dपादनà¥\87न à¤¨à¥\82तनपà¥\83षà¥\8dठसà¥\8dय à¤°à¤\9aना à¤\85भà¥\82तà¥\8d à¥¤',
 'recentchanges-label-minor' => 'इदं लघु परिवर्तनम्',
-'recentchanges-label-bot' => 'à¤\8fतदà¥\8d à¤¯à¤¨à¥\8dतà¥\8dरà¥\87ण à¤\95à¥\83तà¤\82 à¤¸à¤®à¥\8dपादनमà¥\8d à¤\86सà¥\80त्',
-'recentchanges-label-unpatrolled' => 'à¤\8fतदà¥\8d à¤¸à¤®à¥\8dपादनमà¥\8d à¤\8fतावता à¤ªà¤°à¤¿à¤¶à¥\80लितà¤\82 à¤¨à¤¾à¤¸à¥\8dति ।',
+'recentchanges-label-bot' => 'बà¥\8bà¤\9fà¥\8d-दà¥\8dवारा à¤\95à¥\83तà¤\82 à¤¸à¤®à¥\8dपादनमà¥\87तत्',
+'recentchanges-label-unpatrolled' => 'à¤\8fतावता à¤\85सà¥\8dय à¤¸à¤®à¥\8dपादनसà¥\8dय à¤ªà¤°à¤¿à¤¶à¥\80लिनà¤\82 à¤¨à¤¾à¤­à¥\82तà¥\8d ।',
 'rcnotefrom' => "अधः '''$2''' तः  ('''$1''' पर्यन्तं) परिवर्तनानि दर्शितानि सन्ति ।",
-'rclistfrom' => '$1 à¤¤à¤\83 à¤\9cातानि à¤¨à¥\82तनानि à¤ªà¤°à¤¿à¤µà¤°à¥\8dतनानि à¤¦à¤°à¥\8dशà¥\8dयताम्',
-'rcshowhideminor' => '$1 à¤²à¤\98à¥\82नि सम्पादनानि',
+'rclistfrom' => '$1 à¤ªà¤¶à¥\8dà¤\9aातà¥\8d à¤\9cातानि à¤¨à¥\82तनानि à¤ªà¤°à¤¿à¤µà¤°à¥\8dतनानि à¤¦à¥\83शà¥\8dयनà¥\8dताम्',
+'rcshowhideminor' => '$1 à¤²à¤\98à¥\81सम्पादनानि',
 'rcshowhidebots' => '$1 बोट् इत्येतानि',
-'rcshowhideliu' => '$1 à¤ªà¥\8dरविषà¥\8dà¤\9fाः योजकाः',
+'rcshowhideliu' => '$1 à¤ªà¤\9eà¥\8dà¤\9cà¥\80à¤\95à¥\83ताः योजकाः',
 'rcshowhideanons' => 'अनामकाः योजकाः $1',
 'rcshowhidepatr' => '$1 ईक्षितसम्पादनानि',
 'rcshowhidemine' => '$1 मम सम्पादनानि',
-'rclinks' => 'à¤\85नà¥\8dतिमानि $1 à¤ªà¤°à¤¿à¤µà¤°à¥\8dतनानि à¤\85नà¥\8dतिमà¥\87षà¥\81 $2 à¤¦à¤¿à¤¨à¥\87षà¥\81, à¤¦à¥\83शà¥\8dयतामà¥\8d<br />$3',
+'rclinks' => 'à¤\85नà¥\8dतिमà¥\87षà¥\81 $2 à¤¦à¤¿à¤¨à¥\87षà¥\81 à¤\9cातानि à¤\85नà¥\8dतिमानि $1 à¤ªà¤°à¤¿à¤µà¤°à¥\8dतनानि à¤¦à¥\83शà¥\8dयतामà¥\8d <br />$3',
 'diff' => 'भेदः',
 'hist' => 'इतिहासः',
 'hide' => 'गोप्यताम्',
-'show' => 'दरà¥\8dश्यताम्',
+'show' => 'दà¥\83श्यताम्',
 'minoreditletter' => '(लघु)',
 'newpageletter' => '(नवीनम्)',
 'boteditletter' => '(बोट्)',
@@ -1567,7 +1568,7 @@ You can still [$1 view this revision]",
 'rc_categories_any' => 'कश्चित्',
 'rc-change-size-new' => '$1 {{PLURAL:$1|byte|bytes}} परिवर्तनपश्चात् ।',
 'newsectionsummary' => '/* $1 */ नवीन विभागः',
-'rc-enhanced-expand' => 'विवरणानि à¤¦à¤°à¥\8dशà¥\8dयनà¥\8dतामà¥\8d (à¤\9cावालिपिà¤\83 à¤\85पà¥\87à¤\95à¥\8dषà¥\8dयतà¥\87)',
+'rc-enhanced-expand' => 'विवरणानि à¤¦à¥\83शà¥\8dयनà¥\8dतामà¥\8d',
 'rc-enhanced-hide' => 'विवरणानि गोप्यन्ताम्',
 'rc-old-title' => 'मूलरूपेण $1 इति रचितम् ।',
 
@@ -1576,9 +1577,9 @@ You can still [$1 view this revision]",
 'recentchangeslinked-feed' => 'पृष्ठ-सम्बन्धितानि परिवर्तनानि',
 'recentchangeslinked-toolbox' => 'पृष्ठसम्बद्धानि परिवर्तनानि',
 'recentchangeslinked-title' => '"$1" इत्यस्मिन् जातानि परिवर्तनानि',
-'recentchangeslinked-summary' => "à¤\8fषा à¤µà¤¿à¤¶à¥\87षपà¥\83षà¥\8dठसमà¥\8dबदà¥\8dधà¥\87षà¥\81 à¤ªà¥\84षà¥\8dठà¥\87षà¥\81 à¤\85थवा à¤µà¤°à¥\8dà¤\97विशà¥\87षà¥\87 à¤\85नà¥\8dतरà¥\8dभà¥\82तà¥\87षà¥\81 à¤ªà¥\83षà¥\8dठà¥\87षà¥\81 à¤¸à¤¦à¥\8dयà¥\8bà¤\9cातानाà¤\82 à¤ªà¤°à¤¿à¤µà¤°à¥\8dतनानामà¥\8d à¤\86वलिà¤\83
+'recentchangeslinked-summary' => "विशà¥\87षपà¥\83षà¥\8dठà¥\87षà¥\81 à¤µà¤°à¥\8dà¤\97ानà¥\8dतरà¥\8dà¤\97तपà¥\83षà¥\8dठà¥\87षà¥\81 à¤µà¤¾ à¤¸à¤¦à¥\8dयà¥\8bà¤\9cातानाà¤\82 à¤ªà¤°à¤¿à¤µà¤°à¥\8dतनानामà¥\8d à¤\8fषा à¤\86वलिà¤\83 
 
-[[Special:Watchlist|भवतः अवेक्षणसूच्यां]] विद्यमानानि पृष्ठानि '''स्थूलाक्षरैः''' दर्शितानि।",
+[[Special:Watchlist|भवतः/भवत्याः अवेक्षणावलिः]] अत्र विद्यमानानि पृष्ठानि '''स्थूलाक्षरैः''' दर्शितानि।",
 'recentchangeslinked-page' => 'पृष्ठ-नाम :',
 'recentchangeslinked-to' => 'अस्मिन् स्थाने अस्य पृष्ठस्य संबद्धानां पृष्ठानां परिवर्तनानि दर्श्यन्ताम्',
 
@@ -1608,7 +1609,7 @@ To include a file in a page, use a link in one of the following forms:
 'uploadlogpagetext' => 'अधः सद्यः काले उत्तारितसञ्चिकानाम् आवली अस्ति ।
 अधिकदृश्यविवरणार्थम् एतत् पश्यतु [[Special:NewFiles|gallery of new files]]',
 'filename' => 'सञ्चिकानाम',
-'filedesc' => 'सारांशः :',
+'filedesc' => 'सारांशः',
 'fileuploadsummary' => 'संग्रहः :',
 'filereuploadsummary' => 'सञ्चिकापरिवर्तनानि ।',
 'filestatus' => 'प्रतिकृत्यधिकारस्य स्थितिः ।',
@@ -1837,22 +1838,22 @@ See https://www.mediawiki.org/wiki/Manual:Image_Authorization.',
 # File description page
 'file-anchor-link' => 'सञ्चिका',
 'filehist' => 'सञ्चिकायाः इतिहासः',
-'filehist-help' => 'सà¤\9eà¥\8dà¤\9aिà¤\95ा à¤¤à¤¤à¥\8dसमयà¥\87 à¤\95à¥\80दà¥\83शà¥\80 à¤\86सà¥\80दिति à¤¦à¥\8dरषà¥\8dà¤\9fà¥\81à¤\82 à¤¦à¤¿à¤¨à¤¾à¤\82कः/समयः नुद्यताम् ।',
+'filehist-help' => 'सà¤\9eà¥\8dà¤\9aिà¤\95ा à¤¤à¤¤à¥\8dसमयà¥\87 à¤\95à¥\80दà¥\83शà¥\80 à¤\86सà¥\80दिति à¤¦à¥\8dरषà¥\8dà¤\9fà¥\81à¤\82 à¤¦à¤¿à¤¨à¤¾à¤\99à¥\8dकः/समयः नुद्यताम् ।',
 'filehist-deleteall' => 'सर्वान् परिमर्जतु ।',
 'filehist-deleteone' => 'विलोप',
 'filehist-revert' => 'प्रतिनिवर्त्यताम्',
-'filehist-current' => 'सदà¥\8dयà¥\8bà¤\9cातमà¥\8d',
+'filehist-current' => 'वरà¥\8dतमानà¤\83',
 'filehist-datetime' => 'दिनाङ्कः/समयः',
-'filehist-thumb' => 'à¤\85à¤\82à¤\97à¥\81षà¥\8dठनà¤\96ाà¤\95ारमà¥\8d',
-'filehist-thumbtext' => '$1 à¤¸à¤®à¤¯à¥\87 à¤µà¤¿à¤¦à¥\8dयमानायाà¤\83 à¤\86वà¥\83तà¥\8dतà¥\87à¤\83 à¤\85à¤\82à¤\97à¥\81षà¥\8dठनà¤\96ाà¤\95ारमà¥\8d',
+'filehist-thumb' => 'लà¤\98à¥\8dवाà¤\95à¥\83तिà¤\83',
+'filehist-thumbtext' => '$1 à¤\87तà¥\8dयसà¥\8dय à¤¸à¤\82सà¥\8dà¤\95रणसà¥\8dय à¤²à¤\98à¥\81सà¥\8dवरà¥\82पमà¥\8d à¥¤',
 'filehist-nothumb' => 'अङ्गुष्टनखाकारकं नाश्ति ।',
 'filehist-user' => 'योजकः',
 'filehist-dimensions' => 'आयामाः',
 'filehist-filesize' => 'सञ्चिकाकारः ।',
 'filehist-comment' => 'टिप्पणी',
 'filehist-missing' => 'सञ्चिका विनष्टा ।',
-'imagelinks' => 'सà¤\82à¤\9aिà¤\95ा à¤¯à¤¤à¥\8dर à¤\89पयà¥\81à¤\95à¥\8dता',
-'linkstoimage' => '{{PLURAL:$1|अधोलिखितं पृष्ठं| अधोलिखितानि $1 पृष्ठाणि}} इदं संचिकां प्रति संबंधनं {{PLURAL:$1|करोति| कुर्वन्ति}}।',
+'imagelinks' => 'सà¤\9eà¥\8dà¤\9aिà¤\95ायाà¤\83 à¤\89पयà¥\8bà¤\97à¤\83',
+'linkstoimage' => '{{PLURAL:$1|अधो निर्दिष्टपृष्ठस्य परिसन्धयः|$1 अधो निर्दिष्टपृष्ठानां परिसन्धिः} अत्र {{PLURAL:$1|सल्लग्नाः सन्ति|सल्लग्ना अस्ति}}:',
 'linkstoimage-more' => '{{PLURAL:$1|$1}} तः अधिकपुटानि अस्यां सञ्चिकायां योज्यन्ते । 
 अधोनिदेशितसूची सञ्चिकाभिः योजनीयपुटानि पश्यति ।{{PLURAL:$1|$1 पृष्ठ|$1 पृष्ठ}} 
 [[Special:WhatLinksHere/$2|पूर्णसूची]] अपि लभ्यते ।',
@@ -1863,8 +1864,8 @@ See https://www.mediawiki.org/wiki/Manual:Image_Authorization.',
 'sharedupload' => 'इयं संचिका $1 इत्यस्मादस्ति, एषा खलु अन्येष्वपि प्रकल्पेषु प्रयोक्तुं शक्यते।',
 'sharedupload-desc-there' => 'एषा सञ्चिका $1 तथा अन्यप्रकल्पेन च उपयुक्ता ।
 इत्योप्यतिशयसूचनार्थं $2 सञ्चिकाविवरणपुटं पश्यतु ।',
-'sharedupload-desc-here' => 'एषा सञ्चिका $1 इत्यतः उद्धृता अन्यासु योजनासु उपयोगार्हा ।
-à¤\85सà¥\8dयाà¤\83 à¤¸à¤\9eà¥\8dà¤\9aिà¤\95ायाà¤\83  [$2 à¤¸à¤\9eà¥\8dà¤\9aिà¤\95ाविवरणपà¥\83षà¥\8dठमà¥\8d] à¤\87तà¥\8dयतà¥\8dर à¤\89पलभà¥\8dयमानà¤\82 à¤µà¤¿à¤µà¤°à¤£à¤®à¥\8d à¤\85धà¥\8bलिà¤\96ितà¤\82 à¤¯à¤¥à¤¾ ।',
+'sharedupload-desc-here' => '$1 इत्यतः उद्धृता एषा सञ्चिका अन्येषु प्रकल्पेषु उपयोगार्हा ।
+à¤\85सà¥\8dयाà¤\83 à¤¸à¤\9eà¥\8dà¤\9aिà¤\95ायाà¤\83  [$2 à¤¸à¤\9eà¥\8dà¤\9aिà¤\95ाविवरणपà¥\83षà¥\8dठमà¥\8d] à¤\87तà¥\8dयतà¥\8dर à¤\89पलभà¥\8dयमानà¤\82 à¤µà¤¿à¤µà¤°à¤£à¤®à¥\8d à¤\85धà¥\8bलिà¤\96ितà¤\82 à¤µà¤°à¥\8dततà¥\87 ।',
 'sharedupload-desc-edit' => '    एषा सञ्चिका $1 इत्यतः उद्धृता अन्यासु योजनासु उपयोगार्हा । 
 अस्याः सञ्चिकायाः [$2 सञ्चिकाविवरणपृष्ठम्] इत्यत्र उपलभ्यमानं विवरणम् अधोलिखितं यथा ।',
 'sharedupload-desc-create' => 'एषा सञ्चिका $1 इत्यतः उद्धृता अन्यासु योजनासु उपयोगार्हा । 
@@ -2181,7 +2182,7 @@ See https://www.mediawiki.org/wiki/Manual:Image_Authorization.',
 
 # Watchlist
 'watchlist' => 'मम अवेक्षणसूची',
-'mywatchlist' => 'मम à¤\85वà¥\87à¤\95à¥\8dषणसà¥\82à¤\9aà¥\80',
+'mywatchlist' => 'à¤\85वà¥\87à¤\95à¥\8dषणावलिà¤\83',
 'watchlistfor2' => 'हि $1 $2',
 'nowatchlist' => 'अवलोकनावल्यां पदार्थः नास्ति ।',
 'watchlistanontext' => 'अवलोकनपट्टिकायां पुटं दृष्टुं सम्पादयितुं वा  $1  करोतु ।',
@@ -2398,7 +2399,7 @@ $2 द्वारा सम्पादितां अन्तिमावृ
 'undeleterevision-missing' => 'अमान्या अथवा विलुप्ता पुनरावृत्तिः । भवान् प्रदुष्टानुबन्धयुक्तः अथवा पुनरावृत्तिः पुनस्थापिता अथवा लेखागारात् अपनीता ।',
 'undelete-nodiff' => 'पूर्वतनपुनरावृत्तिः न दृष्टा ।',
 'undeletebtn' => 'पुन्थापयतु ।',
-'undeletelink' => 'दà¥\83शà¥\8dयतामà¥\8d/पà¥\8dरतà¥\8dयानà¥\80यतामà¥\8d',
+'undeletelink' => 'दृश्यताम्/प्रत्यानयताम्',
 'undeleteviewlink' => 'दृश्यताम्',
 'undeleteinvert' => 'चयनं परिवर्तयतु ।',
 'undeletecomment' => 'कारणम् :',
@@ -2427,8 +2428,8 @@ $2 द्वारा सम्पादितां अन्तिमावृ
 'undelete-show-file-submit' => 'आम्',
 
 # Namespace form on various pages
-'namespace' => 'नामाकाशः :',
-'invert' => 'à¤\9aयनà¤\82 à¤µà¤¿à¤ªà¤°à¥\80तà¥\80à¤\95रà¥\8bतà¥\81',
+'namespace' => 'नामाकाशः:',
+'invert' => 'विरà¥\81दà¥\8dधà¤\9aयनमà¥\8d',
 'tooltip-invert' => 'चितनामस्थाने परिवर्तनं गोपयितुं मञ्जूषाम् अर्गलयतु ।',
 'namespace_association' => 'सम्बद्धं नामस्थानम् ।',
 'tooltip-namespace_association' => 'चितनामस्थानेन सह सम्बद्धं विषयनामस्थानम् अथवा सम्भाषणम् अपि उपादातुम् इमां मञ्जूषाम् अर्गलयतु ।',
@@ -2437,7 +2438,7 @@ $2 द्वारा सम्पादितां अन्तिमावृ
 # Contributions
 'contributions' => 'प्रयोक्तॄणां योगदानानि',
 'contributions-title' => '$1 इत्येतस्य कृते योजकानां योगदानानि',
-'mycontris' => 'मम à¤¯à¥\8bà¤\97दानानि',
+'mycontris' => 'योगदानानि',
 'contribsub2' => '$1 इत्येतदर्थम् ($2)',
 'nocontribs' => 'एतादृशयोग्यताभिः समं परिवर्तनानि न दृष्टानि ।',
 'uctop' => '(शीर्षम्)',
@@ -2507,7 +2508,7 @@ $2 द्वारा सम्पादितां अन्तिमावृ
 'ipbenableautoblock' => 'अनेन योजकेन उपयुक्तम् ऐपिसङ्केतम्, अग्रे अनेन योजकेन सम्पादयितुं प्रयतमानम् ऐपिसङ्केतं च स्वयम् अवरुद्धं करोतु ।',
 'ipbsubmit' => 'एतं योजकम् अवरुणद्धु ।',
 'ipbother' => 'अन्यः समयः ।',
-'ipboptions' => '२ à¤¹à¥\8bराà¤\83:2 hours,१ à¤¦à¤¿à¤¨à¤®à¥\8d:1 day,३ à¤¦à¤¿à¤¨à¤¾à¤¨à¤¿:3 days,१ à¤¸à¤ªà¥\8dताहà¤\83:1 week,२ à¤¸à¤ªà¥\8dताहà¥\8c:2 weeks,१ à¤®à¤¾à¤¸à¤\83:1 month,३ à¤®à¤¾à¤¸à¤¾à¤\83:3 months,६ à¤®à¤¾à¤¸à¤¾à¤\83:6 months,१ à¤µà¤°à¥\8dषà¤\83:1 year,अनन्तम्:infinite',
+'ipboptions' => '२ à¤¹à¥\8bरà¥\87:2 hours,१ à¤¦à¤¿à¤¨à¤®à¥\8d:1 day,३ à¤¦à¤¿à¤¨à¤¾à¤¨à¤¿:3 days,१ à¤¸à¤ªà¥\8dताहà¤\83:1 week,२ à¤¸à¤ªà¥\8dताहà¥\8c:2 weeks,१ à¤®à¤¾à¤¸à¤\83:1 month,३ à¤®à¤¾à¤¸à¤¾à¤\83:3 months,६ à¤®à¤¾à¤¸à¤¾à¤\83:6 months,१ à¤µà¤°à¥\8dषमà¥\8d:1 year,अनन्तम्:infinite',
 'ipbhidename' => 'सम्पादनेभ्यः आवलीभ्यः च योजकनाम सङ्गोपयतु ।',
 'ipbwatchuser' => 'अस्य योजकस्य योजकपुटानि सम्भाषणपुटानि च अवलोकयतु ।',
 'ipb-disableusertalk' => 'एतं योजकम् अवरोधकाले स्वस्य सम्भाषणपुटस्य सम्पानात् निवारयतु ।',
@@ -2556,8 +2557,8 @@ $2 द्वारा सम्पादितां अन्तिमावृ
 'ipblocklist-empty' => 'अवरोधावली रिक्ता अस्ति ।',
 'ipblocklist-no-results' => 'अभ्यर्थितः ऐपिसङ्केतः अथवा अभ्यर्थितः योजकनाम अवरुद्धं न ।',
 'blocklink' => 'अवरुद्ध्यताम्',
-'unblocklink' => 'निरà¥\8bधà¤\83 à¤\85पास्यताम्',
-'change-blocklink' => 'विभाà¤\97ः परिवर्त्यताम्',
+'unblocklink' => 'à¤\85वरà¥\8bधà¤\83 à¤¨à¤¿à¤°à¤¸à¥\8dत्यताम्',
+'change-blocklink' => 'à¤\85वरà¥\8bधः परिवर्त्यताम्',
 'contribslink' => 'योगदानम्',
 'emaillink' => 'विद्युन्मानपत्रं प्रेषयतु ।',
 'autoblocker' => 'भवतः ऐपि सङ्केतः स्वयम् अवरुद्धः यः सद्यः काले एव [[User:$1|$1]]" इत्यनेन उपयुक्तः । 
@@ -2686,7 +2687,7 @@ $2 इति प्रकारस्य अवरोधं कर्तुं 
 'movesubpagetext' => '$1 {{PLURAL:$1|उपपुटम्|उपपुटानि }}अस्य पुटस्य उपपुटानि अधः दर्शितानि ।',
 'movenosubpage' => 'अस्य पुटस्य उपपुटानि न सन्ति ।',
 'movereason' => 'कारणम् :',
-'revertmove' => 'पà¥\8dरतिनिवरà¥\8dतà¥\8dयताम्',
+'revertmove' => 'पà¥\8dरतà¥\8dयावरà¥\8dतनम्',
 'delete_and_move' => 'अपमर्जनं चालनं च ।',
 'delete_and_move_text' => '==अपमर्जनम् आवश्यकम्==
 लक्षितपुटं "[[:$1]]" पूर्वमेव अस्ति ।
@@ -2714,7 +2715,7 @@ $2 इति प्रकारस्य अवरोधं कर्तुं 
 'file-exists-sharedrepo' => 'विभक्तकोशे चितसञ्चिकानाम प्रथममेव उपयोगे अस्ति  । अन्यं नाम चिनोतु ।',
 
 # Export
-'export' => 'पà¥\83षà¥\8dठानाà¤\82 à¤¨à¤¿à¤°à¥\8dयातà¤\82 à¤\95रà¥\8bतà¥\81',
+'export' => 'पà¥\83षà¥\8dठानि à¤\85नà¥\8dयतà¥\8dर à¤ªà¥\8dरà¥\87षà¥\8dयतामà¥\8d',
 'exporttext' => 'विशेष पुटस्य पाठम् अथवा सम्पादनेतिहासं निर्हर्तुं शक्नोति । अथवा पुटसमूहम् उपोतं कर्तुमपि शक्नोति ।
 एतत् [[Special:Import|आयातपुटं]] अस्य साहाय्येन मीडियाविक्याः प्रयोगं कृत्वा अन्यविकीतः आयातं कर्तुं शक्नोति ।
 पुटानि नर्हर्तुम् अधो दत्तपाठमञ्जूषायां शीर्शकं लिखतु । एकस्य शीर्षकस्य एका पङ्क्तिः । अपि च वर्तमानावृत्त्या सह प्राचीनावृत्तिमपि इच्छति वा नेति अथवा गतसम्पादनस्य विषयज्ञानेन सह केवलं वर्नमानावृत्तिम् इच्छाति । 
@@ -2841,15 +2842,15 @@ $2 इति प्रकारस्य अवरोधं कर्तुं 
 'tooltip-pt-logout' => 'निर्गमनम्',
 'tooltip-ca-talk' => 'पृष्ठाऽन्तर्गताय विषयाय चर्चा',
 'tooltip-ca-edit' => 'इदं पृष्ठं सम्पादयितुं शक्यते । रक्षणात्पूर्वं कृपया प्राग्दृश्यं दृश्यताम् ।',
-'tooltip-ca-addsection' => 'नà¥\82तनà¤\83 à¤µà¤¿à¤­à¤¾à¤\97à¤\83 à¤\86रभà¥\8dयतामà¥\8d',
+'tooltip-ca-addsection' => 'नूतनविभागः आरभ्यताम्',
 'tooltip-ca-viewsource' => 'इदं पृष्ठं संरक्षितं विद्यते । अस्य स्रोतं द्रष्टुं शक्यते ।',
 'tooltip-ca-history' => 'अस्य पृष्ठस्य पुरातनाऽऽवृत्तिः',
 'tooltip-ca-protect' => 'इदं पृष्ठं संरक्ष्यताम्',
 'tooltip-ca-unprotect' => 'अस्य पुटास्य सुरक्षां परिवर्तयतु ।',
 'tooltip-ca-delete' => 'इदं पृष्ठम् अपाक्रियताम्',
 'tooltip-ca-undelete' => 'अस्य पुटस्य अपमर्जनात् पूर्वम् अस्य सम्पादनानि पुनस्थापयतु ।',
-'tooltip-ca-move' => 'à¤\87दà¤\82 à¤ªà¥\83षà¥\8dठà¤\82 à¤\9aाल्यताम्',
-'tooltip-ca-watch' => 'इदं पृष्ठं भवतः अवेक्षणसूच्यां योज्यताम्',
+'tooltip-ca-move' => 'à¤\85सà¥\8dय à¤ªà¥\83षà¥\8dठसà¥\8dय à¤¨à¤¾à¤® à¤ªà¤°à¤¿à¤µà¤°à¥\8dत्यताम्',
+'tooltip-ca-watch' => 'इदं पृष्ठं भवतः/भवत्याः अवेक्षणावल्यां योज्यताम्',
 'tooltip-ca-unwatch' => 'इदं पृष्ठं भवतः अवेक्षणसूच्याः निष्कास्यताम्',
 'tooltip-search' => '{{SITENAME}} अन्विष्यताम्',
 'tooltip-search-go' => 'समानशिरोनामयुक्तं पृष्ठं विद्यते चेत् तत्र गम्यताम्',
@@ -2884,8 +2885,8 @@ $2 इति प्रकारस्य अवरोधं कर्तुं 
 'tooltip-ca-nstab-category' => 'वर्गाणां पृष्ठं दृश्यताम्',
 'tooltip-minoredit' => 'इदं परिवर्तनं लघुपरिवर्तनरूपेण अङ्क्यताम्',
 'tooltip-save' => 'परिवर्तनानि रक्ष्यन्ताम्',
-'tooltip-preview' => 'भवता कृतानां परिवर्तनानां प्राग्दृश्यं दृश्यताम्, रक्षणात्पूर्वं कृपया इदम् उपयुज्यताम्।',
-'tooltip-diff' => 'पाठà¥\87 à¤­à¤µà¤¤à¤¾ à¤\95à¥\83तानि à¤ªà¤°à¤¿à¤µà¤°à¥\8dतनानि à¤¦à¥\83शà¥\8dयनà¥\8dतामà¥\8d।',
+'tooltip-preview' => 'भवता/भवत्या कृतानां परिवर्तनानां प्राग्दृश्यं दृश्यताम्, रक्षणात्पूर्वं कृपया इदम् उपयुज्यताम्।',
+'tooltip-diff' => 'भवता/भवतà¥\8dया à¤\85तà¥\8dर à¤\95à¥\83तानि à¤ªà¤°à¤¿à¤µà¤°à¥\8dतनानि à¤¦à¥\8dरषà¥\8dà¤\9fà¥\81à¤\82 à¤¶à¤\95à¥\8dयतà¥\87',
 'tooltip-compareselectedversions' => 'पृष्ठस्य द्वयोः चितयोः आवृत्त्योः भेदः दृश्यताम्',
 'tooltip-watch' => 'इदं पृष्ठं भवतः अवेक्षणसूच्यां योज्यताम्',
 'tooltip-watchlistedit-normal-submit' => 'शीर्षकानि अपनयतु ।',
@@ -2897,7 +2898,7 @@ $2 इति प्रकारस्य अवरोधं कर्तुं 
 
 अस्य सारांशे अपाकरणस्य कारणमपि लेखितुं शक्यते ।',
 'tooltip-preferences-save' => 'आद्यताः रक्षतु ।',
-'tooltip-summary' => 'सà¤\82à¤\95à¥\8dषिपà¥\8dतà¤\83 सारांशः योज्यताम्',
+'tooltip-summary' => 'सà¤\99à¥\8dà¤\95à¥\8dषिपà¥\8dतसारांशः योज्यताम्',
 
 # Metadata
 'notacceptable' => 'भवतः ग्रहकस्य पठनेच्छारूपेण विकिवितारकः दत्तपाठं प्रकल्पितुं नैव शक्नोति ।',
@@ -3012,13 +3013,13 @@ $2 इति प्रकारस्य अवरोधं कर्तुं 
 'thumbsize' => 'सङ्कुचितास्य आकारः ।',
 'widthheightpage' => '$1 × $2, $3 {{PLURAL:$1|पुटम्|पुटानि}} प्रयुक्तानि ।',
 'file-info' => 'सञ्चिकाकारः : $1, MIME प्रकारः $2',
-'file-info-size' => '$1 Ã\97 $2 à¤ªà¤¿à¤\95à¥\8dसà¥\87लानि, à¤¸à¤\82चिकायाः आकारः: $3, MIME-प्रकारः: $4',
+'file-info-size' => '$1 Ã\97 $2 à¤\9aितà¥\8dराणवà¤\83 (pixels), à¤¸à¤\9eà¥\8dचिकायाः आकारः: $3, MIME-प्रकारः: $4',
 'file-info-size-pages' => '$1 × $2  पिक्सेल्, सञ्चिकायाः आकारः :  $3 , MIME प्रकारः :  $4 ,  $5   {{PLURAL:$5|पुटम्|पुटानि}}',
 'file-nohires' => 'उच्चतरं विभेदनं नोपलब्धम्',
 'svg-long-desc' => 'SVG संचिका, साधारणतया $1 × $2 पिक्सेलानि, संचिकायाः आकारः : $3',
 'svg-long-desc-animated' => 'आश्वसिता SVG संचिका, साधारणतया $1 × $2 पिक्सेलानि, संचिकायाः आकारः : $3',
 'svg-long-error' => 'एषा अमान्या SVG सञ्चिका : $1',
-'show-big-image' => 'पà¥\82रà¥\8dणà¤\82 à¤µà¤¿à¤­à¥\87दनमà¥\8d',
+'show-big-image' => 'मà¥\82लसà¤\9eà¥\8dà¤\9aिà¤\95ा',
 'show-big-image-preview' => 'अस्य पूर्वावलोकनस्य आकारः : $1',
 'show-big-image-other' => 'अन्याः {{PLURAL:$2| प्रस्तवः|प्रस्तावाः}}:  $1 ।',
 'show-big-image-size' => '$1 × $2  पिक्सेल्',
@@ -3058,10 +3059,10 @@ $2 इति प्रकारस्य अवरोधं कर्तुं 
 पङ्क्त्यां विद्यमाना प्रथमा परिसन्धिः (link) दोषपूर्णया सञ्चिकया सह परिसन्धिता (linked) स्यादेव । तस्यामेव पङ्क्तौ उत्तरोत्तरं विद्यमानाः परिसन्धयः अपवादिताः ज्ञेयाः, अर्थात् अत्र तेषां पृष्ठानाम् आवलिरेव भविष्यति, येषु एषा सञ्चिका विद्यते ।',
 
 # Metadata
-'metadata' => 'à¤\85धिदतà¥\8dतानि',
-'metadata-help' => 'à¤\85सà¥\8dयाà¤\82 à¤¸à¤\9eà¥\8dà¤\9aिà¤\95ायामà¥\8d à¤\85तिरिà¤\95à¥\8dताà¤\83 à¤µà¤¿à¤·à¤¯à¤¾à¤\83 à¤¸à¤¨à¥\8dति, à¤\95दाà¤\9aितà¥\8d à¤\86à¤\82à¤\95िà¤\95-à¤\9bायाà¤\9aितà¥\8dरà¤\97à¥\8dराहà¤\95à¥\87न à¤¸à¥\8dà¤\95à¥\8dयानरà¥\8d à¤\87तà¥\8dयनà¥\87न à¤µà¤¾ à¤¸à¥\8dरषà¥\8dà¤\9fाà¤\83 à¤µà¤¾ à¤\86à¤\82à¤\95िà¤\95à¥\80à¤\95à¥\83ताà¤\83 à¤µà¤¾ à¤¸à¥\8dयà¥\81à¤\83 à¥¤
+'metadata' => 'पà¥\8dरदतà¥\8dताà¤\82शà¤\83 (दतà¥\8dताà¤\82शविषयà¤\95दतà¥\8dताà¤\82शà¤\83 à¤\85यमà¥\8d)',
+'metadata-help' => 'à¤\85नà¥\87न à¤¸à¤¹ à¤µà¤¿à¤¸à¥\8dतà¥\83तमाहितà¥\80 à¤¸à¤²à¥\8dलà¤\97à¥\8dना à¤\85सà¥\8dति, à¤ªà¥\8dरतिबिमà¥\8dबà¤\97à¥\8dराहà¤\95à¥\87न (scanner) à¤\85à¤\99à¥\8dà¤\95à¥\80यà¤\9bायाà¤\9aितà¥\8dरà¤\97à¥\8dराहà¤\95à¥\87न (digital camera ) à¤µà¤¾ à¤\85सà¥\8dयाà¤\83 à¤¸à¤\9eà¥\8dà¤\9aिà¤\95ायाà¤\83 à¤°à¤\9aना à¤\9cाता à¤¸à¥\8dयातà¥\8d à¥¤ 
 
-यदि à¤\8fषा à¤¸à¤\9eà¥\8dà¤\9aिà¤\95ा à¤®à¥\82लावसà¥\8dथातà¤\83 à¤ªà¤°à¤¿à¤µà¤°à¥\8dतिता à¤\85सà¥\8dति, à¤¤à¤°à¥\8dहि à¤\85तà¥\8dर à¤\95ानिà¤\9aिदà¥\8d à¤µà¤¿à¤µà¤°à¤£à¤¾à¤¨à¤¿ à¤ªà¤°à¤¿à¤µà¤°à¥\8dतिताà¤\82 à¤¸à¤\82à¤\9aिà¤\95ाà¤\82 à¤ªà¥\82रà¥\8dणतया à¤¨ à¤ªà¥\8dरदरà¥\8dशयà¥\87यà¥\81à¤\83 ।',
+à¤\8fषा à¤¸à¤\9eà¥\8dà¤\9aिà¤\95ा à¤¯à¤¦à¤¿ à¤®à¥\82लावसà¥\8dथातà¥\8d à¤ªà¤°à¤¿à¤µà¤°à¥\8dतà¥\8dयतà¥\87, à¤¤à¤°à¥\8dहि à¤\85तà¥\8dरसà¥\8dथानि à¤\95ानिà¤\9aितà¥\8d à¤µà¤¿à¤µà¤°à¤£à¤¾à¤¨à¤¿ à¤ªà¤°à¤¿à¤µà¤°à¥\8dतितसà¤\9eà¥\8dà¤\9aिà¤\95ायाà¤\82 à¤ªà¥\82रà¥\8dणतया à¤¨ à¤¦à¥\83शà¥\8dयनà¥\8dतà¥\87 ।',
 'metadata-expand' => 'विस्तारितानि विवरणानि दर्शयतु',
 'metadata-collapse' => 'विस्तारितानि विवरणानि लोपयतु',
 'metadata-fields' => 'अस्मिन् तालिकायां दर्शिता सूचना संचिकायाः अधस्तात् मेटाडाटा इत्यस्मिन् सदा दर्शिता भविष्यति।
index 9f2bb2f..362471b 100644 (file)
@@ -49,7 +49,7 @@ $messages = array(
 'tog-enotifminoredits' => 'Send me ae wab-mail fer wee eedits o pages n files ava',
 'tog-enotifrevealaddr' => 'Shaw ma email address in notification mails',
 'tog-shownumberswatching' => 'Shaw the nummer o watching uisers',
-'tog-oldsig' => 'Existin signatur:',
+'tog-oldsig' => 'Exeestin signatur:',
 'tog-fancysig' => 'Treat signature as wikitext (wioot aen autæmatic airtin)',
 'tog-uselivepreview' => 'Uise live luik ower (experimental)',
 'tog-forceeditsummary' => 'Gie me ae jottin when Ah dinnae put in aen eidit owerview',
@@ -94,7 +94,7 @@ $messages = array(
 'january' => 'Januair',
 'february' => 'Febuair',
 'march' => 'Mairch',
-'april' => 'Aprile',
+'april' => 'Apryle',
 'may_long' => 'Mey',
 'june' => 'Juin',
 'july' => 'Julie',
@@ -104,7 +104,7 @@ $messages = array(
 'november' => 'November',
 'december' => 'December',
 'january-gen' => 'Januair',
-'february-gen' => 'Februar',
+'february-gen' => 'Febuair',
 'march-gen' => 'Mairch',
 'april-gen' => 'Aprile',
 'may-gen' => 'Mey',
@@ -114,7 +114,7 @@ $messages = array(
 'september-gen' => 'September',
 'october-gen' => 'October',
 'november-gen' => 'November',
-'december-gen' => 'December',
+'december-gen' => 'Dizember',
 'jan' => 'Jan',
 'feb' => 'Feb',
 'mar' => 'Mai',
@@ -242,8 +242,8 @@ $messages = array(
 'mediawikipage' => 'View message page',
 'templatepage' => 'View template page',
 'viewhelppage' => 'View help page',
-'categorypage' => 'Scance category page',
-'viewtalkpage' => 'Scance ower collogue',
+'categorypage' => 'See categerie page',
+'viewtalkpage' => 'See tauk',
 'otherlanguages' => 'In ither leids',
 'redirectedfrom' => '(Reguidit frae $1)',
 'redirectpagesub' => 'Reguidal page',
@@ -300,9 +300,9 @@ $1',
 'editold' => 'eedit',
 'viewsourceold' => 'ken soorce',
 'editlink' => 'eedit',
-'viewsourcelink' => 'view soorce',
+'viewsourcelink' => 'see soorce',
 'editsectionhint' => 'Eedit section: $1',
-'toc' => 'Table o contents',
+'toc' => 'Contents',
 'showtoc' => 'shaw',
 'hidetoc' => 'scouk',
 'collapsible-collapse' => 'Collapse.',
@@ -317,7 +317,7 @@ $1',
 'site-atom-feed' => '$1 Atom Feed',
 'page-rss-feed' => '"$1" RSS Feed',
 'page-atom-feed' => '"$1" Atom Feed',
-'red-link-title' => '$1 (page disna exist)',
+'red-link-title' => '$1 (page disna exeest)',
 'sort-descending' => 'Sort descending.',
 'sort-ascending' => 'Sort ascending.',
 
@@ -335,9 +335,9 @@ $1',
 
 # Main script and global functions
 'nosuchaction' => 'Nae sic action',
-'nosuchactiontext' => "The action specifiee'd bi the URL isna recognised
-Ye micht hae mistyped the URL, or follaed a wrang link
-This micht forby be caused by a bug in the saftware uised by {{SITENAME}}.",
+'nosuchactiontext' => 'The action speceefieed bi the URL isna recognised
+Ye micht hae mistyped the URL, or follaed ae wrang link
+This micht forby be caused bi ae bug in the saffware uised bi {{SITENAME}}.',
 'nosuchspecialpage' => 'Nae sic byordinar page',
 'nospecialpagetext' => '<strong>Ye hae requestit aen onvalid byordinar page.</strong>
 
@@ -392,7 +392,7 @@ It gae nae explanâtion.',
 'perfcachedts' => 'The follaein data is cached, n wis hindermaist updated $1. Ae maist muckkle o {{PLURAL:$4|yin result is|$4 results ar}} available in the cache.',
 'querypage-no-updates' => 'Updates for this page ar disablit at the meenit. Data here wilnae be refreshit at the meenit.',
 'viewsource' => 'View soorce',
-'viewsource-title' => 'View soorce fer $1',
+'viewsource-title' => 'See soorce fer $1',
 'actionthrottled' => 'Action devalit',
 'actionthrottledtext' => "Aes aen anti-spam meisur, ye'r limitit fae daein this action ower monie times in aen ower short time, n ye'v exceedit this limit. Please try again in ae few minutes.",
 'protectedpagetext' => 'This page haes been protected fer tae hider eeditin or ither actions.',
@@ -440,11 +440,11 @@ Ye can chynge yer {{SITENAME}} [[Special:Preferences|preeferences]] gif ye like.
 'userlogin-yourname' => 'Uisername',
 'userlogin-yourname-ph' => 'Enter yer uisername',
 'createacct-another-username-ph' => 'Enter the uisername',
-'yourpassword' => 'Passwird:',
+'yourpassword' => 'Passwaird:',
 'userlogin-yourpassword' => 'Passwaird.',
 'userlogin-yourpassword-ph' => 'Enter yer passwaird',
 'createacct-yourpassword-ph' => 'Enter ae passwaird',
-'yourpasswordagain' => 'Retype passwird:',
+'yourpasswordagain' => 'Retype passwaird:',
 'createacct-yourpasswordagain' => 'Confirm passwaird.',
 'createacct-yourpasswordagain-ph' => 'Enter passwaird again.',
 'remembermypassword' => 'Mynd ma login oan this brouser (fer $1 {{PLURAL:$1|day|days}} at the maist)',
@@ -682,8 +682,8 @@ Ye shid dae it gif ye accidentally shaired theim wi somebodie or gif yer accoont
 'minoredit' => 'This is ae smaa eedit',
 'watchthis' => 'Leuk ower this page',
 'savearticle' => 'Hain page',
-'preview' => 'Scance',
-'showpreview' => 'Scance ower',
+'preview' => 'Luikower',
+'showpreview' => 'Shaw luikower',
 'showlivepreview' => 'Live leuk ower',
 'showdiff' => 'Shaw chynges',
 'anoneditwarning' => "<strong>Warnishment:</strong>Ye'r naw loggit in. Yer IP address will be recordit in this page's eedit histerie.",
@@ -727,15 +727,15 @@ Please incluid aw abuin details in onie speirins that ye mak.',
 'whitelistedittext' => 'Pleas $1 tae eedit pages.',
 'confirmedittext' => 'Ye maun confirm yer wab-mail address afore eeditin pages. Please set n validate yer wab-mail address throogh yer [[Special:Preferences|uiser settins]].',
 'nosuchsectiontitle' => 'Canna find section',
-'nosuchsectiontext' => 'Ye tried tae eidit ae section that disna exist.
-It micht hae been muived or delytit while ye were viewing the page.',
+'nosuchsectiontext' => 'Ye tried tae eedit ae section that disna exeest.
+It micht hae been muived or delytit while ye were luikin at the page.',
 'loginreqtitle' => 'Login Requirit!',
 'loginreqlink' => 'log in',
 'loginreqpagetext' => 'Please $1 tae see ither pages.',
 'accmailtitle' => 'Passwaird sent.',
 'accmailtext' => 'Ae randomly generated passwaird fer [[User talk:$1|$1]] haes been sent til $2. It can be chynged oan the <em>[[Special:ChangePassword|chynge passwaird]]</em> page upo loggin in.',
 'newarticle' => '(New)',
-'newarticletext' => "Ye'v follaed ae link til ae page that disna exist yet. Tae mak the page, stairt typin in the kist ablo (see the [[{{MediaWiki:Helppage}}|heelp page]] fer mair info). Gif ye'r here bi mistak, juist clap yer brouser's '''back''' button.",
+'newarticletext' => "Ye'v follaed ae link til ae page that disna exeest yet. Tae cræft the page, stairt typin in the kist ablo (see the [[{{MediaWiki:Helppage}}|heelp page]] fer mair info). Gif ye'r here bi mistak, jist clap yer brouser's <strong>back</strong> button.",
 'anontalkpagetext' => "----
 <em>This is the discussion page fer aen anonymoos uiser that's naw cræftit aen accoont yet, or that disna uise it.</em>
 We maun therefore uise the numerical IP address tae identifie him/her.
@@ -747,9 +747,9 @@ Ye can [[Special:Search/{{PAGENAME}}|rake fer this page teitle]] in ither pages,
  or [{{fullurl:{{FULLPAGENAME}}|action=edit}} eidit this page].</span>',
 'noarticletext-nopermission' => 'There isna oni tex in this page the nou.
 Ye can [[Special:Search/{{PAGENAME}}|rake fer this page title]] in ither pages, or <span class="plainlinks">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} rake the relatit logs]</span>, but ye dina hae permeession tae mak this page.',
-'missing-revision' => 'The reveesion #$1 o the page named "{{PAGENAME}}" disna exist.
+'missing-revision' => 'The reveesion #$1 o the page named "{{PAGENAME}}" disna exeest.
 
-This is usuallie caused bi follaein aen ootdated histerie link til ae page that haes been delytit.
+This is uissuallie caused bi follaein aen ootdated histerie link til ae page that haes been delytit.
 Details can be foond in the [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} delytion log].',
 'userpage-userdoesnotexist' => 'Uiser accoont "<nowiki>$1</nowiki>" hasnae been registerit. Please check gin ye wint tae mak or eidit this page.',
 'userpage-userdoesnotexist-view' => 'Uiser accoont "$1" isna registered.',
@@ -775,7 +775,7 @@ It's no been hained yet!</strong>",
 'previewnote' => '<strong>Mynd that this is yinly ae scænce-ower.</strong>
 Yer chynges hae no been hained yet!',
 'continue-editing' => 'Gae til eiditing area',
-'previewconflict' => 'This scance reflects the tex in the upper tex eiditin area like it will kythe gin ye chuise tae hain.',
+'previewconflict' => 'This luikower reflects the tex in the upper tex eeditin airt like it will kith gif ye chuise tae hain.',
 'session_fail_preview' => "'''Sairy! We culdnae process yer eidit acause o ae loss o term data.'''
 Please gie it anither gae. Gin it disnae wairk still, gie [[Special:UserLogout|loggin oot]] n loggin back in again ae gae.",
 'session_fail_preview_html' => '<strong>Sairrie! We coudna process yer eedit cause o ae loss o session data.</strong>
@@ -897,9 +897,9 @@ Thir arguments hae been left oot.',
 
 # Account creation failure
 'cantcreateaccounttitle' => 'Canna mak accoont',
-'cantcreateaccount-text' => "Accoont makkin frae this IP address ('''$1''') haes been blockit by [[User:$3|$3]].
+'cantcreateaccount-text' => "Accoont cræftin fae this IP address ('''$1''') haes been blockit bi [[User:$3|$3]].
 
-The grund for this, given by $3 is ''$2''",
+The raison fer this, gien bi $3 is ''$2''",
 'cantcreateaccount-range-text' => "Accoont cræftin fae IP addresses in the range '''$1''', that inclædes yer IP address ('''$4'''), haes been blockit bi [[User:$3|$3]].
 
 The raison gien bi $3 is ''$2''",
@@ -907,13 +907,13 @@ The raison gien bi $3 is ''$2''",
 # History pages
 'viewpagelogs' => 'Leuk at logs fer this page',
 'nohistory' => "Thaur's nae eedit histerie fer this page.",
-'currentrev' => 'Current reveision',
+'currentrev' => 'Reveesion the nou',
 'currentrev-asof' => 'Latest reveesion aes o $1',
-'revisionasof' => 'Reveision as o $1',
+'revisionasof' => 'Reveesion aes o $1',
 'revision-info' => 'Reveesion aes o $1 bi $2',
-'previousrevision' => '← Aulder reveision',
-'nextrevision' => 'Newer reveision →',
-'currentrevisionlink' => 'see current reveision',
+'previousrevision' => '← Aulder reveesion',
+'nextrevision' => 'Newer reveesion →',
+'currentrevisionlink' => 'Latest reveesion',
 'cur' => 'nou',
 'next' => 'neist',
 'last' => 'hind',
@@ -966,16 +966,20 @@ Ye can still [$1 view this diff] gif ye wish tee proceed.',
 Ye can see this diff; details can be foond in the [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} delytion log].",
 'rev-suppressed-diff-view' => 'Yin o the reveesions o this diff haes been <strong>suppressed</strong>.
 Ye can view this diff; details can be foond in the [{{fullurl:{{#Special:Log}}/suppress|page={{FULLPAGENAMEE}}}} suppression log].',
-'rev-delundel' => 'chynge veesibility',
+'rev-delundel' => 'chynge veesibilitie',
 'rev-showdeleted' => 'shaw',
 'revisiondelete' => 'Delyte/ondelyte reveesions',
 'revdelete-nooldid-title' => 'Onvalid target reveesion',
 'revdelete-nooldid-text' => "Aither ye'v naw speceefied ae tairget reveesion(s) tae perform this function, the speceefied reveesion disna exeest, or ye'r attemptin tae skauk the Nou reveesion.",
-'revdelete-no-file' => 'The file speecified disna exist.',
+'revdelete-no-file' => 'The file speceefied disna exeest.',
 'revdelete-show-file-confirm' => 'Ar ye sair ye wish tae see ae delytit reveesion o the file "<nowiki>$1</nowiki>" fae $2 at $3?',
 'revdelete-show-file-submit' => 'Ai',
 'revdelete-selected' => '<strong>{{PLURAL:$2|Selected reveesion|Selected reveesions}} o [[:$1]]:</strong>',
 'logdelete-selected' => "'''{{PLURAL:$1|Selectit log event|Selectit log events}}:'''",
+'revdelete-text-text' => 'Delytit reveesions will still kith in the page histerie, bit pairts o thair content will be onaccessible til the publeec.',
+'revdelete-text-file' => 'Delytit file versions will still kith in the file histerie, bit pairts o thair content will be onaccessible til the publeec.',
+'logdelete-text' => 'Delytit log events will still kith in the logs, bit pairts o thair content will be onaccessible til the publeec.',
+'revdelete-text-others' => 'Ither admeenistraters oan {{SITENAME}} will still be able tae access the skaukt content n can ondelyte it again throoch this same interface, onless addeetional restreections ar set.',
 'revdelete-confirm' => "Please confirm that ye'r ettlin tae dae this, that ye unnerstaunn the consequences, n that ye'r daein this in accordance wi [[{{MediaWiki:Policy-url}}|the policie]].",
 'revdelete-suppress-text' => 'Suppression shid <strong>yinly</strong> be uised fer the follaein cases:
 * poteentiallie libeloos information
@@ -1001,7 +1005,7 @@ $1',
 'logdelete-success' => '<strong>Log veesibeelitie successfully set.</strong>',
 'logdelete-failure' => '<strong>Log veesibddlitie coudna be set:</strong>
 $1',
-'revdel-restore' => 'change visibility',
+'revdel-restore' => 'chynge veesibeelitie',
 'pagehist' => 'Page histerie',
 'deletedhist' => 'Delytit histerie',
 'revdelete-hide-current' => "Mistak skaukin the eitem dated $2, $1: This is the current reveesion.
@@ -1039,15 +1043,15 @@ Mak sair that this chynge will maintain historical page conteenuitie.',
 'mergehistory-into' => 'Destinâtion page:',
 'mergehistory-list' => 'Mergeable eidit histerie',
 'mergehistory-merge' => 'The follaein reveesions o [[:$1]] can be merged intil [[:$2]].
-Uise the radio button column tae merge in yinly the reveesions makit at n afore the speecified time.
-Mynd that uisin the navigâtion links will reset this column.',
+Uise the radio button column tae merge in yinlie the reveesions cræftit at n afore the speceefied time.
+Mynd that uisin the naveegation links will reset this column.',
 'mergehistory-go' => 'Shaw mergeable eidits',
 'mergehistory-submit' => 'Merge reveesions',
 'mergehistory-empty' => 'Naw reveesions can be merged.',
 'mergehistory-success' => '$3 {{PLURAL:$3|reveesion|reveesions}} o [[:$1]] successfully merged intil [[:$2]].',
 'mergehistory-fail' => 'Onable tae perform histerie merge, please recheck the page n time parameters.',
-'mergehistory-no-source' => 'Source page $1 disna exist.',
-'mergehistory-no-destination' => 'Destinâtion page $1 disna exist.',
+'mergehistory-no-source' => 'Soorce page $1 disna exeest.',
+'mergehistory-no-destination' => 'Destination page $1 disna exeest.',
 'mergehistory-invalid-source' => 'Source page maun be ae valid title.',
 'mergehistory-invalid-destination' => 'Destinâtion page maun be ae valid title.',
 'mergehistory-autocomment' => 'Merged [[:$1]] intil [[:$2]]',
@@ -1069,7 +1073,7 @@ Mynd that uisin the navigâtion links will reset this column.',
 'lineno' => 'Line $1:',
 'compareselectedversions' => 'Compare selectit versions',
 'showhideselectedversions' => 'Chynge veesibeelitie o selected reveesions',
-'editundo' => 'undo',
+'editundo' => 'ondae',
 'diff-empty' => '(Naw difference)',
 'diff-multi-sameuser' => '({{PLURAL:$1|yin intermeediate reveesion|$1 intermeediate reveesions}} bi the same uiser naw shawn)',
 'diff-multi-otherusers' => '({{PLURAL:$1|yin intermeediate reveesion|$1 intermeediate reveesions}} bi {{PLURAL:$2|yin ither uiser|$2 uisers}} no shawn)',
@@ -1081,7 +1085,7 @@ Details can be foond in the [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENA
 
 # Search results
 'searchresults' => 'Rake results',
-'searchresults-title' => 'Rake affcome fer "$1"',
+'searchresults-title' => 'Rake ootcome fer "$1"',
 'toomanymatches' => 'Ower moni matches were returned, please try ae different speirin',
 'titlematches' => 'Airticle teitle matches',
 'textmatches' => 'Page tex matches',
@@ -1093,7 +1097,7 @@ Details can be foond in the [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENA
 'shown-title' => 'Shaw $1 {{PLURAL:$1|ootcome|ootcomes}} per page',
 'viewprevnext' => 'View ($1 {{int:pipe-separator}} $2) ($3)',
 'searchmenu-exists' => "'''There is a page named \"[[:\$1]]\" oan this wiki.'''",
-'searchmenu-new' => '<strong>Cræft the page "[[:$1]]" oan this wiki!</strong> {{PLURAL:$2|0=|See the page foond wi yer rake ava.|See the rake affcome foond ava.}}',
+'searchmenu-new' => '<strong>Cræft the page "[[:$1]]" oan this wiki!</strong> {{PLURAL:$2|0=|See the page foond wi yer rake ava.|See the rake ootcome foond ava.}}',
 'searchprofile-articles' => 'Content pages',
 'searchprofile-project' => 'Heelp n Waurk pages',
 'searchprofile-images' => 'Multimedia',
@@ -1112,16 +1116,16 @@ Details can be foond in the [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENA
 'search-file-match' => '(matches file content.)',
 'search-suggest' => 'Did ye mean: $1',
 'search-interwiki-caption' => "Sister projec's",
-'search-interwiki-default' => 'Affcomes fae $1:',
+'search-interwiki-default' => 'Ootcomes fae $1:',
 'search-interwiki-more' => '(mair)',
 'search-relatedarticle' => 'Relatit',
 'searcheverything-enable' => 'Rake in aw namespaces',
 'searchrelated' => 'related',
 'searchall' => 'aw',
 'showingresults' => "Shawin ablo up tae {{PLURAL:$1|'''1''' result|'''$1''' results}} stertin wi #'''$2'''.",
-'showingresultsinrange' => 'Shawin ablo up til {{PLURAL:$1|<strong>1</strong> affcome|<strong>$1</strong> affcome}} in range #<strong>$2</strong> til #<strong>$3</strong>.',
+'showingresultsinrange' => 'Shawin ablo up til {{PLURAL:$1|<strong>1</strong> ootcome|<strong>$1</strong> ootcome}} in range #<strong>$2</strong> til #<strong>$3</strong>.',
 'showingresultsnum' => "Shawin ablo {{PLURAL:$3|'''1''' result|'''$3''' results}} stertin wi #'''$2'''.",
-'showingresultsheader' => '{{PLURAL:$5|Affcome <strong>$1</strong> o <strong>$3</strong>|Affcomes <strong>$1 - $2</strong> o <strong>$3</strong>}} fer <strong>$4</strong>',
+'showingresultsheader' => '{{PLURAL:$5|Ootcome <strong>$1</strong> o <strong>$3</strong>|Ootcomes <strong>$1 - $2</strong> o <strong>$3</strong>}} fer <strong>$4</strong>',
 'search-nonefound' => 'Thaur were naw ootcomes matchin the speiring.',
 'powersearch-legend' => 'Advanced rake',
 'powersearch-ns' => 'Rake in namespaces:',
@@ -1155,7 +1159,7 @@ Details can be foond in the [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENA
 'prefs-watchlist-token' => 'Watchleet token:',
 'prefs-misc' => 'Antrin settins',
 'prefs-resetpass' => 'Chynge passwaird',
-'prefs-changeemail' => 'Chynge email address',
+'prefs-changeemail' => 'Chynge Wab-mail address',
 'prefs-setemail' => 'Set ae wab-mail address',
 'prefs-email' => 'Wab-mail opties',
 'prefs-rendering' => 'Appearence',
@@ -1164,16 +1168,16 @@ Details can be foond in the [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENA
 'prefs-editing' => 'Editin',
 'rows' => 'Raws:',
 'searchresultshead' => 'Rake result settins',
-'stub-threshold' => 'Threshold for <a href="#" class="stub">stub link</a> formattin (bytes):',
+'stub-threshold' => 'Threeshaud fer <a href="#" class="stub">stub link</a> formattin (bytes):',
 'stub-threshold-disabled' => 'Tuckie',
-'recentchangesdays' => 'Days tae shaw in recent chynges:',
+'recentchangesdays' => 'Days tae shaw in recynt chynges:',
 'recentchangesdays-max' => 'Mucklest $1 {{PLURAL:$1|day|days}}',
 'recentchangescount' => 'Nummer o eedits tae shaw bi defaut:',
 'prefs-help-recentchangescount' => 'This includes recent chynges, page histories, n logs.',
 'prefs-help-watchlist-token2' => 'This is the hidlins key til the wab feed o yer watchleet. Onibodie wha kens this can read yer watchleet, sae dinna shair it. Gif ye need to, [[Special:ResetTokens|Ye can reset it]].',
 'savedprefs' => 'Yer preferences haes been hained.',
-'timezoneuseserverdefault' => 'Uise wiki default ($1)',
-'timezoneuseoffset' => 'Ither (specify offset)',
+'timezoneuseserverdefault' => 'Uise wiki defaut ($1)',
+'timezoneuseoffset' => 'Ither (speceefie affset)',
 'servertime' => 'Server time the nou',
 'guesstimezone' => 'Fill in frae brouser',
 'timezoneregion-africa' => 'Africae',
@@ -1192,9 +1196,9 @@ Details can be foond in the [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENA
 'prefs-files' => 'Files',
 'prefs-custom-css' => 'Custom CSS',
 'prefs-custom-js' => 'Custom JS',
-'prefs-common-css-js' => 'Shared CSS/JavaScript for aw skins:',
-'prefs-reset-intro' => 'Ye can uise this page tae reset yer preferences tae the steid defaults.
-This cannae be unduin.',
+'prefs-common-css-js' => 'Shaired CSS/JavaScript fer aw skins:',
+'prefs-reset-intro' => 'Ye can uise this page tae reset yer preeferances til the steid defauts.
+This canna be ondun.',
 'prefs-emailconfirm-label' => 'Wab-mail confirmation:',
 'youremail' => 'Yer email:',
 'username' => '{{GENDER:$1|Uisername}}:',
@@ -1206,10 +1210,10 @@ This cannae be unduin.',
 'yourvariant' => 'Content leid variant',
 'prefs-help-variant' => 'Yer preferred variant or orthographie tae displey the content pages o this wiki in.',
 'yournick' => 'New seegnatur:',
-'prefs-help-signature' => 'Comments on collogue pages should be signed wi "<nowiki>~~~~</nowiki>", which will be convertit intae yer signatur an a timestamp.',
+'prefs-help-signature' => 'Comments oan talk pages shid be signed wi "<nowiki>~~~~</nowiki>", this will be convertit intil yer signatur n ae timestamp.',
 'badsig' => 'Raw signature nae guid; check HTML tags.',
 'badsiglength' => 'Yer nickname is ower lang; it haes tae be $1 {{PLURAL:$1|character|characters}} or less.',
-'yourgender' => 'Hou dae ye prefer tae be describit?',
+'yourgender' => 'Hou dae ye prefer tae be described?',
 'gender-unknown' => 'Ah prefer tae na say',
 'gender-male' => 'He eedits wiki pages',
 'gender-female' => 'She eedits wiki pages',
@@ -1237,7 +1241,7 @@ Yer wab-mail address isna revealed whan ither uisers contact ye.',
 'prefs-displaysearchoptions' => 'Displey opties',
 'prefs-displaywatchlist' => 'Displey opties',
 'prefs-diffs' => 'Diffs',
-'prefs-help-prefershttps' => 'This preference will tak effect on yer next login.',
+'prefs-help-prefershttps' => 'This preeferance will tak effect oan yer nex login.',
 'prefs-tabs-navigation-hint' => 'Tip: Ye can uise the cair n richt arrae keys tae naveegate atween the tabs in the tabs leet.',
 
 # User preference: email validation using jQuery
@@ -1245,35 +1249,35 @@ Yer wab-mail address isna revealed whan ither uisers contact ye.',
 'email-address-validity-invalid' => 'Enter ae valid wab-mail address',
 
 # User rights
-'userrights' => 'Uiser richts management',
+'userrights' => 'Uiser richts managemant',
 'userrights-lookup-user' => 'Manish uiser boorachs',
 'userrights-user-editname' => 'Enter a uisername:',
 'editusergroup' => 'Eidit uiser boorach',
 'editinguser' => 'Chynging uiser richts o uiser <strong>[[User:$1|$1]]</strong> $2',
-'userrights-editusergroup' => 'Edit uiser groups',
-'saveusergroups' => 'Save uiser groups',
+'userrights-editusergroup' => 'Eedit uiser groops',
+'saveusergroups' => 'Hain uiser groops',
 'userrights-groupsmember' => 'Member o:',
-'userrights-groupsmember-auto' => 'Implicit member o:',
+'userrights-groupsmember-auto' => 'Impleecit memmer o:',
 'userrights-groups-help' => "Ye can alter the groops this uiser is in:
 * Ae checkit kist means that the uiser is in that groop.
 * Aen oncheckit kist means that the uiser's no in that groop.
 * Ae * indicates that ye cannae remuiv the groop yince ye'v added it, or vice versa.",
 'userrights-reason' => 'Raison:',
-'userrights-no-interwiki' => 'Ye dae nae hae permission tae edit uiser richts on ither wikis.',
-'userrights-nodatabase' => 'Database $1 daes nae exist or is nae local.',
+'userrights-no-interwiki' => 'Ye dinna hae permission tae eedit uiser richts oan ither wikis.',
+'userrights-nodatabase' => 'Database $1 disna exeest or isna local.',
 'userrights-nologin' => 'Ye maun [[Special:UserLogin|log in]] wi aen admeenistrater accoont tae assign uiser richts.',
-'userrights-notallowed' => 'Ye dae nae hae permission tae add or remove uiser richts.',
-'userrights-changeable-col' => 'Groups ye can chynge',
-'userrights-unchangeable-col' => 'Groups ye cannae chynge',
+'userrights-notallowed' => 'Ye dinna hae permission tae add or remuiv uiser richts.',
+'userrights-changeable-col' => 'Groops that ye can chynge',
+'userrights-unchangeable-col' => 'Groops ye canna chynge',
 'userrights-conflict' => 'Conflict o uiser richts chynges! Please luikower n confirm yer chynges.',
 'userrights-removed-self' => "Ye'v successfulie remuived yer ain richts. N sae, ye'r naw langer able tae access this page.",
 
 # Groups
 'group' => 'Groop:',
 'group-user' => 'Uisers',
-'group-autoconfirmed' => 'Autoconfirmed uisers',
+'group-autoconfirmed' => 'Autæconfirmed uisers',
 'group-bot' => 'Bots',
-'group-sysop' => 'Admeenistrators',
+'group-sysop' => 'Admeenistraters',
 'group-suppress' => 'Owersichts',
 'group-all' => '(aw)',
 
@@ -1292,22 +1296,22 @@ Yer wab-mail address isna revealed whan ither uisers contact ye.',
 'right-edit' => 'Eedit pages',
 'right-createpage' => 'Cræft pages (that arna tauk pages)',
 'right-createtalk' => 'Cræft discussion pages',
-'right-createaccount' => 'Create new uiser accoonts',
-'right-minoredit' => 'Mark edits as smaa',
+'right-createaccount' => 'Cræft new uiser accoonts',
+'right-minoredit' => 'Maurk eedits aes smaa',
 'right-move' => 'Muiv pages',
 'right-move-subpages' => 'Muiv pages wi thair subpages',
 'right-move-rootuserpages' => 'Muiv ruit uiser pages',
 'right-movefile' => 'Muiv files',
-'right-suppressredirect' => 'Nae create redirects frae soorce pages when flittin pages',
+'right-suppressredirect' => 'Na cræft reguidals fae soorce pages whan muivin pages',
 'right-upload' => 'Uplaid files',
-'right-reupload' => 'Owerwrite existin files',
-'right-reupload-own' => 'Owerwrite existin files uplaidit bi anesel',
-'right-reupload-shared' => 'Owerride files on the shared media repository locally',
-'right-upload_by_url' => 'Uplaid files frae a URL',
-'right-purge' => 'Purge the steid cache for a page wioot confirmation',
-'right-autoconfirmed' => 'Nae be affectit bi IP-based rate leemits',
+'right-reupload' => 'Owerwrite exeestin files',
+'right-reupload-own' => 'Owerwrite exeestin files uplaidit bi yersel',
+'right-reupload-shared' => 'Owerride files oan the shaired media repositerie locallie',
+'right-upload_by_url' => 'Uplaid files fae ae URL',
+'right-purge' => 'Purge the steid cache fer ae page wioot confirmation',
+'right-autoconfirmed' => 'Na be affectit bi IP-based rate leemits',
 'right-bot' => 'Be treatit aes aen autæmatit process',
-'right-nominornewtalk' => 'Nae hae smaa edits tae discussion pages trigger the new messages prompt',
+'right-nominornewtalk' => 'Na hae smaa eedits til discussion pages trigger the new messages prompt',
 'right-apihighlimits' => 'Uise heicher leemits in API queries',
 'right-writeapi' => 'Uise o the write API',
 'right-delete' => 'Delyte pages',
@@ -1416,7 +1420,7 @@ Yer wab-mail address isna revealed whan ither uisers contact ye.',
 'recentchanges-feed-description' => 'Follae the maist recent chynges tae the wiki in this feed.',
 'recentchanges-label-newpage' => 'This edit created a freish page',
 'recentchanges-label-minor' => 'This is ae smaa eedit',
-'recentchanges-label-bot' => 'This edit wis performed bi a bot',
+'recentchanges-label-bot' => 'This eedit wis performed bi ae bot',
 'recentchanges-label-unpatrolled' => 'This edit haes nae yet bin patrolled',
 'recentchanges-label-plusminus' => 'The page size chynged bi this nummer o bytes',
 'recentchanges-legend-newpage' => '(see [[Special:NewPages|leet o new pages]] ava)',
@@ -1888,11 +1892,11 @@ It nou reguides til [[$2]].',
 'nlinks' => '$1 {{PLURAL:$1|link|links}}',
 'nmembers' => '$1 {{PLURAL:$1|membir|membirs}}',
 'nmemberschanged' => '$1 → $2 {{PLURAL:$2|memmer|memmers}}',
-'nrevisions' => '$1 {{PLURAL:$1|reveision|reveisions}}',
+'nrevisions' => '$1 {{PLURAL:$1|reveesion|reveesions}}',
 'nviews' => '$1 {{PLURAL:$1|view|views}}',
 'nimagelinks' => 'Uised oan $1 {{PLURAL:$1|page|pages}}',
 'ntransclusions' => 'uised oan $1 {{PLURAL:$1|page|pages}}',
-'specialpage-empty' => "Thaur's naw affcomes fer this report.",
+'specialpage-empty' => "Thaur's naw ootcomes fer this report.",
 'lonelypages' => 'Orphant pages',
 'lonelypagestext' => "The follaein pages'r naw linkt fae or transcluided intil ither pages in {{SITENAME}}.",
 'uncategorizedpages' => 'Uncategoreised pages',
@@ -1903,7 +1907,7 @@ It nou reguides til [[$2]].',
 'unusedimages' => 'Unuised images',
 'wantedcategories' => 'Wantit categories',
 'wantedpages' => 'Wantit pages',
-'wantedpages-badtitle' => 'Onvalid title in affcome set: $1',
+'wantedpages-badtitle' => 'Onvalid title in ootcome set: $1',
 'wantedfiles' => 'Wantit files',
 'wantedfiletext-cat' => 'The follaein files ar uised but dinna exeest. Files fae foreign repositeries micht be leetit despite exeestin. Onie sic false poseeteeves will be <del>struck oot</del>. Addeetionallie, pages that embed files that dinna exeest ar leetit in [[:$1]].',
 'wantedfiletext-nocat' => 'The follaein files ar uised but dinna exeest. Files fae foreign repositeries micht be leetit despite exeestin. Onie sic false poseeteeves will be <del>struck oot</del>.',
@@ -2006,7 +2010,7 @@ Ye can narrae doon the whit ye see bi selectin ae log type, the uisername (case-
 See [[Special:WantedCategories|wanted categeries]] ava.',
 'categoriesfrom' => 'Displey categeries stairtin at:',
 'special-categories-sort-count' => 'sairt bi coont',
-'special-categories-sort-abc' => 'sairt by the alphabet',
+'special-categories-sort-abc' => 'sairt bi the alphabet',
 
 # Special:DeletedContributions
 'deletedcontributions' => 'Delytit uiser contreebutions',
@@ -2191,7 +2195,7 @@ n that ye'r daein this in accord wi [[{{MediaWiki:Policy-url}}]].",
 'actionfailed' => 'Action failed',
 'deletedtext' => '"$1" haes been delytit. See $2 fer ae record o recent delytions.',
 'dellogpage' => 'Delytion log',
-'dellogpagetext' => 'Ablo is a leet o the maist recent deletions.',
+'dellogpagetext' => 'Ablo is ae leet o the maist recynt delytions.',
 'deletionlog' => 'delytion log',
 'reverted' => 'Revertit til aulder reveesion',
 'deletecomment' => 'Raeson:',
@@ -2323,7 +2327,7 @@ Ye micht hae ae bad link, or the reveesion micht hae been restored or remuived f
 'undeletelink' => 'see/restore',
 'undeleteviewlink' => 'view',
 'undeletecomment' => 'Raison:',
-'undeletedrevisions' => '{{PLURAL:$1|1 reveision|$1 reveisions}} restored',
+'undeletedrevisions' => '{{PLURAL:$1|1 reveesion|$1 reveesions}} restored',
 'undeletedrevisions-files' => '{{PLURAL:$1|1 reveesion|$1 reveesions}} n {{PLURAL:$2|1 file|$2 files}} restored',
 'cannotundelete' => 'Ondelyte failed:
 $1',
@@ -2442,11 +2446,11 @@ The latest block log entrie is gien ablo fer referance:',
 'ipb-confirmhideuser' => 'Ye\'r aboot tae block ae uiser wi "skauk uiser" enabled. This will suppress the uiser\'s name in aw leets n log entries. Ar ye sair that ye want tae dae that?',
 'ipb-confirmaction' => 'Gif ye\'r sair that ye reelie want tae dae it, please check the "{{int:ipb-confirm}}" field at the bottom.',
 'ipb-edit-dropdown' => 'Eedit block raisons',
-'ipb-unblock-addr' => 'Unblock $1',
+'ipb-unblock-addr' => 'Onblock $1',
 'ipb-unblock' => 'Onblock ae uisername or IP address',
 'ipb-blocklist' => 'See exeestin blocks',
 'ipb-blocklist-contribs' => 'Contreebutions fer $1',
-'unblockip' => 'Unblock uiser',
+'unblockip' => 'Onblock uiser',
 'unblockiptext' => 'Uise the form ablo tae restore screevin richts
 til aen afore-blockit IP address or uisername.',
 'ipusubmit' => 'Remuive this block',
@@ -2477,9 +2481,9 @@ til aen afore-blockit IP address or uisername.',
 'ipblocklist-empty' => 'The block leet is tuim.',
 'ipblocklist-no-results' => 'The requested IP address or uisername isna blockit.',
 'blocklink' => 'block',
-'unblocklink' => 'unblock',
+'unblocklink' => 'onblock',
 'change-blocklink' => 'chynge block',
-'contribslink' => 'contreibs',
+'contribslink' => 'contreebs',
 'emaillink' => 'send wab-mail',
 'autoblocker' => 'Autaematicallie blockit sin yer IP address haes been uised recentlie bi "[[User:$1|$1]]". The raeson gien fer $1\'s block is "$2"',
 'blocklogpage' => 'Block log',
@@ -2752,7 +2756,7 @@ Please gie it anither gae.',
 'tooltip-pt-logout' => 'Log oot',
 'tooltip-ca-talk' => 'Discussion aneat the content page',
 'tooltip-ca-edit' => 'Ye can eedit this page. Please uise the luikower button afore hainin',
-'tooltip-ca-addsection' => 'Stairt a new section',
+'tooltip-ca-addsection' => 'Stairt ae new section',
 'tooltip-ca-viewsource' => 'This page is protectit.
 Ye can view its soorce',
 'tooltip-ca-history' => 'Bygane reveesions o this page',
@@ -2796,7 +2800,7 @@ Ye can view its soorce',
 'tooltip-ca-nstab-category' => 'View the categerie page',
 'tooltip-minoredit' => 'Mairk this as a smaa edit',
 'tooltip-save' => 'Hain yer chynges',
-'tooltip-preview' => 'Scance ower yer chynges, please uise this afore hainin!',
+'tooltip-preview' => 'Luikower yer chynges, please uise this afore hainin!',
 'tooltip-diff' => 'Shaw the chynges that ye makit til the tex.',
 'tooltip-compareselectedversions' => 'See the differs atween the twa selectit versions o this page.',
 'tooltip-watch' => 'Add this page tae yer watchleet',
@@ -3130,7 +3134,7 @@ Gif the file haes bin modified fae its oreeginal state, some details micht naw f
 
 'exif-colorspace-65535' => 'Oncalibratit',
 
-'exif-componentsconfiguration-0' => 'disna exist',
+'exif-componentsconfiguration-0' => 'disna exeest',
 
 'exif-exposureprogram-0' => 'Na defined',
 'exif-exposureprogram-3' => 'Apertur prioritie',
@@ -3437,7 +3441,7 @@ Ye can [[Special:EditWatchlist|uise the staundairt eediter]] ava.',
 
 # Core parser functions
 'unknown_extension_tag' => 'Onkent extension tag "$1"',
-'duplicate-defaultsort' => '\'\'\'Wairnin:\'\'\' Default sort key "$2" overrides earlier default sort key "$1".',
+'duplicate-defaultsort' => '<strong>Warnishment:</strong> Defaut sort key "$2" owerrides earlier defaut sort key "$1".',
 
 # Special:Version
 'version-extensions' => 'Instawed extensions',
@@ -3460,9 +3464,9 @@ Ye can [[Special:EditWatchlist|uise the staundairt eediter]] ava.',
 'version-poweredby-others' => 'ithers',
 'version-poweredby-translators' => 'translatewiki.net owerseters',
 'version-credits-summary' => "We'd like tae recognize the follaein fawk fer thair contreebution til [[Special:Version|MediaWiki]].",
-'version-license-info' => 'MediaWiki is free saffware; ye can reedistreebute it n/or modifie it unner the terms o the GNU General Public License aes publeesht bi the Free Software Foundation; either version 2 of the License, or (bi yer optie) onie later version.
+'version-license-info' => 'MediaWiki is free saffware; ye can reedistreebute it n/or modifie it unner the terms o the GNU General Public License aes publeesht bi the Free Software Foundation; either version 2 o the License, or (bi yer optie) onie later version.
 
-MediaWiki is distreebuted in the hope that it will be uissfu, but WIOOT ONIE WARRANTIE; wioot even the implied warrantie o MERCHANTABILITIE or FITNESS FER AE PARTEECULAR PURPYSS. See the GNU General Public License fer mair details.
+MediaWiki is distreebuted in the hope that it will be uissfu, bit WIOOT ONIE WARRANTIE; wioot even the implied warrantie o MERCHANTABILITIE or FITNESS FER AE PARTEECULAR PURPYSS. See the GNU General Public License fer mair details.
 
 Ye shid hae receeved [{{SERVER}}{{SCRIPTPATH}}/COPIEIN ae copie o the GNU General Public License] alang wi this program; gif na, write til the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA or [//www.gnu.org/licenses/old-licenses/gpl-2.0.html read it online].',
 'version-software' => 'Instawed saffware',
@@ -3606,7 +3610,7 @@ Ye shid hae receeved [{{SERVER}}{{SCRIPTPATH}}/COPIEIN ae copie o the GNU Genera
 'feedback-bugornote' => 'Gif yer readie tae describe ae techneecal problem in detail please [$1 report ae bug].
 Itherwise, ye can uiss the easie form ablo. Yer comment will be added til the page "[$3 $2]", alang wi yer uisername.',
 'feedback-adding' => 'Addin feedback til page...',
-'feedback-error1' => 'Mistak: Onrecognised affcome fae API',
+'feedback-error1' => 'Mistak: Onrecognised ootcome fae API',
 'feedback-error2' => 'Mistak: Eedit failed',
 'feedback-error3' => 'Mistak: Naw response fae API',
 'feedback-thanks' => 'Thanks! Yer feedback haes been posted til the page "[$2 $1]".',
@@ -3684,10 +3688,10 @@ It foreby expaunds supported parser functions like
 <code><nowiki>{{</nowiki>CURRENTDAY}}</code>.
 In fact, it expauns just aboot awthings in dooble-braces.',
 'expand_templates_title' => 'Contex title, fer {{FULLPAGENAME}}, etc.:',
-'expand_templates_output' => 'Affcome',
+'expand_templates_output' => 'Ootcome',
 'expand_templates_xml_output' => 'XML ootpit',
 'expand_templates_html_output' => 'Raw HTML ootpit',
-'expand_templates_remove_nowiki' => 'Suppress <nowiki> tags in affcome',
+'expand_templates_remove_nowiki' => 'Suppress <nowiki> tags in ootcome',
 'expand_templates_generate_xml' => 'Shaw XML parse tree',
 'expand_templates_generate_rawhtml' => 'Shaw raw HTML',
 'expand_templates_preview' => 'Luikower',
index 2441920..b4bf336 100644 (file)
@@ -822,6 +822,10 @@ Prosím, počkajte $1 predtým, než to skúsite znova.',
 'suspicious-userlogout' => 'Vaša požiadavka odhlásiť sa bola zamietnutá, pretože to vyzerá, že ju poslal pokazený prehliadač alebo proxy server.',
 'createacct-another-realname-tip' => 'Skutočné meno je nepovinné.
 Ak sa rozhodnete ho poskytnúť, použije sa na označenie vašej práce.',
+'pt-login' => 'Prihlásiť sa',
+'pt-login-button' => 'Prihlásiť sa',
+'pt-createaccount' => 'Vytvoriť účet',
+'pt-userlogout' => 'Odhlásiť sa',
 
 # Email sending
 'php-mail-error-unknown' => 'Neznáma chyba vo funkcii PHP mail()',
@@ -830,7 +834,7 @@ Ak sa rozhodnete ho poskytnúť, použije sa na označenie vašej práce.',
 
 # Change password dialog
 'changepassword' => 'Zmeniť heslo',
-'resetpass_announce' => 'Prishlásili ste sa pomocou dočasného emailom zaslaného kódu. Pre dokončenie prihlásenia je potrebné tu nastaviť nové heslo:',
+'resetpass_announce' => 'Pre dokončenie prihlásenia je potrebné nastaviť nové heslo.',
 'resetpass_text' => '<!-- Sem pridajte text -->',
 'resetpass_header' => 'Zmeniť heslo k účtu',
 'oldpassword' => 'Staré heslo:',
@@ -845,6 +849,7 @@ Ak sa rozhodnete ho poskytnúť, použije sa na označenie vašej práce.',
 'resetpass-submit-cancel' => 'Zrušiť',
 'resetpass-wrong-oldpass' => 'Neplatné dočasné alebo aktuálne heslo.
 Je možné, že sa vám už podarilo úspešne zmeniť svoje heslo alebo ste si vyžiadali nové dočasné heslo.',
+'resetpass-recycled' => 'Ako nové heslo si prosím nastavte niečo iné než súčasné heslo.',
 'resetpass-temp-password' => 'Dočasné heslo:',
 'resetpass-abort-generic' => 'Zmena hesla bola zablokovaná rozšírením.',
 
@@ -1684,11 +1689,23 @@ Softvér používa toto nastavenie na správne oslovenie a označenie vás ostat
 'rcnotefrom' => "Nižšie sú zobrazené úpravy od '''$2''' (do '''$1''').",
 'rclistfrom' => 'Zobraziť nové úpravy počnúc od $1',
 'rcshowhideminor' => '$1 drobné úpravy',
+'rcshowhideminor-show' => 'Zobraziť',
+'rcshowhideminor-hide' => 'Skryť',
 'rcshowhidebots' => '$1 botov',
+'rcshowhidebots-show' => 'Zobraziť',
+'rcshowhidebots-hide' => 'Skryť',
 'rcshowhideliu' => '$1 registrovaní užívatelia',
+'rcshowhideliu-show' => 'Zobraziť',
+'rcshowhideliu-hide' => 'Skryť',
 'rcshowhideanons' => '$1 anonymných používateľov',
+'rcshowhideanons-show' => 'Zobraziť',
+'rcshowhideanons-hide' => 'Skryť',
 'rcshowhidepatr' => '$1 úpravy strážených stránok',
+'rcshowhidepatr-show' => 'Zobraziť',
+'rcshowhidepatr-hide' => 'Skryť',
 'rcshowhidemine' => '$1 moje úpravy',
+'rcshowhidemine-show' => 'Zobraziť',
+'rcshowhidemine-hide' => 'Skryť',
 'rclinks' => 'Zobraziť posledných $1 úprav v posledných $2 dňoch<br />$3',
 'diff' => 'rozdiel',
 'hist' => 'história',
@@ -2176,7 +2193,15 @@ Každý riadok obsahuje odkaz na prvé a druhé presmerovanie a tiež prvý riad
 'protectedpages' => 'Zamknuté stránky',
 'protectedpages-indef' => 'Zamknutia iba na neurčito',
 'protectedpages-cascade' => 'Iba kaskádové zamykanie',
+'protectedpages-noredirect' => 'Skryť presmerovania',
 'protectedpagesempty' => 'Momentálne nie sú žiadne stránky s týmito parametrami zamknuté.',
+'protectedpages-timestamp' => 'Časová známka',
+'protectedpages-page' => 'Stránka',
+'protectedpages-expiry' => 'Koniec platnosti',
+'protectedpages-params' => 'Nastavenie zámku',
+'protectedpages-reason' => 'Dôvod',
+'protectedpages-unknown-timestamp' => 'Neznáme',
+'protectedpages-unknown-performer' => 'Neznámy redaktor',
 'protectedtitles' => 'Zamknuté názvy',
 'protectedtitlesempty' => 'Tieto parametre momentálne nezamykajú žiadne názvy stránok.',
 'listusers' => 'Zoznam používateľov',
@@ -3794,6 +3819,10 @@ Prosím, potvrďte, že túto stránku chcete skutočne znovu vytvoriť.",
 'imgmultigo' => 'Vykonať',
 'imgmultigoto' => 'Prejsť na stránku $1',
 
+# Language selector for translatable SVGs
+'img-lang-default' => '(predvolený jazyk)',
+'img-lang-go' => 'Vykonať',
+
 # Table pager
 'ascending_abbrev' => 'vzostupne',
 'descending_abbrev' => 'zostupne',
@@ -3877,7 +3906,13 @@ Tiež môžete [[Special:EditWatchlist|použiť štandardný editor]].',
 'version-hook-subscribedby' => 'Pripojené',
 'version-version' => '(Verzia $1)',
 'version-license' => 'Licencia',
+'version-ext-license' => 'Licencia',
+'version-ext-colheader-name' => 'Rozšírenie',
 'version-ext-colheader-version' => 'Verzia',
+'version-ext-colheader-license' => 'Licencia',
+'version-ext-colheader-description' => 'Popis',
+'version-ext-colheader-credits' => 'Autori',
+'version-license-title' => 'Licencia pre $1',
 'version-poweredby-credits' => "Táto wiki beží na '''[https://www.mediawiki.org/ MediaWiki]''', copyright © 2001-$1 $2.",
 'version-poweredby-others' => 'ďalší',
 'version-poweredby-translators' => 'prekladatelia na translatewiki.net',
index 57f9f75..3f9d59f 100644 (file)
@@ -940,6 +940,7 @@ $2',
 'createacct-another-realname-tip' => 'Право име није обавезно.
 Ако изаберете да га унесете, оно ће бити коришћено за приписивање вашег рада.',
 'pt-login' => 'Пријави ме',
+'pt-login-button' => 'Пријави ме',
 'pt-createaccount' => 'Отвори налог',
 'pt-userlogout' => 'Одјави ме',
 
@@ -2313,6 +2314,7 @@ $1',
 'mostrevisions' => 'Странице с највише измена',
 'prefixindex' => 'Све странице с префиксом',
 'prefixindex-namespace' => 'Све странице с предметком (именски простор $1)',
+'prefixindex-strip' => 'Сакриј префикс у списку',
 'shortpages' => 'Кратке странице',
 'longpages' => 'Дугачке странице',
 'deadendpages' => 'Странице без унутрашњих веза',
@@ -4228,6 +4230,7 @@ $5
 'version-ext-license' => 'Лиценца',
 'version-ext-colheader-name' => 'Екстензија',
 'version-ext-colheader-version' => 'Верзија',
+'version-ext-colheader-license' => 'Лиценца',
 'version-ext-colheader-description' => 'Опис',
 'version-ext-colheader-credits' => 'Аутори',
 'version-poweredby-credits' => "Овај вики покреће '''[https://www.mediawiki.org/ Медијавики]''', ауторска права © 2001-$1 $2.",
index 7291ace..d545fad 100644 (file)
@@ -1286,6 +1286,10 @@ eller så försöker du gömma den senaste versionen av sidan.',
 'revdelete-show-file-submit' => 'Ja',
 'revdelete-selected' => "'''{{PLURAL:$2|Vald version|Valda versioner}} av [[:$1]]:'''",
 'logdelete-selected' => "'''{{PLURAL:$1|Vald loggåtgärd|Valda loggåtgärder}}:'''",
+'revdelete-text-text' => 'Raderade sidversioner kommer fortfarande synas i sidans historik, men delar av innehållet kommer inte att bli tillgängligt offentligt.',
+'revdelete-text-file' => 'Raderade filversioner kommer fortfarande synas i filens historik, men delar av innehållet kommer inte att bli tillgängligt offentligt.',
+'logdelete-text' => 'Raderade logghändelser kommer fortfarande synas i loggarna, men delar av innehållet kommer inte att bli tillgängligt offentligt.',
+'revdelete-text-others' => 'Andra administratörer på {{SITENAME}} kommer fortfarande att kunna komma åt det dolda innehållet och återställa det igen genom samma gränssnitt om inte tilläggande begränsningar används.',
 'revdelete-confirm' => 'Var god bekräfta att du vill göra detta, och att du förstår konsekvenserna, och att du gör så i enlighet med [[{{MediaWiki:Policy-url}}|policyn]].',
 'revdelete-suppress-text' => "Undanhållande ska '''bara''' användas i följande fall:
 * Eventuell förolämpande information
index c0a5dd4..9f3e7df 100644 (file)
@@ -313,7 +313,7 @@ $messages = array(
 'vector-view-viewsource' => 'మూలాన్ని చూపించు',
 'actions' => 'పనులు',
 'namespaces' => 'పేరుబరులు',
-'variants' => 'à°°à°\95à°°à°\95ాలు',
+'variants' => 'వివిధ à°°à±\82à°ªాలు',
 
 'navigation-heading' => 'మార్గదర్శకపు మెనూ',
 'errorpagetitle' => 'లోపం',
@@ -690,6 +690,7 @@ $2',
 'createacct-another-realname-tip' => 'అసలు పేరు ఐచ్ఛికం.
 మీరు దాన్ని ఇస్తే, వాడుకరి పనుల శ్రేయస్సు ఆ పేరుకు ఆపాదించబడుతుంది.',
 'pt-login' => 'లాగినవండి',
+'pt-login-button' => 'లాగినవండి',
 'pt-createaccount' => 'ఖాతా సృష్టించు',
 'pt-userlogout' => 'లాగౌటవండి',
 
@@ -1232,7 +1233,7 @@ $1",
 'search-file-match' => '(ఫైలు విషయంతో సరిపోలుతోంది)',
 'search-suggest' => 'మీరు అంటున్నది ఇదా: $1',
 'search-interwiki-caption' => 'సోదర ప్రాజెక్టులు',
-'search-interwiki-default' => '$1 ఫలితాలు:',
+'search-interwiki-default' => '$1 à°¨à±\81à°\82à°¡à°¿ à°«à°²à°¿à°¤à°¾à°²à±\81:',
 'search-interwiki-more' => '(మరిన్ని)',
 'search-relatedarticle' => 'సంబంధించినవి',
 'searcheverything-enable' => 'అన్ని పేరుబరుల్లో వెతుకు',
@@ -1733,7 +1734,8 @@ $1',
 'upload-file-error' => 'అంతర్గత లోపం',
 'upload-file-error-text' => 'సర్వరులో తాత్కాలిక ఫైలును సృష్టించబోగా ఏదో అంతర్గత లోపం తలెత్తింది. ఎవరైనా [[Special:ListUsers/sysop|నిర్వాహకుడిని]] సంప్రదించండి.',
 'upload-misc-error' => 'తెలియని ఎక్కింపు లోపం',
-'upload-misc-error-text' => 'ఎక్కిస్తూండగా ఏదో తెలియని లోపం తలెత్తింది. URL సరైనదేనని, అది అందుబాటులోనే ఉందని నిర్ధారించుకుని మళ్ళీ ప్రయత్నించండి. సమస్య అలాగే ఉంటే, సిస్టము నిర్వాహకుని సంప్రదించండి.',
+'upload-misc-error-text' => 'ఎక్కిస్తూండగా ఏదో తెలియని లోపం తలెత్తింది. 
+URL సరైనదేనని, అది అందుబాటులోనే ఉందని నిర్ధారించుకుని మళ్ళీ ప్రయత్నించండి. సమస్య అలాగే ఉంటే, [[Special:ListUsers/sysop|నిర్వాహకులు]] ఎవరినైనా సంప్రదించండి.',
 'upload-too-many-redirects' => 'ఆ URLలో చాలా దారిమార్పులు ఉన్నాయి',
 'upload-unknown-size' => 'సైజు తెలియదు',
 'upload-http-error' => 'ఒక HTTP పొరపాటు జరిగింది: $1',
@@ -2254,12 +2256,12 @@ https://www.mediawiki.org/wiki/Manual:Image_Authorization చూడండి.',
 'watchlistcontains' => 'మీ వీక్షణ జాబితాలో {{PLURAL:$1|ఒక పేజీ ఉంది|$1 పేజీలు ఉన్నాయి}}.',
 'iteminvalidname' => "'$1' తో ఇబ్బంది, సరైన పేరు కాదు...",
 'wlnote2' => '$2, $3 సమయానికి, గత {{PLURAL:$1|గంటలో|<strong>$1</strong> గంటల్లో}}, జరిగిన మార్పులు కింద ఇవ్వబడ్డాయి.',
-'wlshowlast' => 'గత $1 గంటలు $2 రోజులు $3 చూపించు',
+'wlshowlast' => 'గత $1 గంటల $2 రోజుల $3 చూపించు',
 'watchlist-options' => 'వీక్షణ జాబితా ఎంపికలు',
 
 # Displayed when you click the "watch" button and it is in the process of watching
-'watching' => 'à°\97మనిసà±\8dà°¤à±\81à°¨à±\8dనాà°\82...',
-'unwatching' => 'à°µà±\80à°\95à±\8dà°·à°£ à°¨à±\81à°\82à°¡à°¿ à°¤à±\8aà°²à°\97à°¿à°¸à±\8dà°¤à±\81à°¨à±\8dనా...',
+'watching' => 'à°\97మనిసà±\8dà°¤à±\81à°¨à±\8dనారà±\81...',
+'unwatching' => 'à°\97మనిà°\82à°\9aà°¡à°\82 à°²à±\87à°¦à±\81...',
 'watcherrortext' => '"$1" కు మీ సెట్టింగులను మార్చేటపుడు ఏదో లోపం దొర్లింది.',
 
 'enotif_mailer' => '{{SITENAME}} ప్రకటన మెయిలు పంపునది',
@@ -2310,7 +2312,7 @@ $UNWATCHURL
 # Delete
 'deletepage' => 'పేజీని తొలగించు',
 'confirm' => 'ధృవీకరించు',
-'excontent' => "à°\87దివరà°\95à±\81 విషయ సంగ్రహం: '$1'",
+'excontent' => "à°\89à°¨à±\8dà°¨ విషయ సంగ్రహం: '$1'",
 'excontentauthor' => 'ఉన్న విషయ సంగ్రహం: "$1" (మరియు దీని ఒకే ఒక్క రచయిత "[[Special:Contributions/$2|$2]]")',
 'exbeforeblank' => "ఖాళీ చెయ్యకముందు పేజీలో ఉన్న విషయ సంగ్రహం: '$1'",
 'exblank' => 'పేజీ ఖాళీగా ఉంది',
@@ -2337,7 +2339,7 @@ $UNWATCHURL
 'delete-edit-reasonlist' => 'తొలగింపు కారణాలని మార్చండి',
 'delete-toobig' => 'ఈ పేజీకి $1 {{PLURAL:$1|కూర్పుకు|కూర్పులకు}} మించిన, చాలా పెద్ద దిద్దుబాటు చరితం ఉంది. {{SITENAME}}కు అడ్డంకులు కలగడాన్ని నివారించేందుకు గాను, అలాంటి పెద్ద పేజీల తొలగింపును నియంత్రించాం.',
 'delete-warning-toobig' => 'ఈ పేజీకి $1 {{PLURAL:$1|కూర్పుకు|కూర్పులకు}} మించిన, చాలా పెద్ద దిద్దుబాటు చరితం ఉంది. దాన్ని తొలగిస్తే {{SITENAME}}కి చెందిన డేటాబేసు కార్యాలకు ఆటంకం కలగొచ్చు; అప్రమత్తతో ముందుకుసాగండి.',
-'deleting-backlinks-warning' => "'''హెచ్చరిక:''' మీరు తొలగించబోతున్న పేజీకి ఇతర పేజీల నుండి లింకులు ఉన్నాయి లేదా ఇక్కడ నుండి ట్రాన్స్‍క్లూడు అవుతున్నాయి.",
+'deleting-backlinks-warning' => "'''హెచ్చరిక:''' మీరు తొలగించబోతున్న పేజీకి [[Special:WhatLinksHere/{{FULLPAGENAME}}|ఇతర పేజీల]] నుండి లింకులు ఉన్నాయి లేదా ఇక్కడ నుండి ట్రాన్స్‍క్లూడు అవుతున్నాయి.",
 
 # Rollback
 'rollback' => 'దిద్దుబాట్లను రద్దుచేయి',
@@ -2561,7 +2563,7 @@ $1',
 'ipbenableautoblock' => 'ఈ వాడుకరి వాడిన చివరి ఐపీ అడ్రసును, అలాగే ఆ తరువాత వాడే అడ్రసులను కూడా ఆటోమాటిగ్గా నిరోధించు',
 'ipbsubmit' => 'ఈ సభ్యుని నిరోధించు',
 'ipbother' => 'వేరే గడువు',
-'ipboptions' => '2 గంటలు:2 hours,1 రోజు:1 day,3 రోజులు:3 days,1 వారం:1 week,2 వారాలు:2 weeks,1 నెల:1 month,3 నెలలు:3 months,6 నెలలు:6 months,1 సంవత్సరం:1 year,ఎప్పటికీ:infinite',
+'ipboptions' => '2 గంటలు:2 hours,ఒక రోజు:1 day,3 రోజులు:3 days,ఒక వారం:1 week,2 వారాలు:2 weeks,ఒక నెల:1 month,3 నెలలు:3 months,6 నెలలు:6 months,ఒక సంవత్సరం:1 year,ఎప్పటికీ:infinite',
 'ipbhidename' => 'మార్పులు మరియు జాబితాల నుండి ఈ వాడుకరిపేరుని దాచు',
 'ipbwatchuser' => 'ఈ సభ్యుని సభ్యుని పేజీ, చర్చాపేజీలను వీక్షణలో ఉంచు',
 'ipb-disableusertalk' => 'నిరోధంలో ఉండగా ఈ వాడుకరి తన స్వంత చర్చ పేజీలో మార్పుచేర్పులు చెయ్యకుండా నిరోధించు',
@@ -2622,7 +2624,7 @@ $1 ను నిరోధించడానికి కారణం: "$2"',
 మీ సమాచారం కోసం నిరోధపు చిట్టాని క్రింద ఇచ్చాం:',
 'blocklog-showsuppresslog' => 'ఈ వాడుకరిని గతంలో నిరోధించి, దాచి ఉంచారు.
 వివరాల కోసం అణచివేత చిట్టా కింద చూపబడింది:',
-'blocklogentry' => '"[[$1]]" పై నిరోధం అమలయింది. నిరోధ కాలం $2 $3',
+'blocklogentry' => '"[[$1]]" పై నిరోధం అమలయింది. నిరోధ కాలం $2. $3',
 'reblock-logentry' => '[[$1]] కై నిరోధపు అమరికలను $2 $3 గడువుతో మార్చారు',
 'blocklogtext' => 'వాడుకరుల నిరోధాలు, పునస్థాపనల చిట్టా ఇది. 
 ఆటోమాటిక్‌గా నిరోధానికి గురైన ఐ.పి. చిరునామాలు ఈ జాబితాలో ఉండవు. 
@@ -2946,7 +2948,7 @@ $2',
 'tooltip-preview' => 'మీ మార్పులను మునుజూడండి, భద్రపరిచేముందు ఇది వాడండి!',
 'tooltip-diff' => 'పాఠానికి మీరు ఏ మార్పులు చేసారో చూపిస్తుంది',
 'tooltip-compareselectedversions' => 'ఈ పేజీలో ఎంచుకున్న రెండు కూర్పులకు మధ్య తేడాలను చూడండి',
-'tooltip-watch' => 'à°\88 à°ªà±\87à°\9cà±\80ని à°®à±\80 à°µà°¿à°\95à±\8dషణా జాబితాకు చేర్చండి',
+'tooltip-watch' => 'à°\88 à°ªà±\87à°\9cà±\80ని à°®à±\80 à°µà±\80à°\95à±\8dà°·à°£ జాబితాకు చేర్చండి',
 'tooltip-watchlistedit-normal-submit' => 'శీర్షికలను తీసివెయ్యి',
 'tooltip-watchlistedit-raw-submit' => 'వీక్షణ జాబితాను తాజాకరించు',
 'tooltip-recreate' => 'పేజీ తుడిచివేయబడ్డాకానీ మళ్ళీ సృష్టించు',
index 22eaf1d..91a4e63 100644 (file)
@@ -109,6 +109,23 @@ $magicWords = array(
 $linkTrail = '/^([a-zʻʼ“»]+)(.*)$/sDu';
 $linkPrefixCharset = 'a-zA-Z\\x80-\\xffʻʼ«„';
 
+/**
+ * Formats need to be overwritten. Others are inherited automatically
+ */
+$dateFormats = array(
+       'dmy date' => 'j-F Y',
+       'dmy both' => 'H:i, j-F Y',
+       'dmy pretty' => 'j-F'
+);
+
+/**
+ * Transform table for decimal point '.' and thousands separator ','
+ */
+$separatorTransformTable = array(
+       '.' => ',',
+       ',' => "\xc2\xa0", # nbsp
+);
+
 $messages = array(
 # User preference toggles
 'tog-underline' => 'Havolalarning tagiga chizish:',
index 3c30d02..0ca8696 100644 (file)
@@ -748,6 +748,7 @@ $2',
 'createacct-another-realname-tip' => 'עכטער נאמען איז אפציאנאל.
 אויב איר וויילט אויס צוצושטעלן אים, וועט דאס גענוצט ווערן צו געבן אטריבוציע פאר זייער ארבעט.',
 'pt-login' => 'אַרײַנלאגירן',
+'pt-login-button' => 'אַרײַנלאָגירן',
 'pt-createaccount' => 'שאַפֿן אַ קאנטע',
 'pt-userlogout' => 'אַרויסלאגירן',
 
index 1929afc..9863403 100644 (file)
@@ -1273,6 +1273,10 @@ $3给出的原因是“$2”。",
 'revdelete-show-file-submit' => '是',
 'revdelete-selected' => "'''选取'''[[:$1]]'''的$2次修订:'''",
 'logdelete-selected' => "'''{{PLURAL:$1|选取的日志项目}}:'''",
+'revdelete-text-text' => '已删除修订仍将在页面历史中显示,但涉及部分的内容将对公众不可见。',
+'revdelete-text-file' => '已删除文件版本仍将在文件历史中显示,但涉及部分的内容将对公众不可见。',
+'logdelete-text' => '已删除日志事件仍将在日志中显示,但涉及部分的内容将对公众不可见。',
+'revdelete-text-others' => '在{{SITENAME}}的其他管理员仍将可以访问隐藏内容,并在一定条件下能够通过相同界面取消删除,除非附加条件被设定。',
 'revdelete-confirm' => '请确认该操作,明白其后果,并确保该操作符合[[{{MediaWiki:Policy-url}}|方针]]。',
 'revdelete-suppress-text' => "阻止应'''仅'''用于以下情况:
 * 潜在的诽谤信息
@@ -1718,7 +1722,7 @@ $1",
 'recentchanges-label-unpatrolled' => '该编辑尚未巡查',
 'recentchanges-label-plusminus' => '该页面字节数的前后变化',
 'recentchanges-legend-heading' => "'''说明:'''",
-'recentchanges-legend-newpage' => '(见[[Special:NewPages|新页面列表]])',
+'recentchanges-legend-newpage' => '(见[[Special:NewPages|新页面列表]])',
 'recentchanges-legend-plusminus' => "(''±123'')",
 'rcnotefrom' => '下面是<strong>$2</strong>之后的更改(最多显示<strong>$1</strong>个)。',
 'rclistfrom' => '显示$1之后的新更改',
@@ -1856,7 +1860,7 @@ $1",
 'uploaddisabledtext' => '文件上传已停用。',
 'php-uploaddisabledtext' => 'PHP文件上传停用。请检查file_uploads设置。',
 'uploadscripted' => '该文件包含可能被网络浏览器错误解释的 HTML 或脚本代码。',
-'uploadscriptednamespace' => "此SVG文件包含非法名字空间'$1'",
+'uploadscriptednamespace' => '此SVG文件包含非法名字空间“$1”',
 'uploadinvalidxml' => '上传文件中的XML无法解析。',
 'uploadvirus' => '该文件包含病毒!
 详情:$1',
index 4d4d941..64471a7 100644 (file)
@@ -1202,6 +1202,10 @@ $3所述禁止原因為“$2”。",
 'revdelete-show-file-submit' => '是',
 'revdelete-selected' => "'''選取[[:$1]]的$2次修訂:'''",
 'logdelete-selected' => "'''{{PLURAL:$1|選取的日誌項目}}:'''",
+'revdelete-text-text' => '已刪除修訂版本仍將出現於頁面歷史中,唯將不公開內容訪問。',
+'revdelete-text-file' => '已刪除檔案版本仍將出現於檔案歷史中,唯將不公開內容訪問。',
+'logdelete-text' => '已刪除日誌活動仍將出現於日誌中,唯將不公開內容訪問。',
+'revdelete-text-others' => '於{{SITENAME}}之其他管理員仍有權限訪問隱藏內容,亦可於同一界面恢復刪除,除非設定額外條件。',
 'revdelete-confirm' => '請確認您肯定去做的話,您就要明白到後果,以及這個程序符合[[{{MediaWiki:Policy-url}}|政策]]。',
 'revdelete-suppress-text' => "禁制應'''僅'''於下述情形之一時使用:
 * 潛在誹謗性資訊
@@ -1653,7 +1657,7 @@ $1",
 'recentchanges-label-unpatrolled' => '這次編輯尚未巡查過',
 'recentchanges-label-plusminus' => '更改前後頁面位元組大小的變化',
 'recentchanges-legend-heading' => "'''說明:'''",
-'recentchanges-legend-newpage' => '(見[[Special:NewPages|新頁面列表]])',
+'recentchanges-legend-newpage' => '(見[[Special:NewPages|新頁面列表]])',
 'recentchanges-legend-plusminus' => "(''±123'')",
 'rcnotefrom' => '下面是自<strong>$2</strong>起之更改(至多顯示<strong>$1</strong>個)。',
 'rclistfrom' => '顯示自 $1 以來的新變更',
@@ -1794,7 +1798,7 @@ $1",
 'uploaddisabledtext' => '檔案上傳不可用。',
 'php-uploaddisabledtext' => 'PHP 檔案上載已經停用。請檢查 file_uploads 設定。',
 'uploadscripted' => '該檔案包含可能被網路瀏覽器錯誤解釋的 HTML 或腳本代碼。',
-'uploadscriptednamespace' => "此SVG檔案中包含非法命名空間'$1'",
+'uploadscriptednamespace' => '此SVG檔案中包含非法命名空間「$1」',
 'uploadinvalidxml' => '上載檔案中的XML無法解析。',
 'uploadvirus' => '該檔案包含有病毒!
 詳情:$1',
index 57eda3d..026052c 100644 (file)
                 * @return {boolean} return.done.isCategory Whether the category exists.
                 */
                isCategory: function ( title, ok, err ) {
-                       var d = $.Deferred(),
-                               apiPromise;
+                       var apiPromise = this.get( {
+                               prop: 'categoryinfo',
+                               titles: String( title )
+                       } );
 
                        // Backwards compatibility (< MW 1.20)
                        if ( ok || err ) {
                                mw.track( 'mw.deprecate', 'api.cbParam' );
                                mw.log.warn( msg );
-                               d.done( ok ).fail( err );
                        }
 
-                       apiPromise = this.get( {
-                                       prop: 'categoryinfo',
-                                       titles: title.toString()
-                               } )
-                               .done( function ( data ) {
+                       return apiPromise
+                               .then( function ( data ) {
                                        var exists = false;
                                        if ( data.query && data.query.pages ) {
                                                $.each( data.query.pages, function ( id, page ) {
                                                        }
                                                } );
                                        }
-                                       d.resolve( exists );
+                                       return exists;
                                } )
-                               .fail( d.reject );
-
-                       return d.promise( { abort: apiPromise.abort } );
+                               .done( ok )
+                               .fail( err )
+                               .promise( { abort: apiPromise.abort } );
                },
 
                /**
                 * Get a list of categories that match a certain prefix.
-                *   e.g. given "Foo", return "Food", "Foolish people", "Foosball tables" ...
+                *
+                * E.g. given "Foo", return "Food", "Foolish people", "Foosball tables" ...
+                *
                 * @param {string} prefix Prefix to match.
                 * @param {Function} [ok] Success callback (deprecated)
                 * @param {Function} [err] Error callback (deprecated)
                 * @return {jQuery.Promise}
                 * @return {Function} return.done
-                * @return {String[]} return.done.categories Matched categories
+                * @return {string[]} return.done.categories Matched categories
                 */
                getCategoriesByPrefix: function ( prefix, ok, err ) {
-                       var d = $.Deferred(),
-                               apiPromise;
+                       // Fetch with allpages to only get categories that have a corresponding description page.
+                       var apiPromise = this.get( {
+                               list: 'allpages',
+                               apprefix: prefix,
+                               apnamespace: mw.config.get( 'wgNamespaceIds' ).category
+                       } );
 
                        // Backwards compatibility (< MW 1.20)
                        if ( ok || err ) {
                                mw.track( 'mw.deprecate', 'api.cbParam' );
                                mw.log.warn( msg );
-                               d.done( ok ).fail( err );
                        }
 
-                       // Fetch with allpages to only get categories that have a corresponding description page.
-                       apiPromise = this.get( {
-                                       list: 'allpages',
-                                       apprefix: prefix,
-                                       apnamespace: mw.config.get( 'wgNamespaceIds' ).category
-                               } )
-                               .done( function ( data ) {
+                       return apiPromise
+                               .then( function ( data ) {
                                        var texts = [];
                                        if ( data.query && data.query.allpages ) {
                                                $.each( data.query.allpages, function ( i, category ) {
                                                        texts.push( new mw.Title( category.title ).getNameText() );
                                                } );
                                        }
-                                       d.resolve( texts );
+                                       return texts;
                                } )
-                               .fail( d.reject );
-
-                       return d.promise( { abort: apiPromise.abort } );
+                               .done( ok )
+                               .fail( err )
+                               .promise( { abort: apiPromise.abort } );
                },
 
 
                 *  if title was not found.
                 */
                getCategories: function ( title, ok, err, async ) {
-                       var d = $.Deferred(),
-                               apiPromise;
+                       var apiPromise = this.get( {
+                               prop: 'categories',
+                               titles: String( title )
+                       }, {
+                               async: async === undefined ? true : async
+                       } );
 
                        // Backwards compatibility (< MW 1.20)
                        if ( ok || err ) {
                                mw.track( 'mw.deprecate', 'api.cbParam' );
                                mw.log.warn( msg );
-                               d.done( ok ).fail( err );
                        }
 
-                       apiPromise = this.get( {
-                                       prop: 'categories',
-                                       titles: title.toString()
-                               }, {
-                                       async: async === undefined ? true : async
-                               } )
-                               .done( function ( data ) {
-                                       var ret = false;
+                       return apiPromise
+                               .then( function ( data ) {
+                                       var titles = false;
                                        if ( data.query && data.query.pages ) {
                                                $.each( data.query.pages, function ( id, page ) {
                                                        if ( page.categories ) {
-                                                               if ( typeof ret !== 'object' ) {
-                                                                       ret = [];
+                                                               if ( titles === false ) {
+                                                                       titles = [];
                                                                }
                                                                $.each( page.categories, function ( i, cat ) {
-                                                                       ret.push( new mw.Title( cat.title ) );
+                                                                       titles.push( new mw.Title( cat.title ) );
                                                                } );
                                                        }
                                                } );
                                        }
-                                       d.resolve( ret );
+                                       return titles;
                                } )
-                               .fail( d.reject );
-
-                       return d.promise( { abort: apiPromise.abort } );
+                               .done( ok )
+                               .fail( err )
+                               .promise( { abort: apiPromise.abort } );
                }
 
        } );
index 91d9b8f..edfb34a 100644 (file)
@@ -60,7 +60,7 @@
                                action: 'edit',
                                section: 'new',
                                format: 'json',
-                               title: title.toString(),
+                               title: String( title ),
                                summary: header,
                                text: message
                        } ).done( ok ).fail( err );
index 7490862..914f3ec 100644 (file)
@@ -49,7 +49,7 @@
                        options = {};
                }
 
-               // Force toString if we got a mw.Uri object
+               // Force a string if we got a mw.Uri object
                if ( options.ajax && options.ajax.url !== undefined ) {
                        options.ajax.url = String( options.ajax.url );
                }
index 1c04b17..952dea4 100644 (file)
                 * @return {string} return.done.data Parsed HTML of `wikitext`.
                 */
                parse: function ( wikitext, ok, err ) {
-                       var d = $.Deferred(),
-                               apiPromise;
+                       var apiPromise = this.get( {
+                               action: 'parse',
+                               contentmodel: 'wikitext',
+                               text: wikitext
+                       } );
 
                        // Backwards compatibility (< MW 1.20)
                        if ( ok || err ) {
                                mw.track( 'mw.deprecate', 'api.cbParam' );
                                mw.log.warn( 'Use of mediawiki.api callback params is deprecated. Use the Promise instead.' );
-                               d.done( ok ).fail( err );
                        }
 
-                       apiPromise = this.get( {
-                                       action: 'parse',
-                                       contentmodel: 'wikitext',
-                                       text: wikitext
+                       return apiPromise
+                               .then( function ( data ) {
+                                       return data.parse.text['*'];
                                } )
-                               .done( function ( data ) {
-                                       if ( data.parse && data.parse.text && data.parse.text['*'] ) {
-                                               d.resolve( data.parse.text['*'] );
-                                       }
-                               } )
-                               .fail( d.reject );
-
-                       return d.promise( { abort: apiPromise.abort } );
+                               .done( ok )
+                               .fail( err )
+                               .promise( { abort: apiPromise.abort } );
                }
        } );
 
index 653c90a..9d65e1f 100644 (file)
@@ -6,6 +6,7 @@
 
        /**
         * @private
+        * @static
         * @context mw.Api
         *
         * @param {string|mw.Title|string[]|mw.Title[]} pages Full page name or instance of mw.Title, or an
        function doWatchInternal( pages, ok, err, addParams ) {
                // XXX: Parameter addParams is undocumented because we inherit this
                // documentation in the public method..
-               var params, apiPromise,
-                       d = $.Deferred();
+               var apiPromise = this.post(
+                       $.extend(
+                               {
+                                       action: 'watch',
+                                       titles: $.isArray( pages ) ? pages.join( '|' ) : String( pages ),
+                                       token: mw.user.tokens.get( 'watchToken' ),
+                                       uselang: mw.config.get( 'wgUserLanguage' )
+                               },
+                               addParams
+                       )
+               );
 
                // Backwards compatibility (< MW 1.20)
                if ( ok || err ) {
                        mw.track( 'mw.deprecate', 'api.cbParam' );
                        mw.log.warn( 'Use of mediawiki.api callback params is deprecated. Use the Promise instead.' );
-                       d.done( ok ).fail( err );
                }
 
-               params = {
-                       action: 'watch',
-                       token: mw.user.tokens.get( 'watchToken' ),
-                       uselang: mw.config.get( 'wgUserLanguage' ),
-                       titles: $.isArray( pages ) ? pages.join( '|' ) : String( pages )
-               };
-
-               if ( addParams ) {
-                       $.extend( params, addParams );
-               }
-
-               apiPromise = this.post( params )
-                       .done( function ( data ) {
+               return apiPromise
+                       .then( function ( data ) {
                                // If a single page was given (not an array) respond with a single item as well.
-                               d.resolve( $.isArray( pages ) ? data.watch : data.watch[0] );
+                               return $.isArray( pages ) ? data.watch : data.watch[0];
                        } )
-                       .fail( d.reject );
-
-               return d.promise( { abort: apiPromise.abort } );
+                       .done( ok )
+                       .fail( err )
+                       .promise( { abort: apiPromise.abort } );
        }
 
        $.extend( mw.Api.prototype, {
index 7f9a023..8e78da3 100644 (file)
@@ -8,28 +8,43 @@ class ArticleTablesTest extends MediaWikiLangTestCase {
        /**
         * @covers Title::getTemplateLinksFrom
         * @covers Title::getLinksFrom
+        * @todo give this test a real name explaining what is being tested here
         */
        public function testbug14404() {
-               global $wgContLang, $wgLanguageCode, $wgLang;
-
                $title = Title::newFromText( 'Bug 14404' );
                $page = WikiPage::factory( $title );
                $user = new User();
                $user->mRights = array( 'createpage', 'edit', 'purge' );
-               $wgLanguageCode = 'es';
-               $wgContLang = Language::factory( 'es' );
+               $this->setMwGlobals( 'wgLanguageCode', 'es' );
+               $this->setMwGlobals( 'wgContLang', Language::factory( 'es' ) );
+               $this->setMwGlobals( 'wgLang', Language::factory( 'fr' ) );
 
-               $wgLang = Language::factory( 'fr' );
-               $page->doEditContent( new WikitextContent( '{{:{{int:history}}}}' ), 'Test code for bug 14404', 0, false, $user );
+               $page->doEditContent(
+                       new WikitextContent( '{{:{{int:history}}}}' ),
+                       'Test code for bug 14404',
+                       0,
+                       false,
+                       $user
+               );
                $templates1 = $title->getTemplateLinksFrom();
 
-               $wgLang = Language::factory( 'de' );
-               $page = WikiPage::factory( $title ); // In order to force the rerendering of the same wikitext
+               $this->setMwGlobals( 'wgLang', Language::factory( 'de' ) );
+               $page = WikiPage::factory( $title ); // In order to force the re-rendering of the same wikitext
 
                // We need an edit, a purge is not enough to regenerate the tables
-               $page->doEditContent( new WikitextContent( '{{:{{int:history}}}}' ), 'Test code for bug 14404', EDIT_UPDATE, false, $user );
+               $page->doEditContent(
+                       new WikitextContent( '{{:{{int:history}}}}' ),
+                       'Test code for bug 14404',
+                       EDIT_UPDATE,
+                       false,
+                       $user
+               );
                $templates2 = $title->getTemplateLinksFrom();
 
+               /**
+                * @var Title[] $templates1
+                * @var Title[] $templates2
+                */
                $this->assertEquals( $templates1, $templates2 );
                $this->assertEquals( $templates1[0]->getFullText(), 'Historial' );
        }
index dc19154..3cf7abd 100644 (file)
@@ -32,17 +32,16 @@ class ExtraParserTest extends MediaWikiTestCase {
        }
 
        /**
-        * Bug 8689 - Long numeric lines kill the parser
+        * @see Bug 8689
         * @covers Parser::parse
         */
-       public function testBug8689() {
-               global $wgUser;
+       public function testLongNumericLinesDontKillTheParser() {
                $longLine = '1.' . str_repeat( '1234567890', 100000 ) . "\n";
 
-               $t = Title::newFromText( 'Unit test' );
-               $options = ParserOptions::newFromUser( $wgUser );
+               $title = Title::newFromText( 'Unit test' );
+               $options = ParserOptions::newFromUser( new User() );
                $this->assertEquals( "<p>$longLine</p>",
-                       $this->parser->parse( $longLine, $t, $options )->getText() );
+                       $this->parser->parse( $longLine, $title, $options )->getText() );
        }
 
        /**
@@ -52,16 +51,23 @@ class ExtraParserTest extends MediaWikiTestCase {
        public function testParse() {
                $title = Title::newFromText( __FUNCTION__ );
                $parserOutput = $this->parser->parse( "Test\n{{Foo}}\n{{Bar}}", $title, $this->options );
-               $this->assertEquals( "<p>Test\nContent of <i>Template:Foo</i>\nContent of <i>Template:Bar</i>\n</p>", $parserOutput->getText() );
+               $this->assertEquals(
+                       "<p>Test\nContent of <i>Template:Foo</i>\nContent of <i>Template:Bar</i>\n</p>",
+                       $parserOutput->getText()
+               );
        }
 
        /**
         * @covers Parser::preSaveTransform
         */
        public function testPreSaveTransform() {
-               global $wgUser;
                $title = Title::newFromText( __FUNCTION__ );
-               $outputText = $this->parser->preSaveTransform( "Test\r\n{{subst:Foo}}\n{{Bar}}", $title, $wgUser, $this->options );
+               $outputText = $this->parser->preSaveTransform(
+                       "Test\r\n{{subst:Foo}}\n{{Bar}}",
+                       $title,
+                       new User(),
+                       $this->options
+               );
 
                $this->assertEquals( "Test\nContent of ''Template:Foo''\n{{Bar}}", $outputText );
        }
@@ -73,7 +79,10 @@ class ExtraParserTest extends MediaWikiTestCase {
                $title = Title::newFromText( __FUNCTION__ );
                $outputText = $this->parser->preprocess( "Test\n{{Foo}}\n{{Bar}}", $title, $this->options );
 
-               $this->assertEquals( "Test\nContent of ''Template:Foo''\nContent of ''Template:Bar''", $outputText );
+               $this->assertEquals(
+                       "Test\nContent of ''Template:Foo''\nContent of ''Template:Bar''",
+                       $outputText
+               );
        }
 
        /**
@@ -148,6 +157,12 @@ class ExtraParserTest extends MediaWikiTestCase {
                $this->assertEquals( "{{Foo}} information <!-- is very secret -->", $outputText );
        }
 
+       /**
+        * @param Title $title
+        * @param bool $parser
+        *
+        * @return array
+        */
        static function statelessFetchTemplate( $title, $parser = false ) {
                $text = "Content of ''" . $title->getFullText() . "''";
                $deps = array();
index 1305724..ba3c6c0 100644 (file)
@@ -213,6 +213,7 @@ class TitleTest extends MediaWikiTestCase {
        /**
         * @dataProvider provideBug31100
         * @covers Title::fixSpecialName
+        * @todo give this test a real name explaining what is being tested here
         */
        public function testBug31100FixSpecialName( $text, $expectedParam ) {
                $title = Title::newFromText( $text );
index 2ddf05a..e6af126 100644 (file)
@@ -258,4 +258,33 @@ class UserTest extends MediaWikiTestCase {
 
                $wgPasswordExpireGrace = $wgTemp;
        }
+
+       /**
+        * Test password validity checks. There are 3 checks in core,
+        *      - ensure the password meets the minimal length
+        *      - ensure the password is not the same as the username
+        *      - ensure the username/password combo isn't forbidden
+        * @covers User::checkPasswordValidity()
+        * @covers User::getPasswordValidity()
+        * @covers User::isValidPassword()
+        */
+       public function testCheckPasswordValidity() {
+               $this->setMwGlobals( 'wgMinimalPasswordLength', 6 );
+               $user = User::newFromName( 'Useruser' );
+               // Sanity
+               $this->assertTrue( $user->isValidPassword( 'Password1234' ) );
+
+               // Minimum length
+               $this->assertFalse( $user->isValidPassword( 'a' ) );
+               $this->assertFalse( $user->checkPasswordValidity( 'a' )->isGood() );
+               $this->assertEquals( 'passwordtooshort', $user->getPasswordValidity( 'a' ) );
+
+               // Matches username
+               $this->assertFalse( $user->checkPasswordValidity( 'Useruser' )->isGood() );
+               $this->assertEquals( 'password-name-match', $user->getPasswordValidity( 'Useruser' ) );
+
+               // On the forbidden list
+               $this->assertFalse( $user->checkPasswordValidity( 'Passpass' )->isGood() );
+               $this->assertEquals( 'password-login-forbidden', $user->getPasswordValidity( 'Passpass' ) );
+       }
 }
index bc08afe..124988f 100644 (file)
@@ -6,12 +6,16 @@
  * @group medium
  */
 class ApiQueryAllPagesTest extends ApiTestCase {
+
        protected function setUp() {
                parent::setUp();
                $this->doLogin();
        }
 
-       function testBug25702() {
+       /**
+        * @todo give this test a real name explaining what is being tested here
+        */
+       public function testBug25702() {
                $title = Title::newFromText( 'Category:Template:xyz' );
                $page = WikiPage::factory( $title );
                $page->doEdit( 'Some text', 'inserting content' );
index 62ee45a..01c330a 100644 (file)
@@ -154,6 +154,7 @@ class JavaScriptMinifierTest extends MediaWikiTestCase {
        /**
         * @dataProvider provideBug32548
         * @covers JavaScriptMinifier::minify
+        * @todo give this test a real name explaining what is being tested here
         */
        public function testBug32548Exponent( $num ) {
                // Long line breaking was being incorrectly done between the base and
index b913af8..c627537 100644 (file)
@@ -26,7 +26,7 @@ class SearchUpdateTest extends MediaWikiTestCase {
                $this->setMwGlobals( 'wgSearchType', 'MockSearch' );
        }
 
-       function updateText( $text ) {
+       public function updateText( $text ) {
                return trim( SearchUpdate::updateText( $text ) );
        }
 
@@ -67,6 +67,7 @@ EOT
 
        /**
         * @covers SearchUpdate::updateText
+        * @todo give this test a real name explaining what is being tested here
         */
        public function testBug32712() {
                $text = "text „http://example.com“ text";
index 8a92daf..ea2d28c 100644 (file)
@@ -17,6 +17,7 @@ class SpecialPreferencesTest extends MediaWikiTestCase {
         * is not throwing a fatal error.
         *
         * Test specifications by Alexandre "ialex" Emsenhuber.
+        * @todo give this test a real name explaining what is being tested here
         */
        public function testBug41337() {
 
@@ -41,13 +42,6 @@ class SpecialPreferencesTest extends MediaWikiTestCase {
                        )
                        ) );
 
-               # Validate the mock (FIXME should probably be removed)
-               $this->assertFalse( $user->isAnon() );
-               $this->assertEquals( array(),
-                       $user->getEffectiveGroups() );
-               $this->assertEquals( 'superlongnickname',
-                       $user->getOption( 'nickname' ) );
-
                # Forge a request to call the special page
                $context = new RequestContext();
                $context->setRequest( new FauxRequest() );
index 1c89377..da72a9d 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @group Database
  *
@@ -10,6 +11,11 @@ class UploadStashTest extends MediaWikiTestCase {
         */
        public static $users;
 
+       /**
+        * @var string
+        */
+       private $bug29408File;
+
        protected function setUp() {
                parent::setUp();
 
@@ -45,6 +51,9 @@ class UploadStashTest extends MediaWikiTestCase {
                parent::tearDown();
        }
 
+       /**
+        * @todo give this test a real name explaining what is being tested here
+        */
        public function testBug29408() {
                $this->setMwGlobals( 'wgUser', self::$users['uploader']->user );
 
@@ -59,20 +68,40 @@ class UploadStashTest extends MediaWikiTestCase {
                $stash->removeFile( $file->getFileKey() );
        }
 
-       public function testValidRequest() {
-               $request = new FauxRequest( array( 'wpFileKey' => 'foo' ) );
-               $this->assertFalse( UploadFromStash::isValidRequest( $request ), 'Check failure on bad wpFileKey' );
-
-               $request = new FauxRequest( array( 'wpSessionKey' => 'foo' ) );
-               $this->assertFalse( UploadFromStash::isValidRequest( $request ), 'Check failure on bad wpSessionKey' );
-
-               $request = new FauxRequest( array( 'wpFileKey' => 'testkey-test.test' ) );
-               $this->assertTrue( UploadFromStash::isValidRequest( $request ), 'Check good wpFileKey' );
+       public function provideInvalidRequests() {
+               return array(
+                       'Check failure on bad wpFileKey' =>
+                               array( new FauxRequest( array( 'wpFileKey' => 'foo' ) ) ),
+                       'Check failure on bad wpSessionKey' =>
+                               array( new FauxRequest( array( 'wpSessionKey' => 'foo' ) ) ),
+               );
+       }
 
-               $request = new FauxRequest( array( 'wpFileKey' => 'testkey-test.test' ) );
-               $this->assertTrue( UploadFromStash::isValidRequest( $request ), 'Check good wpSessionKey' );
+       /**
+        * @dataProvider provideInvalidRequests
+        */
+       public function testValidRequestWithInvalidRequests( $request ) {
+               $this->assertFalse( UploadFromStash::isValidRequest( $request ) );
+       }
 
-               $request = new FauxRequest( array( 'wpFileKey' => 'testkey-test.test', 'wpSessionKey' => 'foo' ) );
-               $this->assertTrue( UploadFromStash::isValidRequest( $request ), 'Check key precedence' );
+       public function provideValidRequests() {
+               return array(
+                       'Check good wpFileKey' =>
+                               array( new FauxRequest( array( 'wpFileKey' => 'testkey-test.test' ) ) ),
+                       'Check good wpSessionKey' =>
+                               array( new FauxRequest( array( 'wpFileKey' => 'testkey-test.test' ) ) ),
+                       'Check key precedence' =>
+                               array( new FauxRequest( array(
+                                       'wpFileKey' => 'testkey-test.test',
+                                       'wpSessionKey' => 'foo'
+                               ) ) ),
+               );
        }
+       /**
+        * @dataProvider provideValidRequests
+        */
+       public function testValidRequestWithValidRequests( $request ) {
+               $this->assertTrue( UploadFromStash::isValidRequest( $request ) );
+       }
+
 }