Update wfGetDB calls in Maintenance scripts to use getDB()
[lhc/web/wiklou.git] / maintenance / initEditCount.php
index 3135b4c..dee5db8 100644 (file)
@@ -22,7 +22,7 @@
  * @ingroup Maintenance
  */
 
-require_once( __DIR__ . '/Maintenance.php' );
+require_once __DIR__ . '/Maintenance.php';
 
 class InitEditCount extends Maintenance {
        public function __construct() {
@@ -39,7 +39,7 @@ in the load balancer, usually indicating a replication environment.' );
        }
 
        public function execute() {
-               $dbw = wfGetDB( DB_MASTER );
+               $dbw = $this->getDB( DB_MASTER );
                $user = $dbw->tableName( 'user' );
                $revision = $dbw->tableName( 'revision' );
 
@@ -47,7 +47,7 @@ in the load balancer, usually indicating a replication environment.' );
 
                // Autodetect mode...
                $backgroundMode = wfGetLB()->getServerCount() > 1 ||
-                       ( $dbw instanceof DatabaseMysql && version_compare( $dbver, '4.1' ) < 0 );
+                       ( $dbw instanceof DatabaseMysql );
 
                if ( $this->hasOption( 'background' ) ) {
                        $backgroundMode = true;
@@ -58,7 +58,7 @@ in the load balancer, usually indicating a replication environment.' );
                if ( $backgroundMode ) {
                        $this->output( "Using replication-friendly background mode...\n" );
 
-                       $dbr = wfGetDB( DB_SLAVE );
+                       $dbr = $this->getDB( DB_SLAVE );
                        $chunkSize = 100;
                        $lastUser = $dbr->selectField( 'user', 'MAX(user_id)', '', __METHOD__ );
 
@@ -107,4 +107,4 @@ in the load balancer, usually indicating a replication environment.' );
 }
 
 $maintClass = "InitEditCount";
-require_once( RUN_MAINTENANCE_IF_MAIN );
+require_once RUN_MAINTENANCE_IF_MAIN;