aboutsummaryrefslogtreecommitdiffstats
path: root/includes/jobqueue/Job.php
Commit message (Collapse)AuthorAgeFilesLines
* Add dependency injection for Job classesdaniel2023-01-191-47/+6
| | | | | | | Introduces JobFactory Bug: T245900 Change-Id: I094cc9325e5eaf2717ae510ef988a72407195224
* Revert "Reorg: Move some of request related classes to MediaWiki/Request"Zabe2022-10-271-1/+0
| | | | | | | | | This reverts commit 2bdc0b2b7209441a42a784157633a8a01b321922. Reason for revert: T166010#8349431 Bug: T166010 Change-Id: Idcd3025647aec99532f5d69b9c1718c531761283
* Reorg: Move some of request related classes to MediaWiki/RequestAmir Sarabadani2022-10-261-0/+1
| | | | | | | | | | | | | Moving: - DerivativeRequest - FauxRequest - FauxRequestUpload - PathRouter - WebRequest - WebRequestUpload Bug: T166010 Change-Id: I5ea70120d745f2876ae31d039f3f8a51e49e9ad8
* Replace trivial usages of code in strings with concatenationThiemo Kreuz2022-08-261-1/+1
| | | | | | | This is really hard to read. What is code, what is string? These places are so simple, they really don't need the "{$var}" syntax. Change-Id: I589dedb8c0193eec4eef500bbb896b5b790b727b
* Ensure we don't pass null to mb_strlen.Mark A. Hershberger2022-07-121-1/+1
| | | | | | | Seen in RefreshSecondaryDataUpdateTest::testEnqueueOnFailure() Bug: T289926 Change-Id: I22eb808ab27e702033c4df05ec299554f944590b
* Use MainConfigNames instead of string literalsAryeh Gregor2022-04-111-1/+3
| | | | | | | | Part 1, proof of concept. Hundreds of files left to go. These changes brought to you in large part by vim macros. Bug: T305805 Change-Id: I44789091e9f6394c800a11b29f22528c8dcacf71
* Replace deprecated JobQueueGroup::singleton()Umherirrender2022-01-271-1/+1
| | | | Change-Id: Icdb301d352d302f70fefba9b40df2368cb217fd2
* Refactor global variables to use MediaWikiServices insteadTChin2022-01-101-3/+4
| | | | | | | | | | | | Automatically refactors wg prefixed globals to use MediaWikiServices config using Rector. Doesn't include files that set globals or files that fail CI. Rector Gist: https://gist.github.com/tchin25/7cc54f6d23aedef010b22e4dfbead228 * This patch uses a modified source code rector library for our specific use case and the rector will have different effects without it. A writeup for future reference is here: https://meta.wikimedia.org/wiki/User:TChin_(WMF)/Using_Rector_On_MediaWiki Change-Id: I1a691f01cd82e60bf41207d32501edb4b9835e37
* Fix typos in comments (I-J)Siddharth VP2021-12-301-1/+1
| | | | Change-Id: Icaea2b6665cfc3b811d94f70c93452237f5e72bf
* Remove Title param typehints from jobsPetr Pchelko2021-06-071-11/+13
| | | | Change-Id: I8d8407d704eac97d4b0574369e315e28e23a89a8
* Document Job's required constructor signatureGergő Tisza2020-11-181-0/+3
| | | | Change-Id: I2f374169f2b55a7be03507ce1f1c838428b56b75
* Merge "Replace "@stable for subclassing" with "@stable to extend""jenkins-bot2020-07-131-1/+1
|\
| * Replace "@stable for subclassing" with "@stable to extend"daniel2020-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | For compliance with the new version of the table interface policy (T255803). This patch was created by an automated search & replace operation on the includes/ directory. Bug: T257789 Change-Id: Ie32c1b11b3d16ddfc0c83a757327d449ff80b2e4
* | Merge "Replace "@stable for calling" by "@stable to call""jenkins-bot2020-07-131-1/+1
|\ \
| * | Replace "@stable for calling" by "@stable to call"daniel2020-07-131-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | For compliance with the new version of the table interface policy (T255803). This patch was created by an automated search & replace operation on the includes/ directory. Bug: T257789 Change-Id: If560596f5e1e0a3da91afc36e656e7c27f040968
* / Replace "@stable for overriding" with "@stable to override"daniel2020-07-131-18/+18
|/ | | | | | | | | | | For compliance with the new version of the table interface policy (T255803). This patch was created by an automated search & replace operation on the includes/ directory. Bug: T257789 Change-Id: I5ffbb91882ecce2019ab644839eab5e8fb8a1c5f
* Annotate extensible classes.daniel2020-07-091-2/+49
| | | | | | | This marks some base classes as stable for subclassing. Bug: T247862 Change-Id: I7b77075849aa40960f2486b463e498a3ea8058e9
* Fix method/function names case mismatch in core filesDerick Alangi2019-08-311-1/+1
| | | | | | | | | | | PHP doesn't care much but I think we humans do because we should call methods by the name we give them. Method fixed are; - isOk() -> isOK() - setOk() -> setOK() - teardown() -> tearDown() Change-Id: I6b3f0cf3902887058efa426968da380803869e0b
* jobqueue: mention more methods in RunnableJob to fix various IDEA warningsAaron Schulz2019-07-051-35/+0
| | | | Change-Id: I156411062ae7831c935869d226fc4934bde55107
* Job: Fix typo in exception message for invalid specificationMáté Szabó2019-05-261-1/+3
| | | | | | | | The Job::factory method throws an InvalidArgumentException if a given job specification is invalid. The error message for this exception was worded in correctly. This patch improves the message to avoid confusion. Change-Id: I6cab739263c1d3530c0650823db022dd5a4b60bc
* jobqueue: Follow-up for fc5d51f12936ed (added GenericParameterJob)Timo Tijhof2019-04-251-17/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove duplicate $params check from Job::factory done in Job::__construct. * In Job::factory(), restore use of a valid title as default for passing as constructor arg to old job classes. Their constructor may expect it to be valid. Keep the invalid dummy in Job::__construct, and document why. * tests: Update test case for failure mode when using Job::factory with a class that requires a title. It asserted getting an invalid title. This now restores the behaviour prior to fc5d51f12936ed, which is that job classes that require a title, get a valid one. * tests: Remove test case for testToString that used an explicitly passed but invalid params value. I've converted that to expect the exception we now throw instead. * tests: Update getMockJob(), also used by testToString, which was relying on undocumented behaviour that 'new Title' is public and gets namespace=0 and title=''. Before fc5d51f12936ed, title params weren't in toString() and it asserted outputting three spaces (delimiter, empty string from formatted title, delimiter). In fc5d51f12936ed, this changed to asserting "Special:" which seems unintentional as we didn't pass it the internally reserved NS_SPECIAL/'' value, and yet was caught by the dbkey=='' check. Given this test case doesn't deal with titles, omit it for now. A job can either have a $title and title/namespace in params, or neither. This test was asserting an in-memory scenario where $title can be an object, but title/namespace absent from params. Bug: T221368 Depends-On: I89f6ad6967d6f82d87a62c15c0dded901c51b714 Change-Id: I2ec99a12ecc627359a2aae5153d5d7c54156ff46
* jobqueue: add GenericParameterJob and RunnableJob interfaceAaron Schulz2019-04-081-21/+30
| | | | | | | | | | Simplify the code of jobs that do not care about titles and removes the direct Title dependency from JobQueue. Remove getTitle() from IJobSpecification itself. Move all the Job::factory calls into a single JobQueue::factoryJob() method. Depends-on: Iee78f4baeca0c0b4d6db073f2fbcc56855114ab0 Change-Id: I9c9d0726d4066bb0aa937665847ad6042ade13ec
* jobqueue: Change internal $params logic to teach Phan (3)Timo Tijhof2019-04-051-4/+4
| | | | | | | | | | | | | | | | | | | | Follows-up 9b4938c40d02c, 4bff6f1558, and 766549999c. It seems despite being optional and documented as 'array|Title', Phan still thinks it is wrong to pass Title. Try removing the explicit default of empty array, the lower code already does this anyway. This should fix build failures that are preventing merges in repos where Phan is finding Job::__construct(string, Title) where it currently fails as follows: CompileArticleMetadataJob.php:11 PhanTypeMismatchArgument Argument 2 (params) is …\Title|string but \Job::__construct() takes array Change-Id: I1c3aee273e0917e30b9c18b49b24fc7f966ff57c
* jobqueue: Document Title as valid param type for compat (2)Timo Tijhof2019-04-051-1/+1
| | | | | | | | | | | | | | | | | Follows-up 9b4938c40d02c, and 4bff6f1558. The latter of which updated ::factory() instead of __construct(). Oops. This should fix build failures that are preventing merges in repos where Phan is finding Job::__construct(string, Title) where it currently fails as follows: CompileArticleMetadataJob.php:11 PhanTypeMismatchArgument Argument 2 (params) is …\Title|string but \Job::__construct() takes array As Phan is reading the php doc I guess. Change-Id: I128d57ead6bcb9dbae99d41a1f23192c3f6fbdba
* jobqueue: Document Title as valid param type for compatTimo Tijhof2019-04-051-1/+1
| | | | | | | | | | | | | | | | Follows-up 9b4938c40d02c. This should fix build failures that are preventing merges in repos where Phan is finding Job::__construct(string, Title) where it currently fails as follows: CompileArticleMetadataJob.php:11 PhanTypeMismatchArgument Argument 2 (params) is …\Title|string but \Job::__construct() takes array As Phan is reading the php doc I guess. Change-Id: I94b442f06b6858d136546bf22f2465cf8f071ab0
* Add Job::getMetadata() and Job::setMetadata() accessorsAaron Schulz2019-04-031-0/+30
| | | | Change-Id: I3a97008d324f600a1c9f6005673073277ee564fa
* Merge "Make Job::hasExecutionFlag() actually work"jenkins-bot2019-03-291-1/+1
|\
| * Make Job::hasExecutionFlag() actually workAaron Schulz2019-03-281-1/+1
| | | | | | | | Change-Id: I7d32edd5913e12a3380ca9f7f5a318e1682725bf
* | jobqueue: simplify the signature of Job::factory() and Job::__construct()Aaron Schulz2019-03-291-11/+24
|/ | | | | | | | | | | | | | Remove the $title argument from these methods to simplify subclasses that do not have a meaningful title to use. The Job::getTitle() method can be overriden by subclasses to return something meaningful. The old call signature is still supported for backwards compatibility. This will automatically determine what getTitle() returns as before. Use "Blankpage" as the "not applicable" title for jobs instead of one that looks like some error occured. Change-Id: I3d5bd012d9cef1e7daaccfb0d5d319552eb89fb6
* Job::factory should throw an InvalidArgumentException, not MWExceptionDerick Alangi2019-02-111-1/+1
| | | | Change-Id: I9a85562b205db604d2746ec5db0e72dacdb93c6d
* Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenientBartosz Dziewoński2018-05-301-9/+3
| | | | | | | | | | | | | | Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/ Replace with: '\1 ?? ' (Everywhere except includes/PHPVersionCheck.php) (Then, manually fix some line length and indentation issues) Then manually reviewed the replacements for cases where confusing operator precedence would result in incorrect results (fixing those in I478db046a1cc162c6767003ce45c9b56270f3372). Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
* Job: Remove insert() and batchInsert(), deprecated since 1.21James D. Forrester2018-05-211-30/+1
| | | | | Bug: T179624 Change-Id: I0d78a926c8c513fd652a424e8a51ded20e524a4a
* Do not start explicit transaction rounds for RecentChangesUpdateJobAaron Schulz2018-04-171-0/+15
| | | | | | | | | The replaces the hacky use of onTransactionIdle(), which no longer runs immediately in explicit transaction rounds since d4c31cf841. Also clarified TransactionRoundDefiningUpdate comment about rounds. Change-Id: Ie17eacdcaea4e47019cc94e1c7beed9d7fec5cf2
* Job::insert: Hard deprecate (soft-deprecated in 1.21!)James D. Forrester2017-11-021-0/+1
| | | | Change-Id: I5b653a3dacd6dc73a80b6bbcc282fdd5dad6e49a
* Allow callback functions for creating jobsLucas Werkmeister2017-05-091-5/+15
| | | | | | | | | | | | $wgJobClasses can now specify a factory function for creating a job, instead of a class to be instantiated directly. This makes it possible to inject services in a job constructor, and register a factory function that calls the constructor with default services. This follows Ieb85493a7765 and Ia2107dc5af78, which introduced factory functions for API modules and special pages. Change-Id: I0461e59da2a8fa6681e3b1fcdfc38bfed7f3ac32
* Pass Job success status to teardown callbacksGergő Tisza2016-10-051-4/+6
| | | | Change-Id: Icf2e03efcfd9232fe4ead776096b61cef1c06141
* Track which web request created a jobErik Bernhardson2016-04-131-0/+18
| | | | | | | | | | | | | | | We currently push a request id into structured logging (monolog/ logstash) to allow seeing all logs that were triggered by the same request. This extends that to pass the id through jobs so jobs triggered by a web request also share the same id and can be tracked together. This web request id will follow jobs both directly created by a request, and jobs created by those jobs. This should give us some more visibility when debugging into what started a particular job, and if a large number of jobs blowing up the job queue are somehow related. Change-Id: Iedbd031e6e9bb18fd6f7b923c8c305102255ab4b
* Make Job::toString() handle array parameters betterAaron Schulz2016-03-161-14/+11
| | | | | | Previously it would result in array(x) in fairly simple cases. Change-Id: I6bfe67faa45835babb2c7e259b5cd158e0f0a649
* Merge "Reset scoped session for upload jobs after deferred updates"jenkins-bot2016-03-011-0/+22
|\
| * Reset scoped session for upload jobs after deferred updatesAaron Schulz2016-02-241-0/+22
| | | | | | | | | | Bug: T126450 Change-Id: I8a6588209647252a4509078aaa7bf0cb1d9d299a
* | Convert all array() syntax to []Kunal Mehta2016-02-171-10/+10
|/ | | | | | | | | | Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
* Fixes related to WikiPage::triggerOpportunisticLinksUpdate()Aaron Schulz2015-10-241-2/+7
| | | | | | | | | | | | | | | | | | | | * Focus on updating links that would *not* already be updated by jobs, not those that already *will* be updated. * Place the jobs into a dedicated queue so they don't wait behind jobs that actually have to parse every time. This helps avoid queue buildup. * Make Job::factory() set the command field to match the value it had when enqueued. This makes it easier to have the same job class used for multiple queues. * Given the above, remove the RefreshLinksJob 'prioritize' flag. This worked by overriding getType() so that the job went to a different queue. This required both the special type *and* the flag to be set if using JobSpecification or either ack() would route to the wrong queue and fail or the job would go in the regular queue. This was too messy and error prone. Cirrus jobs using the same pattern also had ack() failures for example. Change-Id: I5941cb62cdafde203fdee7e106894322ba87b48a
* Improved job pickup time stats for delayed jobsAaron Schulz2015-07-011-0/+8
| | | | | | | * The delay time should not count Bug: T102743 Change-Id: I9e8b1f33b65681fd9f4f667233bce280bf6f227d
* Merge "Automatically deduplicate root jobs on insertion"jenkins-bot2015-06-051-0/+20
|\
| * Automatically deduplicate root jobs on insertionAaron Schulz2015-06-031-0/+20
| | | | | | | | | | | | * This makes lazyPush() simple to use in more cases Change-Id: I22e74485eaf3120e5669c5ee55dc7ab7310d7300
* | jobqueue: Record stats on how long it takes before a job is runKunal Mehta2015-06-031-0/+10
|/ | | | | Bug: T101054 Change-Id: I5dc13d79a5ec2e8cb6679e3ff2535b5cb031ca30
* Fixed Job constructor IDE notices about variable typesAaron Schulz2015-05-301-4/+4
| | | | Change-Id: I4b4e4e38e8d416c3445c52ced311f5fbfcde868a
* Use ksort() in getDeduplicationInfo for sanityAaron Schulz2015-03-191-0/+2
| | | | Change-Id: Id23cc987b3f1e23b35b0eedbfc5c9978774a0ebd
* Added some job queue commentsAaron Schulz2015-01-171-1/+9
| | | | Change-Id: If42b982ac339cc6aaf56ef2ed6c78867b83d2e56
* Expose job metadata in showJobs and the jobs logAaron Schulz2014-10-221-6/+15
| | | | | | * This means that redis job UUIDs now show up in these places Change-Id: Icea168de7e1590bfe275646bc2ccbb7151f032ae