5bfac45c7d5feee22cbea21402789572864de689
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 * Get the MediaWiki version, extracted from the PHP source file where it is defined.
15 * @throws RuntimeException
17 public function fetchVersion() {
18 $code = file_get_contents( __DIR__
. '/Defines.php' );
21 preg_match( "/define\( 'MW_VERSION', '([0-9a-zA-Z\.\-]+)'/", $code, $matches );
23 if ( count( $matches ) !== 2 ) {
24 throw new RuntimeException( 'Could not extract the MediaWiki version from Defines.php' );