ArielGlenn has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311391

Change subject: use DB_REPLICA instead of deprecated DB_SLAVE
......................................................................

use DB_REPLICA instead of deprecated DB_SLAVE

Change-Id: I16ae082aeba0a5f40e913fec5e81157558954ab0
---
M includes/CentralAuthUser.php
M includes/CentralAuthUtils.php
M includes/GlobalRename/GlobalRenameRequest.php
M includes/GlobalRename/GlobalRenameUserStatus.php
M includes/LocalRenameJob/LocalRenameUserJob.php
M includes/specials/SpecialGlobalRenameQueue.php
M includes/specials/SpecialUsersWhoWillBeRenamed.php
M maintenance/checkLocalNames.php
M maintenance/checkLocalUser.php
M maintenance/fixStuckGlobalRename.php
M maintenance/migratePass0.php
M maintenance/migrateStewards.php
M maintenance/populateGlobalRenameLogSearch.php
13 files changed, 20 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth 
refs/changes/91/311391/1

diff --git a/includes/CentralAuthUser.php b/includes/CentralAuthUser.php
index 0f543ae..52b0426 100644
--- a/includes/CentralAuthUser.php
+++ b/includes/CentralAuthUser.php
@@ -2080,7 +2080,7 @@
        function importLocalNames() {
                $rows = [];
                foreach ( self::getWikiList() as $wikiID ) {
-                       $dbr = wfGetLB( $wikiID )->getConnectionRef( DB_SLAVE, 
array(), $wikiID );
+                       $dbr = wfGetLB( $wikiID )->getConnectionRef( 
DB_REPLICA, array(), $wikiID );
                        $id = $dbr->selectField(
                                "`$wikiID`.`user`",
                                'user_id',
@@ -2334,7 +2334,7 @@
         */
        protected function localUserData( $wikiID ) {
                $lb = wfGetLB( $wikiID );
-               $db = $lb->getConnection( DB_SLAVE, array(), $wikiID );
+               $db = $lb->getConnection( DB_REPLICA, array(), $wikiID );
                $fields = array(
                                'user_id',
                                'user_email',
diff --git a/includes/CentralAuthUtils.php b/includes/CentralAuthUtils.php
index 48b31a6..7ca4b49 100644
--- a/includes/CentralAuthUtils.php
+++ b/includes/CentralAuthUtils.php
@@ -62,7 +62,7 @@
                global $wgCentralAuthDatabase;
 
                return wfGetLB( $wgCentralAuthDatabase )->getConnection(
-                       DB_SLAVE, 'centralauth', $wgCentralAuthDatabase );
+                       DB_REPLICA, 'centralauth', $wgCentralAuthDatabase );
        }
 
        /**
diff --git a/includes/GlobalRename/GlobalRenameRequest.php 
b/includes/GlobalRename/GlobalRenameRequest.php
index e096984..155dea4 100644
--- a/includes/GlobalRename/GlobalRenameRequest.php
+++ b/includes/GlobalRename/GlobalRenameRequest.php
@@ -321,7 +321,7 @@
         * @return stdClass|bool Row as object or false if not found
         */
        protected static function fetchRowFromDB( array $where ) {
-               return self::getDB( DB_SLAVE )->selectRow(
+               return self::getDB( DB_REPLICA )->selectRow(
                        'renameuser_queue',
                        array(
                                'id'        => 'rq_id',
@@ -368,7 +368,7 @@
        /**
         * Get a DatabaseBase object for the CentralAuth db
         *
-        * @param int $type DB_SLAVE or DB_MASTER
+        * @param int $type DB_REPLICA or DB_MASTER
         * @return DatabaseBase
         */
        protected static function getDB( $type ) {
@@ -386,7 +386,7 @@
         * @return bool
         */
        public static function nameHasPendingRequest( $newname ) {
-               $dbw = self::getDB( DB_SLAVE );
+               $dbw = self::getDB( DB_REPLICA );
                $res = $dbw->selectField(
                        'renameuser_queue',
                        'rq_id',
diff --git a/includes/GlobalRename/GlobalRenameUserStatus.php 
b/includes/GlobalRename/GlobalRenameUserStatus.php
index fc8ec42..13d953a 100644
--- a/includes/GlobalRename/GlobalRenameUserStatus.php
+++ b/includes/GlobalRename/GlobalRenameUserStatus.php
@@ -28,11 +28,11 @@
        /**
         * Get a DatabaseBase object for the CentralAuth db
         *
-        * @param int $type DB_SLAVE or DB_MASTER
+        * @param int $type DB_REPLICA or DB_MASTER
         *
         * @return DatabaseBase
         */
-       protected function getDB( $type = DB_SLAVE ) {
+       protected function getDB( $type = DB_REPLICA ) {
                if ( $type === DB_MASTER ) {
                        return CentralAuthUtils::getCentralDB();
                } else {
@@ -67,7 +67,7 @@
         * @return array (oldname, newname)
         */
        public function getNames( $wiki = null, $useMaster = null ) {
-               $db = $this->getDB( $useMaster === 'master' ? DB_MASTER : 
DB_SLAVE );
+               $db = $this->getDB( $useMaster === 'master' ? DB_MASTER : 
DB_REPLICA );
 
                $where = array( $this->getNameWhereClause( $db ) );
 
diff --git a/includes/LocalRenameJob/LocalRenameUserJob.php 
b/includes/LocalRenameJob/LocalRenameUserJob.php
index 2877815..e6eb991 100644
--- a/includes/LocalRenameJob/LocalRenameUserJob.php
+++ b/includes/LocalRenameJob/LocalRenameUserJob.php
@@ -116,7 +116,7 @@
 
                $fromTitle = $oldUser->getUserPage();
                $toTitle = Title::makeTitleSafe( NS_USER, $to );
-               $dbr = wfGetDB( DB_SLAVE );
+               $dbr = wfGetDB( DB_REPLICA );
 
                $rows = $dbr->select(
                        'page',
diff --git a/includes/specials/SpecialGlobalRenameQueue.php 
b/includes/specials/SpecialGlobalRenameQueue.php
index 53b4314..54f367f 100644
--- a/includes/specials/SpecialGlobalRenameQueue.php
+++ b/includes/specials/SpecialGlobalRenameQueue.php
@@ -629,7 +629,7 @@
         */
        protected function getRemoteUserMailAddress( $wiki, $username ) {
                $lb = wfGetLB( $wiki );
-               $remoteDB = $lb->getConnection( DB_SLAVE, array(), $wiki );
+               $remoteDB = $lb->getConnection( DB_REPLICA, array(), $wiki );
                $row = $remoteDB->selectRow(
                        'user',
                        array( 'user_email', 'user_name', 'user_real_name' ),
@@ -777,7 +777,7 @@
                                // User requested closed status - either 
approved or rejected
                                $conds['rq_status'] = $status;
                        } else {
-                               $dbr = wfGetDB( DB_SLAVE );
+                               $dbr = wfGetDB( DB_REPLICA );
                                // All closed requests
                                $conds[] = 'rq_status <> ' . $dbr->addQuotes( 
GlobalRenameRequest::PENDING );
                        }
diff --git a/includes/specials/SpecialUsersWhoWillBeRenamed.php 
b/includes/specials/SpecialUsersWhoWillBeRenamed.php
index e1a206f..efc18d3 100644
--- a/includes/specials/SpecialUsersWhoWillBeRenamed.php
+++ b/includes/specials/SpecialUsersWhoWillBeRenamed.php
@@ -66,7 +66,7 @@
                        return;
                }
 
-               $dbr = wfGetDB( DB_SLAVE );
+               $dbr = wfGetDB( DB_REPLICA );
                $res = $dbr->select(
                        array( 'user', 'ipblocks' ),
                        User::selectFields(),
diff --git a/maintenance/checkLocalNames.php b/maintenance/checkLocalNames.php
index 8a16443..ffa8881 100644
--- a/maintenance/checkLocalNames.php
+++ b/maintenance/checkLocalNames.php
@@ -66,7 +66,7 @@
 
                // iterate through the wikis
                foreach( $wikis as $wiki ) {
-                       $localdb = wfGetDB( DB_SLAVE , array(), $wiki );
+                       $localdb = wfGetDB( DB_REPLICA , array(), $wiki );
                        $lastUsername = "";
 
                        $this->output( "Checking localnames for $wiki ...\n" );
diff --git a/maintenance/checkLocalUser.php b/maintenance/checkLocalUser.php
index bf43a44..f583e4d 100644
--- a/maintenance/checkLocalUser.php
+++ b/maintenance/checkLocalUser.php
@@ -78,7 +78,7 @@
                                continue;
                        }
 
-                       $localdb = wfGetDB( DB_SLAVE , array(), $wiki );
+                       $localdb = wfGetDB( DB_REPLICA , array(), $wiki );
 
                        // batch query local users from the wiki; iterate 
through and verify each one
                        foreach ( $this->getUsers( $wiki ) as $username ) {
diff --git a/maintenance/fixStuckGlobalRename.php 
b/maintenance/fixStuckGlobalRename.php
index 89ad9f4..b4ddeb6 100644
--- a/maintenance/fixStuckGlobalRename.php
+++ b/maintenance/fixStuckGlobalRename.php
@@ -32,7 +32,7 @@
                        $this->error( "{$ca->getName()} does not have a rename 
in progress on this wiki.", 1 );
                }
 
-               $dbr = wfGetDB( DB_SLAVE, [], $this->getOption( 'logwiki' ) );
+               $dbr = wfGetDB( DB_REPLICA, [], $this->getOption( 'logwiki' ) );
                $queryData = DatabaseLogEntry::getSelectQueryData();
                $row = $dbr->selectRow(
                        $queryData['tables'],
diff --git a/maintenance/migratePass0.php b/maintenance/migratePass0.php
index 2928197..7682e89 100644
--- a/maintenance/migratePass0.php
+++ b/maintenance/migratePass0.php
@@ -15,7 +15,7 @@
  */
 function migratePassZero() {
        global $wgDBname;
-       $dbr = wfGetDB( DB_SLAVE );
+       $dbr = wfGetDB( DB_REPLICA );
        $chunkSize = 1000;
 
        $start = microtime( true );
@@ -73,7 +73,7 @@
  * @return int
  */
 function countEdits( $userId, $table, $field ) {
-       $dbr = wfGetDB( DB_SLAVE );
+       $dbr = wfGetDB( DB_REPLICA );
        $count = $dbr->selectField( $table, 'COUNT(*)',
                array( $field => $userId ),
                __METHOD__ );
diff --git a/maintenance/migrateStewards.php b/maintenance/migrateStewards.php
index 89d303b..547ca16 100644
--- a/maintenance/migrateStewards.php
+++ b/maintenance/migrateStewards.php
@@ -9,7 +9,7 @@
 echo "Populating global groups table with stewards...\n";
 
 // Fetch local stewards
-$dbl = wfGetDB( DB_SLAVE );    // Get local database
+$dbl = wfGetDB( DB_REPLICA );  // Get local database
 $result = $dbl->select(
        array( 'user', 'user_groups' ),
        array( 'user_name' ),
diff --git a/maintenance/populateGlobalRenameLogSearch.php 
b/maintenance/populateGlobalRenameLogSearch.php
index bbd44fd..d447074 100644
--- a/maintenance/populateGlobalRenameLogSearch.php
+++ b/maintenance/populateGlobalRenameLogSearch.php
@@ -16,7 +16,7 @@
        }
 
        public function execute() {
-               $dbr = wfGetDB( DB_SLAVE );
+               $dbr = wfGetDB( DB_REPLICA );
                $rows = $dbr->select(
                        array( 'logging', 'log_search' ),
                        array( 'log_id', 'log_params' ),

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I16ae082aeba0a5f40e913fec5e81157558954ab0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: ArielGlenn <ar...@wikimedia.org>

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

Reply via email to