4 * Provides access to MediaWiki's version without requiring MediaWiki (or anything else)
8 * @author Jeroen De Dauw < jeroendedauw@gmail.com >
10 class MediaWikiVersionFetcher
{
13 * Returns the MediaWiki version, in the format used by MediaWiki's wgVersion global.
16 * @throws RuntimeException
18 public function fetchVersion() {
19 $defaultSettings = file_get_contents( __DIR__
. '/DefaultSettings.php' );
22 preg_match( "/wgVersion = '([0-9a-zA-Z\.]+)';/", $defaultSettings, $matches );
24 if ( count( $matches ) !== 2 ) {
25 throw new RuntimeException( 'Could not extract the MediaWiki version from DefaultSettings.php' );