Commit graph

743 commits

Author SHA1 Message Date
Thiemo Kreuz
41ec072d16 Add missing null to string casts when using rd_fragment and such
These columns are nullable, but the method doesn't accept null.

Found in Logstash.

Change-Id: I3eaafe31005c9319fdd03f8f4b54e7b51ef430f9
2021-11-02 07:14:32 +00:00
Paladox
bc931b1253 JobQueueRedis: Replace deprecated zSize with zCard
https://github.com/phpredis/phpredis/issues/1669

Change-Id: I15f1e398d45d699c3e683164e42ea6c0dc974d96
2021-10-26 01:28:27 +00:00
Umherirrender
66d4e6a3d0 Use correct default value when calling Status::getWikiText
Both parameter have a default of false, not null.

Change-Id: I5754895347db244eee155f8cf5965df5f4fd2d1a
2021-10-16 22:35:01 +02:00
jenkins-bot
92b52bfc07 Merge "jobqueue: Batch jobs that will end up in the default queue" 2021-10-06 17:32:37 +00:00
Daimona Eaytoy
ab6de6305b Use DeletePage in ApiDelete and DeletePageJob
Bug: T288758
Change-Id: I1cd9b18214df93bdcc0ff1e9dbd937368841e538
2021-10-05 13:25:36 +00:00
Amir Sarabadani
419c14b013 jobqueue: Batch jobs that will end up in the default queue
JobQueueGroup::get( $type ) returns a new object for each job type even
if it's the same class (default class). Also it builds different queues
and push them separelty a couple lines lower limiting the ability to
batch push them in the default job queue object.

Given that JobQueue cares about job types being the same as the class
type (which is important for JobQueueDB implementation), adding a config
option called typeAgnostic to ignore type mismatch in JobQueue
implementations that don't care about the type (like JobQueueEventBus)

Bug: T292048
Change-Id: I151f067ca94a985c816446b545921c387b083911
2021-10-04 09:04:11 +02:00
TChin
fd5915823f Update callers of deprecated BacklinkCache methods
Bug: T290015
Change-Id: I73a111d064f7778bbeb90fd4ea85d8bec201427b
2021-09-29 18:56:17 +00:00
Alexander Vorwerk
04dfdc3653 Hard deprecate User::setOption()
deprecated since 1.35

Bug: T277818
Change-Id: Ic251d624e5d6fa857aa92f9c5dd3df44714ac610
2021-09-26 17:18:54 +02:00
DannyS712
db49026745 ActivityUpdateJob: accept PageReference
For both LinkTarget and PageReference, just extract
namespace and dbkey and pass those in the array
of parameters to Job::__construct().

Allows a bunch of simplification to WatchedItemStore.

Bug: T291531
Change-Id: Id150d0c62af38d4b3d17e5698866127c6e04717e
2021-09-21 23:30:51 +00:00
DannyS712
a2b20b63d7 Emit deprecation warnings reading from $wgUser
With this patch deprecation warnings will be emitted
if $wgUser is accessed or written into. The only pattern
of usage still allowed is

$oldUser = $wgUser;
$wgUser = $newUser;
// Do something
$wgUser = $oldUser;

Once there is no deprecation warnings, we know that nothing
legitimately depends on $wgUser being set, so we can safely
remove the code that's still allowed as well.

Bug: T267861
Change-Id: Ia1c42b3a32acd0e2bb9b0e93f1dc3c82640dcb22
2021-09-15 20:17:04 -07:00
Derick Alangi
db43511e6a Title: Make use of BacklinkCacheFactory service
Change-Id: I48161585de6f329ec4037156234e0b07b3b837e6
2021-09-09 14:04:02 +01:00
James D. Forrester
3407458ea0 MWExceptionHandler: Rename rollbackMasterChangesAndLog to rollbackPrimaryChangesAndLog
Change-Id: I9a90b4f74eb65cd9e20ae9faa6d1949be96543c0
2021-09-03 17:36:34 -07:00
Umherirrender
2e4ee47c3d Cleanup mixed space/tab line indent
Change-Id: I833052a656b1ce419c0929f6f0514f2a33c2c4cc
2021-09-04 00:52:31 +02:00
James D. Forrester
8426aacd96 ILoadBalancer: Rename waitForMasterPos to waitForPrimaryPos
Hard-deprecating immediately as no known users in git outside of this repo.

