Merge "rdbms: re-add DB domain sanity checks to LoadBalancer" into REL1_31
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 11 Mar 2020 16:53:14 +0000 (16:53 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 11 Mar 2020 16:53:14 +0000 (16:53 +0000)
RELEASE-NOTES-1.31
extensions/OATHAuth
includes/DefaultSettings.php
includes/Defines.php
includes/MediaWikiVersionFetcher.php
includes/PHPVersionCheck.php
maintenance/checkComposerLockUpToDate.php
maintenance/recountCategories.php
maintenance/view.php
tests/phpunit/includes/MediaWikiVersionFetcherTest.php

index ebdf5a7..94ff633 100644 (file)
@@ -4,6 +4,8 @@ THIS IS NOT A RELEASE YET
 
 === Changes since MediaWiki 1.31.6 ===
 
+* (T212738) Add the MW_VERSION constant, global $wgVersion is soft deprecated.
+
 == MediaWiki 1.31.6 ==
 
 This is a security and maintenance release of the MediaWiki 1.31 branch.
index cf9f8c1..44c0834 160000 (submodule)
@@ -1 +1 @@
-Subproject commit cf9f8c126b5213b77fb4dc7b7f49d775c8189119
+Subproject commit 44c0834dc396345de7e159d2d745d169b8344c84
index 29e3366..eebd616 100644 (file)
@@ -70,8 +70,9 @@ $wgConfigRegistry = [
 /**
  * MediaWiki version number
  * @since 1.2
+ * @deprecated since 1.35; use the MW_VERSION constant instead
  */
-$wgVersion = '1.31.6';
+$wgVersion = MW_VERSION;
 
 /**
  * Name of the site. It must be changed in LocalSettings.php
index 087af39..b4140c3 100644 (file)
@@ -30,6 +30,15 @@ use Wikimedia\Rdbms\IDatabase;
  * @defgroup Constants MediaWiki constants
  */
 
+/**
+ * The running version of MediaWiki.
+ *
+ * This replaces the the $wgVersion global found in earlier versions.
+ *
+ * @since 1.35
+ */
+define( 'MW_VERSION', '1.31.6' );
+
 # Obsolete aliases
 /**
  * @deprecated since 1.28
index 913ae9a..5bfac45 100644 (file)
@@ -9,19 +9,19 @@
 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() {
-               $defaultSettings = file_get_contents( __DIR__ . '/DefaultSettings.php' );
+               $code = file_get_contents( __DIR__ . '/Defines.php' );
 
                $matches = [];
-               preg_match( "/wgVersion = '([0-9a-zA-Z\.\-]+)';/", $defaultSettings, $matches );
+               preg_match( "/define\( 'MW_VERSION', '([0-9a-zA-Z\.\-]+)'/", $code, $matches );
 
                if ( count( $matches ) !== 2 ) {
-                       throw new RuntimeException( 'Could not extract the MediaWiki version from DefaultSettings.php' );
+                       throw new RuntimeException( 'Could not extract the MediaWiki version from Defines.php' );
                }
 
                return $matches[1];
index 609b75b..1a639c7 100644 (file)
@@ -93,7 +93,7 @@ class PHPVersionCheck {
                        'implementation' => 'PHP',
                        'version' => PHP_VERSION,
                        'vendor' => 'the PHP Group',
-                       'upstreamSupported' => '5.6.0',
+                       'upstreamSupported' => '7.2.0',
                        'minSupported' => '7.0.13',
                        'upgradeURL' => 'https://secure.php.net/downloads.php',
                );
index 69f16f5..96c7fb3 100644 (file)
@@ -2,6 +2,8 @@
 
 require_once __DIR__ . '/Maintenance.php';
 
+use Composer\Semver\Semver;
+
 /**
  * Checks whether your composer-installed dependencies are up to date
  *
@@ -38,7 +40,7 @@ class CheckComposerLockUpToDate extends Maintenance {
                $installed = $lock->getInstalledDependencies();
                foreach ( $json->getRequiredDependencies() as $name => $version ) {
                        if ( isset( $installed[$name] ) ) {
-                               if ( $installed[$name]['version'] !== $version ) {
+                               if ( !SemVer::satisfies( $installed[$name]['version'], $version ) ) {
                                        $this->output(
                                                "$name: {$installed[$name]['version']} installed, $version required.\n"
                                        );
index 7e8f063..838405a 100644 (file)
@@ -98,7 +98,7 @@ TEXT
 
        protected function doWork() {
                $this->output( "Finding up to {$this->getBatchSize()} drifted rows " .
-                       "starting at cat_id {$this->getBatchSize()}...\n" );
+                       "greater than cat_id {$this->minimumId}...\n" );
 
                $countingConds = [ 'cl_to = cat_title' ];
                if ( $this->mode === 'subcats' ) {
index 952b825..b75fe5b 100644 (file)
@@ -39,6 +39,10 @@ class ViewCLI extends Maintenance {
                $title = Title::newFromText( $this->getArg() );
                if ( !$title ) {
                        $this->fatalError( "Invalid title" );
+               } elseif ( $title->isSpecialPage() ) {
+                       $this->fatalError( "Special Pages not supported" );
+               } elseif ( !$title->exists() ) {
+                       $this->fatalError( "Page does not exist" );
                }
 
                $page = WikiPage::factory( $title );
index 87a7dff..839f6ac 100644 (file)
@@ -16,7 +16,7 @@ class MediaWikiVersionFetcherTest extends PHPUnit\Framework\TestCase {
 
        public function testReturnsResult() {
                $versionFetcher = new MediaWikiVersionFetcher();
-               $this->assertInternalType( 'string', $versionFetcher->fetchVersion() );
+               $this->assertSame( MW_VERSION, $versionFetcher->fetchVersion() );
        }
 
 }