Jump to content
MediaWiki

Podręcznik:$wgVersion

From mediawiki.org
This page is a translated version of the page Manual:$wgVersion and the translation is 58% complete.
Deprecated: Ta funkcja jest przestarzała i nie powinna być już dłużej używana, ale jest nadal dostępna ze względu na kompatybilność wsteczną.
General Settings: $wgVersion
Numer wersji MediaWiki.
Wprowadzono w wersji:1.2.0
Przestarzałe w wersji:1.35.0 (Gerrit change 481950; git #a5d5ea82)
Usunięto w wersji:nadal w użyciu
Dozwolone wartości:(łańcuch)
Domyślna wartość:Bieżąca wersja MediaWiki. Nie powinieneś zmieniać tej wartości!
Inne ustawienia: Alfabetycznie | Według funkcji

Szczegóły

Bieżąca wersja MediaWiki (np. "1.44.2"). Nie powinieneś ustawiać tej opcji; jest ona używana wewnętrznie.

MW_VERSION

Wersja MediaWiki:
≥ 1.35

Począwszy od wersji MediaWiki 1.35, zmienna $wgVersion została uznana za przestarzałą i została zastąpiona stałą MW_VERSION. It is also available in MediaWiki 1.31.7, 1.33.3 and 1.34.1, as its presence is required for some release tools, though this should not be relied on. $wgVersion will continue to function the same as before in those versions.

Przykładowy kod

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:

global $wgVersion;
$oldVersion = version_compare( $wgVersion, '1.18', '<=' );
if ( $oldVersion ) {
 # Do stuff for MediaWiki 1.18 and older
} else {
 # Do stuff for MediaWiki 1.19+
}
Wersja MediaWiki:
≥ 1.35
$oldVersion = version_compare( MW_VERSION, '1.39', '<' );
if ( $oldVersion ) {
 # Do stuff for MediaWiki 1.35 - 1.38
} else {
 # Do stuff for MediaWiki 1.39+
}

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.

Zobacz też

AltStyle によって変換されたページ (->オリジナル) /