Page MenuHomePhabricator

Migrate Database::select usages to SelectQueryBuilder (in WMF-deployed extensions)
Open, Needs TriagePublic

Description

After T243051: A query builder for MediaWiki core being done, we should use it which would improve readability of the code, avoids mistakes by passing the wrong order of arguments, etc. and would pave the way for further improvements such as T210206.

Note: It's not just select(). selectField(), selectFieldValues(), selectRow(), estimateRowCount(), and selectRowCount() also need to phased out.

Details

SubjectRepoBranchLines +/-
mediawiki/coremaster+26 -19
mediawiki/coremaster+131 -68
mediawiki/coremaster+13 -0
mediawiki/coremaster+100 -138
mediawiki/coremaster+376 -398
mediawiki/coremaster+243 -293
mediawiki/coremaster+251 -269
mediawiki/coremaster+101 -33
mediawiki/coremaster+449 -459
mediawiki/coremaster+66 -43
mediawiki/coremaster+53 -64
mediawiki/coremaster+41 -52
mediawiki/coremaster+379 -354
mediawiki/coremaster+65 -77
mediawiki/coremaster+76 -63
mediawiki/coremaster+46 -52
mediawiki/coremaster+28 -38
mediawiki/coremaster+12 -10
mediawiki/coremaster+7 -0
mediawiki/coremaster+105 -136
mediawiki/coremaster+115 -75
mediawiki/coremaster+30 -19
mediawiki/coremaster+14 -16
mediawiki/coremaster+8 -8
mediawiki/coremaster+11 -17
mediawiki/coremaster+14 -8
mediawiki/coremaster+16 -20
mediawiki/coremaster+57 -84
mediawiki/coremaster+81 -64
mediawiki/coremaster+6 -8
mediawiki/coremaster+42 -61
mediawiki/coremaster+17 -21
mediawiki/coremaster+36 -40
mediawiki/coremaster+2 -1
mediawiki/coremaster+33 -52
mediawiki/coremaster+10 -10
mediawiki/coremaster+33 -28
mediawiki/coremaster+5 -6
mediawiki/coremaster+21 -19
mediawiki/coremaster+12 -11
mediawiki/coremaster+46 -36
mediawiki/coremaster+236 -269
mediawiki/coremaster+67 -49
mediawiki/coremaster+11 -10
mediawiki/coremaster+12 -11
mediawiki/coremaster+12 -27
mediawiki/coremaster+62 -57
mediawiki/coremaster+84 -76
mediawiki/coremaster+18 -0
mediawiki/coremaster+11 -15
mediawiki/coremaster+9 -9
Show related patches Customize query in gerrit

Related Objects

