Manual:$wgVersion/pt
Deprecated: This feature is deprecated and should no longer be used, however it is possibly still available for reasons of backwards compatibility. |
| Configurações gerais: $wgVersion | |
|---|---|
| MediaWiki version number. |
|
| Introduzido na versão: | 1.2.0 |
| Preterido na versão: | 1.35.0 (Gerrit change 481950; git #a5d5ea82) |
| Removido na versão: | Ainda em utilização |
| Valores permitidos: | (string) |
| Valor predefinido: | Current MediaWiki version - you shouldn't change this! |
| Outras definições: Alfabeticamente | Por função | |
Details
The current version of MediaWiki (e.g, "1.45.3"). You shouldn't need to set this option; it is used internally.
MW_VERSION
| Versão MediaWiki: | ≥ 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, 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.
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:
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+
}
| Versão 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.
Ver também
- Special:Version – View the version number of a MediaWiki installation (plus much more information) from the web interface.
- Manual: Atualização
- Version