Localisation updates from https://translatewiki.net.
[mediawiki.git] / includes / jobqueue / jobs / DuplicateJob.php
blob43fafbfb555fba724be596ea9fb8a6faab65d6ee
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
18 * @file
21 /**
22 * No-op job that does nothing.
24 * This is used by JobQueue::pop to temporarily represent duplicates.
26 * @internal
27 * @ingroup JobQueue
29 final class DuplicateJob extends Job implements GenericParameterJob {
30 /**
31 * Callers should use DuplicateJob::newFromJob() instead
33 * @param array $params Job parameters
35 public function __construct( array $params ) {
36 parent::__construct( 'duplicate', $params );
39 /**
40 * Get a duplicate no-op version of a job
42 * @param RunnableJob $job
43 * @return Job
45 public static function newFromJob( RunnableJob $job ) {
46 $djob = new self( $job->getParams() );
47 $djob->command = $job->getType();
48 $djob->params = is_array( $djob->params ) ? $djob->params : [];
49 $djob->params = [ 'isDuplicate' => true ] + $djob->params;
50 $djob->metadata = $job->getMetadata();
52 return $djob;
55 public function run() {
56 return true;