StatusSubtypeAssignedTask
OpenNone
InvalidNone
Resolvedsguebo_WMF
OpenNone
OpenNone
ResolvedUmherirrender
InvalidNone
ResolvedKrinkle
OpenUmherirrender
OpenDreamy_Jazz
OpenNone
InvalidNone
InvalidNone
OpenNone
InvalidNone
InvalidNone
InvalidNone
ResolvedWangombe
OpenNone
OpenNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
ResolvedUmherirrender
ResolvedUmherirrender
Resolvedmatmarex
InvalidNone
InvalidNone
ResolvedUmherirrender
InvalidNone
DeclinedNone
InvalidNone
ResolvedAtieno
InvalidNone
InvalidNone
ResolvedHasanAkgun_WMDE
InvalidNone
ResolvedLadsgroup
InvalidNone
ResolvedLucas_Werkmeister_WMDE
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
OpenNone
InvalidNone
ResolvedDreamy_Jazz
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
Resolvedori
OpenNone
Resolvedhoo
OpenUmherirrender
InvalidNone
DuplicateNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
OpenBluDoge
OpenNone
OpenUmherirrender
InvalidNone
InvalidNone
InvalidNone
OpenZabe
OpenNone
InvalidNone
InvalidNone
InvalidNone
ResolvedZabe
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
ResolvedUmherirrender
ResolvedUmherirrender
InvalidNone
InvalidNone
InvalidNone
InvalidNone
ResolvedLadsgroup
InvalidNone
InvalidNone
OpenNone
Resolvedtaavi
OpenNone
Resolved EJoseph
OpenNone
ResolvedUmherirrender
OpenNone
OpenNone
Resolved TThoabala
InvalidNone
InvalidNone
InvalidNone
OpenNone
InvalidNone
InvalidNone
InvalidNone
ResolvedSbailey
InvalidNone
InvalidNone
InvalidNone
InvalidNone
DeclinedNone
ResolvedSD0001
InvalidNone
ResolvedUmherirrender
InvalidNone
InvalidNone
ResolvedBluDoge
InvalidNone
OpenNone
InvalidNone
OpenNone
DuplicateNone
ResolvedUmherirrender
InvalidNone
InvalidNone
OpenNone
OpenNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
ResolvedLucas_Werkmeister_WMDE
InvalidNone
InvalidNone
ResolvedUmherirrender
Resolvedmatmarex
ResolvedTheDJ
InvalidNone
ResolvedUmherirrender
InvalidNone
InvalidNone
Resolvedmatmarex
InvalidNone
InvalidNone
InvalidNone
OpenNone
InvalidNone
InvalidNone
ResolvedDreamy_Jazz
ResolvedTchanders
Resolved TThoabala
Resolved TThoabala
ResolvedScardenasmolinar
ResolvedNone
ResolvedAtieno
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
InvalidNone
OpenNone
InvalidNone
InvalidNone
InvalidNone
OpenNone
InvalidNone
InvalidNone
OpenUmherirrender
OpenNone
InvalidNone
InvalidNone
InvalidNone
ResolvedLucas_Werkmeister_WMDE
DuplicateNone
OpenLadsgroup

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change 908840 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] jobs: Migrate Database::select usages to SelectQueryBuilder

https://gerrit.wikimedia.org/r/908840

Change 908840 merged by jenkins-bot:

[mediawiki/core@master] jobs: Migrate Database::select usages to SelectQueryBuilder

https://gerrit.wikimedia.org/r/908840

Change 912416 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] SiteStats: Database related clean ups:

https://gerrit.wikimedia.org/r/912416

Change 919882 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] user: Clean up database-related code in UserNamePrefixSearch

https://gerrit.wikimedia.org/r/919882

Change 919882 merged by jenkins-bot:

[mediawiki/core@master] user: Clean up database-related code in UserNamePrefixSearch

https://gerrit.wikimedia.org/r/919882

Change 926535 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] specials: Migrate a couple more Database::select* calls to SelectQueryBuilder

https://gerrit.wikimedia.org/r/926535

Change 926535 merged by jenkins-bot:

[mediawiki/core@master] specials: Migrate a couple more Database::select* calls to SelectQueryBuilder

https://gerrit.wikimedia.org/r/926535

Change 932689 had a related patch set uploaded (by Tim Starling; author: Tim Starling):

[mediawiki/core@master] Add User::newQueryBuilder()

https://gerrit.wikimedia.org/r/932689

Change 932787 had a related patch set uploaded (by Tim Starling; author: Tim Starling):

[mediawiki/core@master] Add CommentStore::newQueryBuilder

https://gerrit.wikimedia.org/r/932787

Change 933207 had a related patch set uploaded (by Tim Starling; author: Tim Starling):

[mediawiki/core@master] Migrate assertSelect() to SelectQueryBuilder

https://gerrit.wikimedia.org/r/933207

Change 932787 abandoned by Tim Starling:

[mediawiki/core@master] Add CommentStore::newQueryBuilder

Reason:

It's not really valid to have a QueryBuilder with a join but no tables -- join() would throw if you tried to make this without using queryInfo()

https://gerrit.wikimedia.org/r/932787

Change 932689 merged by jenkins-bot:

[mediawiki/core@master] Add User::newQueryBuilder()

https://gerrit.wikimedia.org/r/932689

Change 933207 merged by jenkins-bot:

[mediawiki/core@master] Migrate assertSelect() to SelectQueryBuilder

https://gerrit.wikimedia.org/r/933207

