Page MenuHomePhabricator

Research to create service for BotPassword class
Open, Needs TriagePublic

Description

Many static function in class BotPassword using services

Event Timeline

I have seen the usage on Special:BotPasswords and was creating this task, but AuthManager also using that class

Change 635599 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Cleanup BotPassword class to prepare for refactor

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

Plan:
BotPasswordStore service:
Handle DB
BotPassword::save -> BotPasswordStore::insertBotPassword and ::updateBotPassword
BotPassword::delete -> BotPasswordStore::deleteBotPassword

BotPassword::invalidateAllPasswordsForUser - BotPasswordStore::invalidateAllPasswordsForUser
BotPassword::invalidateAllPasswordsForCentralId -> merged with above method, no other users

BotPassword::removeAllPasswordsForUser -> BotPasswordStore::removeAllPasswordsForUser
BotPassword::removeAllPasswordsForCentralId -> merged with above method, no other users

That handles part of the class, the rest TBD

Nit: there is no point in repeating the class name name in the verbs, IMO. It's a bot password store, of course it's going to insert bot passwords. Just call it insert / update / invalidateAllForUser etc.

Nit: there is no point in repeating the class name name in the verbs, IMO. It's a bot password store, of course it's going to insert bot passwords. Just call it insert / update / invalidateAllForUser etc.

I find it helps with tracking uses if generic method names like 'insert' and 'update' are avoided - I'll use invalidateAllForUser, but would prefer insertPassword or insertBotPassword

I don't have a strong opinion on it but I'm not sure it's a good idea to build our naming conventions around plaintext search. A decent IDE can list usages of a specific method.

Change 635599 merged by jenkins-bot:
[mediawiki/core@master] Cleanup BotPassword class to prepare for refactor

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

Change 637663 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Add BotPasswordStore service

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

Change 637663 merged by jenkins-bot:

[mediawiki/core@master] Add BotPasswordStore service

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

Change 704620 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/core@master] Deprecate unused BotPassword methods

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

Change 704620 merged by jenkins-bot:

[mediawiki/core@master] Deprecate unused BotPassword methods

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

Change 704813 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/core@master] Move BotPassword lookup methods to BotPasswordStore

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

Change 704813 merged by jenkins-bot:

[mediawiki/core@master] Move BotPassword lookup methods to BotPasswordStore

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

Change 705987 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/core@master] BotPasswordStore: accept UserIdentity objects

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

Change 705987 merged by jenkins-bot:

[mediawiki/core@master] BotPasswordStore: accept UserIdentity objects

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

Change 708422 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/core@master] Inject and use BotPasswordStore

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

Change 710104 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/core@master] AuthManager: inject more services

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

Change 710104 merged by jenkins-bot:

[mediawiki/core@master] AuthManager: inject more services

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