Background
Anywhere MediaWiki accepts an expiry (such as when blocking users, protecting pages, or watching pages), we accept multiple values for infinity: infinite, indefinite, infinity and never. This used to be tested against in each Core component until that was refactored into wfIsInfinity() in 2015 (T68646). Then during the development of Expiring-Watchlist-Items, the Core ExpiryDef class was created which contains the ExpiryDef::INFINITY_VALS constant (T248508). Finally, mw.util.isInfinity() was recently added to the JS interface (T353389).
Usage of these values varies greatly across codebases.
Proposal
Settle on one value and deprecate the others. We appear to only store infinity in the database, so that seems like the one to use. We could however name the constant ExpiryDef::INDEFINITE, because that's usually what we display to users, and infinite, infinity and never misleadingly imply permanence when this is not necessarily true (you can always lift pgae protection or unblock a user, etc.).
The deprecation process could entail:
- Adding the new ExpiryDef::INDEFINITE constant
- Probably add a JavaScript constant too, i.e. mw.INDEFINITE (?)
- Emit a deprecation warning in the action API when a deprecated infinity value is used
- Add deprecation warning to wfIsInfinity() that ExpiryDef::INDEFINITE should be used instead, and similar for mw.util.isInfinity()
- Fix all interface messages and their on-wiki overrides to use the new value
- Update Special:Block, Special:UserRights, action=protect and any other relevant pages to show user-facing errors when deprecated values are used (I think the existing error "Expiry time invalid" is not specific enough)
- Give communities plenty of time to update gadgets, scripts, etc.
- Remove all traces of the old values and the isInfinity() methods.
Relevant links: