Manual:$wgVersion

From MediaWiki.org
Jump to: navigation, search

Other languages:
العربية • ‎català • ‎Deutsch • ‎English • ‎español • ‎فارسی • ‎suomi • ‎français • ‎italiano • ‎日本語 • ‎Nederlands • ‎polski • ‎português • ‎português do Brasil • ‎русский • ‎Türkçe
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!
Other settings: Alphabetical | By function

Details[edit]

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

Example code[edit]

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[edit]