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