Template:$wgVersion/en: Difference between revisions
[[mw:]]>FuzzyBot (Updating to match new version of source page) |
ManfredoDo (talk | contribs) m (1 revision imported: Workaround and Utility Templates) |
(No difference)
|
Latest revision as of 17:53, 12 November 2022
<translate>
This deprecated feature should no longer be used, but is still available for reasons of backwards compatibility. This feature was deprecated in version <tvar |
<translate> General Settings</translate>: $wgVersion | |
---|---|
MediaWiki version number. |
|
<translate> Introduced in version:</translate> | 1.2.0 |
<translate> Deprecated in version:</translate> | 1.35.0 (Gerrit change 481950; git #a5d5ea82) |
<translate> Removed in version:</translate> | <translate> still in use</translate> |
<translate> Allowed values:</translate> | (string) |
<translate> Default value:</translate> | Current MediaWiki version - you shouldn't change this! |
<translate> Other settings:</translate> <translate> Alphabetical</translate> | <translate> By function</translate> |
Details
The current version of MediaWiki (e.g, "1.38.4"). You shouldn't need to set this option; it is used internally.
MW_VERSION
Template:MW 1.35
Starting with MediaWiki 1.35, $wgVersion
is deprecated, and replaced with the MW_VERSION
constant.
It is also available in MediaWiki 1.31.7, 1.33.3 and 1.34.1, though this should not be relied on as its presence is required for some release tools.
$wgVersion
will continue to function the same as before in those versions.
Example code
If you're implementing a new feature that only works in MediaWiki 1.19 or later, but you want to maintain backwards compatibility, you could use a test such as the following:
$oldVersion = version_compare( $wgVersion, '1.18', '<=' );
if ( $oldVersion ) {
# Do stuff for MediaWiki 1.18 and older
} else {
# Do stuff for MediaWiki 1.19 and newer
}
However, it is typically recommended that you use feature detection to see whether the method or class you wish to use is available instead of depending upon raw version strings.
See also
- Special:Version – view the version number of a MediaWiki installation (plus much more information) from the web interface.
- Manual:Upgrading
- Version