jenkins-bot has submitted this change and it was merged.

Change subject: Remove checks formerly for MySQL server version
......................................................................


Remove checks formerly for MySQL server version

Removed these checks instead of fixing them, for the stated reasons:

* initEditCount.php: "instanceof DatabaseMysql" is not a correct way to
  check if the database server is MySQL/MariaDB, because DatabaseMysql is
  now a subclass of DatabaseMysqlBase, only used as a wrapper around the
  deprecated mysql PHP extension (not the newer mysqli extension). The
  check was intended for pre-4.1 versions of MySQL, which do not support
  subqueries.

  The effect of this change is to use single-query mode whenever there is
  only one configured database server, even when using the mysqli PHP
  extension, which would have been the original intent.

* fixBug20757.php: If the database server is not MySQL/MariaDB, the
  $lowerLeft variable would remain undefined. The script was only intended
  for use with MySQL, so the check was only necessary in order to support
  pre-4.1 versions of MySQL, which require different SQL.

Follows-up b74f88967bf090af.

Change-Id: I7f32aed4473e5ea39dc40449ddc0af5f9a10df16
---
M maintenance/initEditCount.php
M maintenance/storage/fixBug20757.php
2 files changed, 5 insertions(+), 10 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/maintenance/initEditCount.php b/maintenance/initEditCount.php
index c219b9b..50a4018 100644
--- a/maintenance/initEditCount.php
+++ b/maintenance/initEditCount.php
@@ -32,8 +32,7 @@
                avoids locking tables or lagging slaves with large updates;
                calculates counts on a slave if possible.
 
-Background mode will be automatically used if the server is MySQL 4.0
-(which does not support subqueries) or if multiple servers are listed
+Background mode will be automatically used if multiple servers are listed
 in the load balancer, usually indicating a replication environment.' );
                $this->addDescription( 'Batch-recalculate user_editcount fields 
from the revision table' );
        }
@@ -46,13 +45,12 @@
                $dbver = $dbw->getServerVersion();
 
                // Autodetect mode...
-               $backgroundMode = wfGetLB()->getServerCount() > 1 ||
-                       ( $dbw instanceof DatabaseMysql );
-
                if ( $this->hasOption( 'background' ) ) {
                        $backgroundMode = true;
                } elseif ( $this->hasOption( 'quick' ) ) {
                        $backgroundMode = false;
+               } else {
+                       $backgroundMode = wfGetLB()->getServerCount() > 1;
                }
 
                if ( $backgroundMode ) {
@@ -96,7 +94,6 @@
                                wfWaitForSlaves();
                        }
                } else {
-                       // Subselect should work on modern MySQLs etc
                        $this->output( "Using single-query mode...\n" );
                        $sql = "UPDATE $user SET user_editcount=(SELECT 
COUNT(*) FROM $revision WHERE rev_user=user_id)";
                        $dbw->query( $sql );
diff --git a/maintenance/storage/fixBug20757.php 
b/maintenance/storage/fixBug20757.php
index 0ea52ca..94335cf 100644
--- a/maintenance/storage/fixBug20757.php
+++ b/maintenance/storage/fixBug20757.php
@@ -57,10 +57,8 @@
 
                $totalRevs = $dbr->selectField( 'text', 'MAX(old_id)', false, 
__METHOD__ );
 
-               if ( $dbr->getType() == 'mysql' ) {
-                       // In MySQL 4.1+, the binary field old_text has a 
non-working LOWER() function
-                       $lowerLeft = 'LOWER(CONVERT(LEFT(old_text,22) USING 
latin1))';
-               }
+               // In MySQL 4.1+, the binary field old_text has a non-working 
LOWER() function
+               $lowerLeft = 'LOWER(CONVERT(LEFT(old_text,22) USING latin1))';
 
                while ( true ) {
                        print "ID: $startId / $totalRevs\r";

-- 
To view, visit https://gerrit.wikimedia.org/r/290204
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7f32aed4473e5ea39dc40449ddc0af5f9a10df16
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand <pleasest...@live.com>
Gerrit-Reviewer: 01tonythomas <01tonytho...@gmail.com>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Parent5446 <tylerro...@gmail.com>
Gerrit-Reviewer: PleaseStand <pleasest...@live.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to