Commit graph

11 commits

Author SHA1 Message Date
Amir Sarabadani
7432b21816 Migrate more calls of Database::select* to SelectQueryBuilder
Using a php parser written on top of ANTLR4, done semi-automatically.

I checked everything and made adjustments.

Bug: T311866
Change-Id: I6150c6909bce8f3dbd745a26380cc0af9d9c547f
2023-07-26 13:01:28 +02:00
Amir Sarabadani
b55c501fe0 Migrate Database::update() to UpdateQueryBuilder
I did this using a script written on top of antlr4 parser so it doesn't
have some clean ups a human would do but it's pretty nice already.

Bug: T330640
Change-Id: I608566700c6d737ee986bf47dda87effc69614d6
2023-06-08 12:34:20 +02:00
Amir Sarabadani
e3e329f686 user: Switch Database::delete to DeleteQueryBuilder
Change-Id: I9a3f9bae80560c56197606a46ba29ad85a5a1844
2023-04-30 00:33:24 +02:00
Tim Starling
0077c5da15 Use short array destructuring instead of list()
Introduced in PHP 7.1. Because it's shorter and looks nice.

I used regex replacement.

Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
2022-10-21 15:33:37 +11:00
Aryeh Gregor
7b791474a5 Use MainConfigNames instead of string literals, #4
Now largely automated:

VARS=$(grep -o "'[A-Za-z0-9_]*'" includes/MainConfigNames.php | \
  tr "\n" '|' | sed "s/|$/\n/;s/'//g")
sed -i -E "s/'($VARS)'/MainConfigNames::\1/g" \
  $(grep -ERIl "'($VARS)'" includes/)

Then git add -p with lots of error-prone manual checking. Then
semi-manually add all the necessary "use" lines:

vim $(grep -L 'use MediaWiki\\MainConfigNames;' \
  $(git diff --cached --name-only --diff-filter=M HEAD^))

I didn't bother fixing lines that were over 100 characters unless they
were over 120 and triggered phpcs.

Bug: T305805
Change-Id: I74e0ab511abecb276717ad4276a124760a268147
2022-04-26 19:03:37 +03:00
Thiemo Kreuz
b4c63c64ae Remove some more comments that literally repeat the code
Nothing to learn from these.

You can find a longer explanation in the comments in I93751e6.

Change-Id: I195aae70fc282b58be5b18160783f27d38605d15
2021-12-09 19:01:36 +01:00
Thiemo Kreuz
62d45967c0 Replace some more isset() with shorter ?? syntax
Change-Id: Ie119167bc2584f047e29174f95c39b65f99a64a6
2021-11-02 10:39:38 +01: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
DannyS712
b1cd3ad252 BotPasswordStore: accept UserIdentity objects
Now that CentralIdLookup doesn't require full User objects

Bug: T265769
Follow-up: I67bf4f2442269b8aa1002868ede9a71a5ca43a84
Change-Id: I953333116f6cd6dc095914929914a970cc190292
2021-07-21 18:50:25 +00:00
DannyS712
de051140d8 Move BotPassword lookup methods to BotPasswordStore
I was considering adding a separate service for the creation/fetching
of BotPassword instances (probably BotPasswordLookup or
BotPasswordFactory) but since it would need to access the same
bot password database that BotPasswordStore uses, it would either
need to duplicate the logic, or have a store injected, which would
reduce the benefits of having separate services.

The following methods were moved:
* newFromUser (also renamed to getByUser)
* newFromCentralId (also renamed to getByCentralId)
* newUnsaved

Additionally, BotPassword::__construct() is made public, though
marked as @internal

Bug: T265769
Change-Id: I2a5f46a8fbdf3867517eeb006d886b943fa85af1
2021-07-18 00:53:48 +00:00
DannyS712
abf5f78f65 Add BotPasswordStore service
Does not (yet) handle looking up bot passwords
in the database, just inserting/updating/removing
them.

Bug: T265769
Change-Id: I20e3aaee63ec182483489681282dae52fe41ec90
2021-07-14 21:45:55 +00:00