Manuale:$wgVersion

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Manual:$wgVersion and the translation is 20% complete.

Other languages:
Deutsch • ‎English • ‎Nederlands • ‎Türkçe • ‎español • ‎français • ‎italiano • ‎magyar • ‎polski • ‎português • ‎português do Brasil • ‎русский • ‎العربية • ‎فارسی • ‎中文 • ‎日本語
General Settings: $wgVersion
MediaWiki version number.
Introdotto nella versione:1.2.0
Rimosso nella versione:still in use
Valori concessi:(string)
Valore predefinito:Current MediaWiki version - you shouldn't change this!
Impostazioni: Alfabetiche | Per funzione

Dettagli

The current version of MediaWiki (e.g, "1.32.1"). You shouldn't need to set this option; it is used internally.

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:

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

Vedi anche