Manual:$wgVersion

From mediawiki.org
This page is a translated version of the page Manual:$wgVersion and the translation is 71% complete.
Outdated translations are marked like this.
General Settings: $wgVersion
Número de versión de MediaWiki.
Introducido en la versión:1.2.0
Deprecated in version:1.35.0 (Gerrit change 481950; git #a5d5ea82)
Eliminado en la versión:aún se usa
Valores permitidos:(cadena)
Valor predeterminado:Versión actual de MediaWiki - ¡no deberías cambiar esto!

Detalles

La versión actual de MediaWiki (por ejemplo, "1.41.0"). No deberías necesitar cambiar esta opción. Se usa internamente.

MW_VERSION

Versión de 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.

Código de ejemplo

Si está implementando una nueva característica que sólo funciona en MediaWiki 1.19 o posterior, pero quieres mantener la compatibilidad hacia atrás, se puede probar lo siguiente:

$oldVersion = version_compare( $wgVersion, '1.18', '<=' );
if ( $oldVersion ) {
    # Hacer cosas para MediaWiki 1.18 y anteriores
} else {
    # Hacer cosas para MediaWiki 1.19 y posteriores
}

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.

Véase también