Manual:$wgVersion

This page is a translated version of the page Manual:$wgVersion and the translation is 71% complete.
Outdated translations are marked like this.
Configurações gerais: $wgVersion
Número da versão do MediaWiki.
Introduzido na versão:1.2.0
Depreciado na versão:1.35.0 (Gerrit change 481950; git #a5d5ea82)
Removido na versão:ainda em uso
Valores permitidos:(string)
Valor padrão:Versão atual do MediaWiki - você não deve mudar isso!

Detalhes

A versão atual do MediaWiki (p.ex., "1.41.1"). Você não precisa configurar essa opção, que é utilizada internamente.

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

Exemplo de código

Se você está implementando um novo recurso que só funciona no MediaWiki 1.19 ou posterior, mas você quer manter a compatibilidade, você poderia usar um teste como o seguinte:

$oldVersion = version_compare( $wgVersion, '1.18', '<=' );
if ( $oldVersion ) {
    # Funciona no MediaWiki 1.18 ou mais antigo
} else {
    # Funciona no MediaWiki 1.19 ou mais recente
}

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