There are various use cases for core and non-URL-shortening-related extensions to show links which can take advantage of URL shortening. There should be a core service to support that, where you can pass in an URL (or maybe a Title object and an array of query parameters) and get back another URL which resolves to the same address but if possible is shorter.### Problem statement
The default behavior could be to just return the URL unchanged,re are various use cases in core and extensions not directly related to URL-shortening. Cases where one want to show urls to users that should take advantage of URL shortening. or maybe to use curid instead of page name (that changes the semantics though as page name and page id are not inseparably linked together);There should be a core service to support this transformation, the non-default behavior could be implemented in UrlShortenwhere you can pass in an URL (or maybe a Title object and an array of query parameters) and get back another URL which resolves to the same address but if possible is shorter.
### Proposal
The default behavior in MediaWiki core could be to just return the URL unchanged, or maybe to use `curid` instead of `title` page name (that changes the semantics though as page name and page id are not inseparably linked together).
The non-default behavior could be implemented by an extension like UrlShortener.
One complication is that shortening an URL that wasn't shortened before requires a DB write, which should be avoided on GET requests.
See also:
* `File::getDescriptionShortUrl()`