MediaWiki  REL1_24
MediaWikiVersionFetcher.php
Go to the documentation of this file.
00001 <?php
00002 
00010 class MediaWikiVersionFetcher {
00011 
00018     public function fetchVersion() {
00019         $defaultSettings = file_get_contents( __DIR__ . '/DefaultSettings.php' );
00020 
00021         $matches = array();
00022         preg_match( "/wgVersion = '([0-9a-zA-Z\.]+)';/", $defaultSettings, $matches );
00023 
00024         if ( count( $matches ) !== 2 ) {
00025             throw new RuntimeException( 'Could not extract the MediaWiki version from DefaultSettings.php' );
00026         }
00027 
00028         return $matches[1];
00029     }
00030 
00031 }