Manual talk:$wgVersion
Latest comment: 11 years ago by Varlin
Hi, is there any way to get the current Mediawiki version through a PHP function, before $wgVersion that comes with MW 1.20 ? --Varlin (talk) 00:03, 30 December 2012 (UTC)
- I think you didn't look at the page closely enough. It says that this configuration variable was introduced in MediaWiki 1.2.0, which is ancient history (it was released in March 2004; see Wikipedia's "MediaWiki version history" article for more info); 1.20 is the most recent stable version, and obviously 20 > 2. --Jack Phoenix (Contact) 00:54, 30 December 2012 (UTC)
- Oops... Ok, but in this case, <?php echo $wgVersion ?> should do the job, shouldn't it ? When I test it it displays nothing. --Varlin (talk) 01:02, 30 December 2012 (UTC)
- It is a global variable, you need to declare it as such.
<?php global $wgVersion; echo $wgVersion; ?>
should work in most normal cases (though really, you shouldn't be usingecho
outside skin files) — by normal I mean if you're working inside MediaWiki (such as writing an extension or hacking core or somesuch). If you want a third-party application to get the version number, then you most likely need to include$IP/includes/DefaultSettings.php
in your application, then global $wgVersion and finally output it, but I'm not sure if that would work, including core MediaWiki files in third-party apps is somewhat convoluted. --Jack Phoenix (Contact) 01:05, 30 December 2012 (UTC)
- It is a global variable, you need to declare it as such.
- Perfect, it works ! It is precisely in a skin file that I was trying to make the version number appear. Thanks. I'll try to remember to declare my variable before asking for help...--Varlin (talk) 16:42, 30 December 2012 (UTC)