Bug: T282894
Change-Id: I5fa312ae89660a9c6de3c24e13d48de92893e5b0
2021-09-03 20:11:05 +00:00
James D. Forrester
86f3270bda Tag various new 'primary' methods as @since 1.37
Change-Id: Icbbbc84154174da1bd9398990679857898f418d5
2021-09-02 11:58:19 -07:00
jenkins-bot
9957bc2f84 Merge "ILoadBalancer/ILBFactory: Rename commitMasterChanges() to commitPrimaryChanges()" 2021-09-02 18:50:43 +00:00
jenkins-bot
5f30d77f4d Merge "ILoadBalancer/ILBFactory: Rename beginMasterChanges() to beginPrimaryChanges()" 2021-09-02 18:30:07 +00:00
James D. Forrester
5ad7ca7eba ILoadBalancer/ILBFactory: Rename commitMasterChanges() to commitPrimaryChanges()
Bug: T282894
Change-Id: I0d80be56e683924254c4e38d05e1109ea74eeab5
2021-09-02 11:27:10 -07:00
James D. Forrester
577e1c3710 ILoadBalancer/ILBFactory: Rename beginMasterChanges() to beginPrimaryChanges()
Bug: T282894
Change-Id: I10e607215e6772c48670659719948f7135472a7f
2021-09-01 22:15:45 +00:00
Umherirrender
4d42b5e86e docs: Change wording master to primary in comments and log text
Bug: T254646
Change-Id: I5379dc79be60c99f0a30f74e5d624f81fe6f921b
2021-09-01 23:04:40 +02:00
Daimona Eaytoy
b9a82b3209 jobs: Remove unused param from DoubleRedirectJob::fixRedirects
It's an optional parameter at the end, so it can be removed without
breaking anything.

Change-Id: I987e678846f1a204efb7018575226299f716309e
2021-09-01 01:59:11 +00:00
jenkins-bot
ae8522b34c Merge "Same code style and formatting for exists-style SQL queries" 2021-08-24 17:44:17 +00:00
Umherirrender
240eaed9df Improve exception message for JobQueueGroup::assertValidJobs
Bug: T287623
Change-Id: I2108fe719a256c5d1d613055fdcb2890341bc0ee
2021-08-19 22:05:49 +02:00
Thiemo Kreuz
46f26dff03 Same code style and formatting for exists-style SQL queries
Queries that query a value "1" are expected to return either
that "1" (possibly as a string), or false. It's safe to simply
cast this to bool and use it as it is.

Queries for COUNT(*) are expected to return that number,
possibly as a string. It's not possible for such a query to
return false. And even if, casting to 0 is fine.

I found an existing code style where the table name and the
"1" are on the same line as the selectField() method name, and
applied it to all similar queries.

Change-Id: I9453196281871c03ef03f653f43762eb9284342f
2021-08-12 11:37:58 +02:00
DannyS712
7325f17490 Add JobQueue::assertMatchingJobType() for deduplication
Checks that a job's type matches that of the JobQueue

Change-Id: Idd185114e51c3a6001dcc91421a66296a32c3f31
2021-08-08 05:32:40 +00:00
James D. Forrester
1d71fd91d6 ILoadBalancer and IDatabase: Rename getMasterPos to getPrimaryPos
Bug: T282894
Change-Id: I30a600335af735a13a6ad2d3df56a5f17e05bfab
2021-08-02 18:14:41 +00:00
James D. Forrester
d11c59538a Rename DB primary position interfaces to DBPrimaryPos and MySQLPrimaryPos
And replace all uses.

Bug: T282894
Change-Id: I5222a8568255ac9fa5e2350e2264b8d2ee5eb968
2021-08-02 17:59:39 +00:00
jenkins-bot
56a2c16e48 Merge "Add missing spaces to imploded debug strings" 2021-07-28 13:44:04 +00:00
Matěj Suchánek
d71ff53639 Add missing spaces to imploded debug strings
Change-Id: I32d921aaa3a5799777ff62b35608cbedcfff907d
2021-07-28 11:07:17 +02:00
libraryupgrader
5357695270 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs now pass and were enabled:
  * Generic.ControlStructures.InlineControlStructure
  * MediaWiki.PHPUnit.AssertCount.NotUsed

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)

Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
2021-07-22 03:36:05 +00:00
James D. Forrester
9fe4138f3d Follow-up I68198bc3: Hard-deprecate getMasterDB() methods
Also switch one use that we missed in the rebase.

Bug: T254646
Depends-On: I632610dec1aa6bb59af5423e6f86164fc791aadd
Change-Id: I9873c889f943fcbd7d867d534a7857f20ef0c5dc
2021-07-15 09:12:17 +01:00
James D. Forrester
597376e12c Replace getMasterDB methods with getPrimaryDB
Bug: T254646
Change-Id: I68198bc39b174ea1920b4acc2617cb6c6ce406e9
2021-07-14 16:21:04 -07:00
DannyS712
b45ddb2ab3 Use WikiPage::doUserEditContent() instead of ::doEditContent()
Results in passing a user where previously the fallback
to $wgUser was being used, mostly in tests.

