Page MenuHomePhabricator

Remove MWOAuth prefix from classes and PHP files in the OAuth extension
Closed, ResolvedPublic

Description

Most class files in MediaWiki OAuth extension are prefixed with MWOAuth prefix.

For example in the APISetup class, the file is named MWOAuthAPISetup.php. Now that MWOAuth prefix is no longer needed, the file needs to be renamed to APISetup.php.

This task is about hunting through the extension's files and removing all the occurrences of the prefix.

Extension repository: https://gerrit.wikimedia.org/g/mediawiki/extensions/OAuth
Learn more about Git, Gerrit and how to submit a patch: https://www.mediawiki.org/wiki/Gerrit/Tutorial

Event Timeline

Tgr added a subscriber: Tgr.

The prefix is super annoying to remember when using an IDE with good type-ahead / search.

Maybe this could be a GCI task for an ambitious student? With a decent IDE, it should not be an unreasonable amount of work.

Maybe this could be a GCI task for an ambitious student? With a decent IDE, it should not be an unreasonable amount of work.

Indeed. There's 10 ish days left, I'm pretty sure we could get someone to have a good go at this

@Ammarpad I was so free to assign myself as well, so we can co-mentor this :]

@Ammarpad: Please don't remove tags of a project when this task was actually part of that project - thanks!

srishakatux renamed this task from Remove MWOAuth prefix from classes and PHP files to Remove MWOAuth prefix from classes and PHP files in the OAuth extension.Feb 12 2020, 9:21 PM
srishakatux updated the task description. (Show Details)

@Ammarpad, @Zoranzoki21 Does this task also cover class names with the MWOAuth prefix. (Or is just about renaming the files and fixing the extension.json)

@Ammarpad, @Zoranzoki21 Does this task also cover class names with the MWOAuth prefix. (Or is just about renaming the files and fixing the extension.json)

Yes. If you don't update them in extension.json too, things will break

Okay, MWOAuthException is conflicting at src/Entity/ClientEntity.php with the builtin Exception class of PHP. Also, MWOAuthLogFormatter can't be un-prefixed as the class it's extending get's the same name as itself LogFormatter extends LogFormatter which is not possible in PHP... Is there any workarounds, different prefixes I should use or should I just ignore those two classes?

Okay, MWOAuthException is conflicting at src/Entity/ClientEntity.php with the builtin Exception class of PHP. Also, MWOAuthLogFormatter can't be un-prefixed as the class it's extending get's the same name as itself LogFormatter extends LogFormatter which is not possible in PHP... Is there any workarounds, different prefixes I should use or should I just ignore those two classes?

Well, the real solution is to namespace the classes, so there isn't that conflict. Which is the parent of this task, T242646

For the log formatter he can just remove the MW- prefix and leave the extension name 'OAuthLogFormatter.php'. That's the standard naming pattern of custom log formatters

Change 580323 had a related patch set uploaded (by Sohom Datta; owner: Sohom Datta):
[mediawiki/extensions/OAuth@master] Removed the MWOAuth prefix from file and class names

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

Change 580323 abandoned by Reedy:
[mediawiki/extensions/OAuth@master] Removed the MWOAuth prefix from file and class names

Reason:

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

Reedy removed Soda as the assignee of this task.
Reedy added a subscriber: Soda.

This has mostly been done at some point...

The exceptions are stuff in src/Backend, but as they're MW specific subclasses of OAuth classes, they seem fair enough to be kept as is