Handbuch:$wgVersion

This page is a translated version of the page Manual:$wgVersion and the translation is 44% complete.
Other languages:
Deutsch • ‎English • ‎Nederlands • ‎Türkçe • ‎español • ‎français • ‎magyar • ‎polski • ‎português do Brasil • ‎русский • ‎中文 • ‎日本語 • ‎한국어
Allgemeine Einstellungen: $wgVersion
MediaWiki-Versionsnummer.
Eingeführt in Version:1.2.0
Deprecated in version:1.35.0 (Gerrit change 481950; git #a5d5ea82)
Entfernt in Version:weiterhin vorhanden
Erlaubte Werte:(Zeichenkette)
Standardwert:Current MediaWiki version - you shouldn't change this!

Details

Definiert die aktuelle Version von MediaWiki (z. B. "1.34.1"). Sie brauchen diese Variable nicht zu bearbeiten, sie wird automatisch gesetzt.

MW_VERSION

MediaWiki Version: 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.

Beispiel 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.

Siehe auch