Open main menu

Manual:$wgVersion


Other languages:
Deutsch • ‎English • ‎Nederlands • ‎Türkçe • ‎español • ‎français • ‎magyar • ‎polski • ‎português do Brasil • ‎русский • ‎العربية • ‎فارسی • ‎中文 • ‎日本語
General Settings: $wgVersion
MediaWiki version number.
Introduced in version:1.2.0
Removed in version:still in use
Allowed values:(string)
Default value:Current MediaWiki version - you shouldn't change this!

DetailsEdit

The current version of MediaWiki (e.g, "1.32.2"). You shouldn't need to set this option; it is used internally.

Example codeEdit

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 alsoEdit