Change 912416 abandoned by Ladsgroup:

[mediawiki/core@master] SiteStats: Database related clean ups

Reason:

I'll do it from the ground up

https://gerrit.wikimedia.org/r/912416

Change 938257 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] Title: Switch Database::select calls to SelectQueryBuilder

https://gerrit.wikimedia.org/r/938257

Change 938260 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] tests: Migrate Database::select usages to SelectQueryBuilder

https://gerrit.wikimedia.org/r/938260

Change 938257 merged by jenkins-bot:

[mediawiki/core@master] Title: Switch Database::select calls to SelectQueryBuilder

https://gerrit.wikimedia.org/r/938257

Change 938260 merged by jenkins-bot:

[mediawiki/core@master] tests: Migrate Database::select usages to SelectQueryBuilder

https://gerrit.wikimedia.org/r/938260

Change 939371 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] tests: Switch to SelectQueryBuilder in Sqlite and PG integration tests

https://gerrit.wikimedia.org/r/939371

Change 939385 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] maintenance: Switch simple calls of Database::select to SQB

https://gerrit.wikimedia.org/r/939385

Change 939385 merged by jenkins-bot:

[mediawiki/core@master] maintenance: Switch simple calls of Database::select to SQB

https://gerrit.wikimedia.org/r/939385

Change 939371 merged by jenkins-bot:

[mediawiki/core@master] tests: Switch to SelectQueryBuilder in Sqlite and PG integration tests

https://gerrit.wikimedia.org/r/939371

Change 941404 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] Migrate more calls of Database::select* to SelectQueryBuilder

https://gerrit.wikimedia.org/r/941404

Change 941404 merged by jenkins-bot:

[mediawiki/core@master] Migrate more calls of Database::select* to SelectQueryBuilder

https://gerrit.wikimedia.org/r/941404

Change 944261 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] Migrate last batch of simple Database::select* calls to SQB

https://gerrit.wikimedia.org/r/944261

Change 944261 merged by jenkins-bot:

[mediawiki/core@master] Migrate last batch of simple Database::select* calls to SQB

https://gerrit.wikimedia.org/r/944261

Change 944317 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] [WIP] Introduce FileSelectQueryBuilder

https://gerrit.wikimedia.org/r/944317

Change 944317 merged by jenkins-bot:

[mediawiki/core@master] Introduce FileSelectQueryBuilder

https://gerrit.wikimedia.org/r/944317

We now have around 600 calls to select query builder in core. And only 200-ish left. The ones left are rather complex. e.g. some build the query array and then pass it to a hook runner. RevisionStore and some other classes have a decent chunks of calls to select because of ::getSlotsQueryInfo() and similar. In some cases it makes sense to make a new function that return a query builder object, in some cases it makes sense to create a sub-class of SQB (e.g. what we did for User and File). But the 200 cases left are going to take a while to migrate.

Change 952166 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] Migrate several more Database::select calls to SQB

https://gerrit.wikimedia.org/r/952166

Change 952166 merged by jenkins-bot:

[mediawiki/core@master] Migrate several more Database::select calls to SQB

https://gerrit.wikimedia.org/r/952166

Change 810856 abandoned by Ladsgroup:

[mediawiki/core@master] rdbms: Soft-deprecate IDatabase::select() and similar methods

Reason:

These methods are now @internal making this patch moot

https://gerrit.wikimedia.org/r/810856

Change 851080 abandoned by Ladsgroup:

[mediawiki/core@master] RevisionStore: Add support for transforming SelectQueryBuilder

Reason:

We actually built RevisionSQB making this patch moot

https://gerrit.wikimedia.org/r/851080

Change 982813 had a related patch set uploaded (by D3r1ck01; author: Derick Alangi):

[mediawiki/core@master] language: Migrate Database::select() to SQB

https://gerrit.wikimedia.org/r/982813

Krinkle renamed this task from Migrate Database::select usages to SelectQueryBuilder to Migrate Database::select usages to SelectQueryBuilder (in WMF-deployed extensions).Mar 5 2024, 7:37 PM