Bug: T255507
Change-Id: Iabe24315b23c0ad1272353186425e71974528d23
2021-06-28 00:11:30 -07:00
Lucas Werkmeister
a8c775f112 JobQueueGroup: Fix method name in deprecation notice
Bug: T277648
Change-Id: I4d9375fc439d9f76a451024437755166fab4246b
2021-06-23 10:43:44 +00:00
Thiemo Kreuz
2ba01c7ee7 Remove some more comments that literally repeat the code
… including PHPDoc tags like `@return <type> $variableName`.
A return value doesn't have a variable name. I can see that
some people do this intentionally, repeating the variable
name that was used in the final `return $var;` at the end
of a method. This can indeed be helpful. I leave a lot of
these untouched and removed them only when it's obviously
wrong, or does not provide any additional information in
addition to what the code already says.

Change-Id: Ia18cd9f25ef658b08ad25b97a744897e2a8deffc
2021-06-18 21:23:56 +00:00
Petr Pchelko
a747229116 Remove Title param typehints from jobs
Change-Id: I8d8407d704eac97d4b0574369e315e28e23a89a8
2021-06-07 09:52:46 -07:00
James D. Forrester
f2f9345e39 Replace uses of DB_MASTER with DB_PRIMARY in documentation and local variables
This is just a start.

Bug: T254646
Change-Id: I9213aad4660e27afe7ff9e5d2e730cbf03911068
2021-05-14 12:40:34 -07:00
jenkins-bot
5f59120fa1 Merge "Deferred updates: remove Title from method signatures." 2021-05-12 03:50:58 +00:00
daniel
0dec104bc0 Deferred updates: remove Title from method signatures.
This allows deferred update tasks to be constructed with a PageIdentity
rather than a Title instance.

Bug: T278459
Change-Id: Ifa2888fdef9ecc97f5bf09ae0b3fa7be48a0e9ef
2021-05-11 11:17:02 +02:00
jenkins-bot
b2480a7efe Merge "Add a JobQueueGroupFactory service" 2021-05-10 18:59:51 +00:00
mainframe98
ae55be3000 Add a JobQueueGroupFactory service
This replaces JobQueueGroup::singleton and ::destroySingletons.
A JobQueueGroup service has been added to serve as convenience
getter.

Bug: T277648
Change-Id: Ic8709119773ab788a07531193dc65d418536eda2
2021-05-07 06:50:29 +00:00
daniel
398cc53333 LinksUpdate: don't throw if page does not exist
LinksUpdate may encounter a non-existing page due to race conditions,
when the page has been deleted or renamed before the update is executed
or even created. We should log such incidents to detect anomalities,
but we should not crash hard.

Similarly, RefreshLinksJob should not attempt to run on a page that
no longer exists.

Bug: T281802
Change-Id: Ic73c3e339ff0478710bd57a9f707c1284dcce2d9
2021-05-04 14:51:14 +02:00
James D. Forrester
df5eb22f83 Replace uses of DB_MASTER with DB_PRIMARY
Just an auto-replace from codesniffer for now.

Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
2021-04-29 09:24:31 -07:00
Tim Starling
fd01c53778 Stop using legacy ActorMigration field "rc_user"
Bug: T278917
Change-Id: I4d6c175c637a2cb26c63e0b2b27d5ea8ce6b1e0d
2021-04-28 16:29:04 +10:00
Reedy
4c2d7e87b8 JobQueueDB: Remove unused getReplicaDB() call
Change-Id: I9e33fee718281a63d0271ad8b898ee893b10b7c2
2021-04-21 14:43:17 +01:00
Reedy
fb771021ea Use some more neutral language
Bug: T277987
Change-Id: Ieceb01f7a61693a0f03cc331213cb8f93163b8e9
2021-04-18 16:49:36 +01:00
DannyS712
a2d3a0f599 Hard deprecate JobQueue::getWiki
Deprecated since 1.33 and unused

Change-Id: I1ee72782facc0c0e432128bd9abf5bbb90f59a4b
2021-04-08 17:15:52 +00:00
Sébastien Beyou
dec13460ea Implement JobQueueDB::getAllAbandonedJobs
Bug: T276945
Change-Id: I918356733409dd69ac438b0311ad7120d0b37d40
2021-04-05 21:53:22 +02:00
Timo Tijhof
f7cda6b414 changes: Move unlock to cover DELETE query for activeusers in RC jobs
Follows-up bf8c90538d.

The RecentChangesUpdateJob class has two modes of operation, one for
purging RC rows, and one for updating activeusers.

The former did its delete query within the lock, the latter did not.
We think this is the reason the latter sometimes causes a deadlock.
Move it within the lock to attempt to mitigate this.

Bug: T255059
Change-Id: Idc076dca15f4ba2e0a3a8f89623cfbfc9c25b27e
2021-04-01 20:43:05 +01:00
Aaron Schulz
f83c5cc807 jobqueue: make JobQueue::factory() require the "idGenerator" option
Change-Id: I26b33eec2088466bd96c873caafd66b4146eb684
2021-03-25 18:55:44 +00:00