44 parent::__construct(
'enqueue', $params );
52 $jobs = is_array( $jobs ) ? $jobs : [ $jobs ];
54 return self::newFromJobsByDomain( [
55 WikiMap::getCurrentWikiDbDomain()->getId() => $jobs
66 $jobMapsByDomain = [];
67 foreach ( $jobsByDomain as $domain => $jobs ) {
68 $jobMapsByDomain[$domain] = [];
69 foreach ( $jobs as
$job ) {
71 $jobMapsByDomain[$domain][] =
$job->toSerializableArray();
73 throw new InvalidArgumentException(
"Jobs must be of type JobSpecification." );
75 $deduplicate = $deduplicate &&
$job->ignoreDuplicates();
79 $eJob =
new self( [
'jobsByDomain' => $jobMapsByDomain ] );
82 $eJob->removeDuplicates = $deduplicate;
94 return self::newFromJobsByDomain( $jobsByWiki );
97 public function run() {
98 $jobsByDomain = $this->params[
'jobsByDomain'] ?? $this->params[
'jobsByWiki'];
100 $jobQueueGroupFactory = MediaWikiServices::getInstance()->getJobQueueGroupFactory();
101 foreach ( $jobsByDomain as $domain => $jobMaps ) {
103 foreach ( $jobMaps as $jobMap ) {
104 $jobSpecs[] = JobSpecification::newFromArray( $jobMap );
106 $jobQueueGroupFactory->makeJobQueueGroup( $domain )->push( $jobSpecs );
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
Router job that takes jobs and enqueues them to their proper queues.
static newFromJobsByWiki(array $jobsByWiki)
static newFromLocalJobs( $jobs)
__construct(array $params)
Callers should use the factory methods instead.
static newFromJobsByDomain(array $jobsByDomain)
Job queue task description base code.
Class to both describe a background job and handle jobs.
Interface for generic jobs only uses the parameters field and are JSON serializable.
if(count( $args)< 1) $job