From a1789ddde42033f1b05cc4929491214ee6e79383 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 17 Dec 2015 09:15:42 +0100 Subject: Update to MediaWiki 1.26.0 --- includes/registration/CoreVersionChecker.php | 68 ++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 includes/registration/CoreVersionChecker.php (limited to 'includes/registration/CoreVersionChecker.php') diff --git a/includes/registration/CoreVersionChecker.php b/includes/registration/CoreVersionChecker.php new file mode 100644 index 00000000..f64d826d --- /dev/null +++ b/includes/registration/CoreVersionChecker.php @@ -0,0 +1,68 @@ +versionParser = new VersionParser(); + try { + $this->coreVersion = new Constraint( + '==', + $this->versionParser->normalize( $coreVersion ) + ); + } catch ( UnexpectedValueException $e ) { + // Non-parsable version, don't fatal. + } + } + + /** + * Check that the provided constraint is compatible with the current version of core + * + * @param string $constraint Something like ">= 1.26" + * @return bool + */ + public function check( $constraint ) { + if ( $this->coreVersion === false ) { + // Couldn't parse the core version, so we can't check anything + return true; + } + + return $this->versionParser->parseConstraints( $constraint ) + ->matches( $this->coreVersion ); + } +} -- cgit v1.2.3-54-g00ecf