Page MenuHomePhabricator

Switch from dieUsage() to dieWithError() in Cargo
Closed, ResolvedPublic

Description

The MediaWiki functions dieUsage() and dieUsageMsg() are both called in Cargo's API classes, but they are both deprecated, in favor of the new function dieWithError(). Unfortunately, Cargo is trying to support a range of MediaWiki versions, so it can't simply switch to calling dieWithError() everywhere. Instead, there should be "if" statements, calling method_exists() to determine which one to call. It may make sense to add a utility function to CargoUtils.php for this, to avoid lots of code duplication.

Event Timeline

Change 410523 had a related patch set uploaded (by Rosalieper; owner: Rosalieper):
[mediawiki/extensions/Cargo@master] [WIP]Switch from dieUsage() to dieWithError() in Cargo

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

@Yaron_Koren , looking at @yashdeep97 comment on this task T187115, I found the same piece of code in CargoAutocompleteAPI.php:32. Does it mean this task is invalid as well?

@rosalieper - good catch! No, this task certainly isn't invalid - unless all those other calls to dieUsage() in Cargo have similar code around them. As for this code - I suppose the ideal solution would be to modify it to use the new helper function; although it would also work to just keep this code as it is and not change it.

Hello all I am new member and also interested to work on this project can someone help me out with this.

Change 410523 merged by jenkins-bot:
[mediawiki/extensions/Cargo@master] Switch from dieUsage() to dieWithError() in Cargo

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