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