dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Provide MW_VERSION and soft-deprecate global $wgVersion
[lhc/web/wiklou.git]
/
includes
/
MediaWikiVersionFetcher.php
diff --git
a/includes/MediaWikiVersionFetcher.php
b/includes/MediaWikiVersionFetcher.php
index
943bc9f
..
5bfac45
100644
(file)
--- a/
includes/MediaWikiVersionFetcher.php
+++ b/
includes/MediaWikiVersionFetcher.php
@@
-9,19
+9,19
@@
class MediaWikiVersionFetcher {
/**
class MediaWikiVersionFetcher {
/**
- *
Returns the MediaWiki version, in the format used by MediaWiki's wgVersion global
.
+ *
Get the MediaWiki version, extracted from the PHP source file where it is defined
.
*
* @return string
* @throws RuntimeException
*/
public function fetchVersion() {
*
* @return string
* @throws RuntimeException
*/
public function fetchVersion() {
- $
defaultSettings = file_get_contents( __DIR__ . '/DefaultSetting
s.php' );
+ $
code = file_get_contents( __DIR__ . '/Define
s.php' );
- $matches =
array()
;
- preg_match( "/
wgVersion = '([0-9a-zA-Z\.\-]+)';/", $defaultSettings
, $matches );
+ $matches =
[]
;
+ preg_match( "/
define\( 'MW_VERSION', '([0-9a-zA-Z\.\-]+)'/", $code
, $matches );
if ( count( $matches ) !== 2 ) {
if ( count( $matches ) !== 2 ) {
- throw new RuntimeException( 'Could not extract the MediaWiki version from Def
aultSetting
s.php' );
+ throw new RuntimeException( 'Could not extract the MediaWiki version from Def
ine
s.php' );
}
return $matches[1];
}
return $matches[1];