Page MenuHomePhabricator

Use buildComparison() instead of raw SQL
Closed, ResolvedPublic

Description

I think that the function Database::buildComparison() (added by me in change 829293) is very cool and should be used instead of raw SQL in more places where we build queries comparing multiple values. This task is to group all the patches for this. (It could be used for simple comparisons too, but in those cases it's more arguable whether it would be an improvement, so I'm not planning mass replacements.)

I replaced some common patterns in MediaWiki core already in these changes, which can serve as examples:

Helpful code search: https://codesearch-beta.wmcloud.org/deployed/?q=^[^\*\/]+\bOR\b&files=\.php$&excludeFiles=&repos= (this just searches for "OR" in uppercase as a separate word, so there are many false positives in these results – the list below is manually filtered)

Details

SubjectRepoBranchLines /-
mediawiki/coremaster 22 -30
mediawiki/extensions/PageAssessmentsmaster 11 -23
mediawiki/extensions/PageTriagemaster 18 -20
mediawiki/extensions/Echomaster 5 -4
mediawiki/extensions/GeoDatamaster 6 -10
mediawiki/extensions/CheckUsermaster 9 -20
mediawiki/extensions/Wikibasemaster 20 -35
mediawiki/coremaster 16 -8
mediawiki/coremaster 17 -20
mediawiki/extensions/GlobalUsagemaster 15 -15
mediawiki/coremaster 14 -14
mediawiki/coremaster 44 -44
mediawiki/coremaster 8 -4
mediawiki/coremaster 10 -20
mediawiki/coremaster 7 -28
mediawiki/coremaster 6 -8
mediawiki/coremaster 12 -14
mediawiki/coremaster 4 -3
mediawiki/coremaster 20 -15
Show related patches Customize query in gerrit

Event Timeline

Change 832641 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] Use buildComparison() instead of raw SQL in API list=backlinks and friends

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

Change 845766 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] Use buildComparison() instead of raw SQL in API prop=linkshere and friends

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

Change 845767 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] Use buildComparison() instead of raw SQL in API list=categorymembers

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

Change 845768 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] Use buildComparison() instead of raw SQL in API list=exturlusage, prop=extlinks

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

Change 845769 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] Use buildComparison() instead of raw SQL in API list=random

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

Change 845770 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] Use buildComparison() instead of raw SQL in API list=usercontribs

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

Change 832642 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] Use buildComparison() instead of raw SQL in REST API

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

Change 845773 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] Use buildComparison() instead of raw SQL in CategoryMembershipChangeJob

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

Change 845774 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] Use buildComparison() instead of raw SQL in WatchedItemQueryService

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

Change 845777 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] Use buildComparison() instead of raw SQL in RevisionStore

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

@matmarex are you going to be working on patches for extensions?

Yes, but I haven't written any yet, so feel free to help :D I'm not sure when I'll be working on that, it's not really a priority and I don't really want to have 30 patches waiting for review at the same time.

Change 832642 merged by jenkins-bot:

[mediawiki/core@master] Use buildComparison() instead of raw SQL in REST API

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

Change 845773 merged by jenkins-bot:

[mediawiki/core@master] Use buildComparison() instead of raw SQL in CategoryMembershipChangeJob

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

Change 832641 merged by jenkins-bot:

[mediawiki/core@master] Use buildComparison() instead of raw SQL in API list=backlinks and friends

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

Change 845766 merged by jenkins-bot:

[mediawiki/core@master] Use buildComparison() instead of raw SQL in API prop=linkshere and friends

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

Change 845767 merged by jenkins-bot:

[mediawiki/core@master] Use buildComparison() instead of raw SQL in API list=categorymembers

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

Change 845768 merged by jenkins-bot:

[mediawiki/core@master] Use buildComparison() instead of raw SQL in API list=exturlusage, prop=extlinks

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

Change 845769 merged by jenkins-bot:

[mediawiki/core@master] Use buildComparison() instead of raw SQL in API list=random

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

Change 845774 merged by jenkins-bot:

[mediawiki/core@master] Use buildComparison() instead of raw SQL in WatchedItemQueryService

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

Change 845777 merged by jenkins-bot:

[mediawiki/core@master] Use buildComparison() instead of raw SQL in RevisionStore

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

Change 852286 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/GlobalUsage@master] Use buildComparison() instead of raw SQL

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

Change 852286 merged by jenkins-bot:

[mediawiki/extensions/GlobalUsage@master] Use buildComparison() instead of raw SQL

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

Change 845770 merged by jenkins-bot:

[mediawiki/core@master] Use buildComparison() instead of raw SQL in API list=usercontribs

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

Change 852892 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/CheckUser@master] Use buildComparison() instead of raw SQL

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

Change 852896 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/PageTriage@master] Use buildComparison() instead of raw SQL

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

Change 853001 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] Use buildComparison() instead of raw SQL in SpecialWhatLinksHere

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

Change 853377 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Use database buildComparison() method

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

Change 853001 merged by jenkins-bot:

[mediawiki/core@master] Use buildComparison() instead of raw SQL in SpecialWhatLinksHere

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

Change 853377 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Use database buildComparison() method

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

Change 852892 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Use buildComparison() instead of raw SQL

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

Change 856935 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] Use buildComparison() instead of raw SQL in more maintenance scripts

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

Change 856936 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/Echo@master] Use buildComparison() instead of raw SQL

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

Change 856937 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/GeoData@master] Use buildComparison() instead of raw SQL

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

Change 856936 merged by jenkins-bot:

[mediawiki/extensions/Echo@master] Use buildComparison() instead of raw SQL

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

Change 856937 merged by jenkins-bot:

[mediawiki/extensions/GeoData@master] Use buildComparison() instead of raw SQL

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

Change 860968 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/PageAssessments@master] Use buildComparison() instead of raw SQL

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

Change 852896 merged by jenkins-bot:

[mediawiki/extensions/PageTriage@master] Use buildComparison() instead of raw SQL

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

Change 860968 merged by jenkins-bot:

[mediawiki/extensions/PageAssessments@master] Use buildComparison() instead of raw SQL

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

Change 856935 merged by jenkins-bot:

[mediawiki/core@master] Use buildComparison() instead of raw SQL in more maintenance scripts

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

matmarex updated the task description. (Show Details)