[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Replace remaining uses of deprecated DB_SLAVE with DB_REPLICA

2017-08-05 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/370242 )

Change subject: Replace remaining uses of deprecated DB_SLAVE with DB_REPLICA
..


Replace remaining uses of deprecated DB_SLAVE with DB_REPLICA

Change 950cf6016c10953213e5f985dfc18a32d8673197 took care of the most,
but a few remain, either outside of includes/ and maintenance/
directories (which that change was limited to), or in code introduced
afterwards.

Change-Id: I9c363d0219ea7e71cde520faba39406949a36d27
---
M docs/database.txt
M includes/specials/SpecialUncategorizedcategories.php
M languages/Language.php
M profileinfo.php
M tests/phpunit/MediaWikiTestCase.php
M tests/phpunit/includes/RevisionStorageTest.php
M tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php
M tests/phpunit/includes/WatchedItemStoreUnitTest.php
M tests/phpunit/includes/db/LBFactoryTest.php
M tests/phpunit/includes/page/WikiPageTest.php
10 files changed, 19 insertions(+), 19 deletions(-)

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



diff --git a/docs/database.txt b/docs/database.txt
index 44ec764..dbc9204 100644
--- a/docs/database.txt
+++ b/docs/database.txt
@@ -17,7 +17,7 @@
 
 To make a read query, something like this usually suffices:
 
-$dbr = wfGetDB( DB_SLAVE );
+$dbr = wfGetDB( DB_REPLICA );
 $res = $dbr->select( /* ...see docs... */ );
 foreach ( $res as $row ) {
...
diff --git a/includes/specials/SpecialUncategorizedcategories.php 
b/includes/specials/SpecialUncategorizedcategories.php
index 77b6926..5ff9e04 100644
--- a/includes/specials/SpecialUncategorizedcategories.php
+++ b/includes/specials/SpecialUncategorizedcategories.php
@@ -68,7 +68,7 @@
}
 
public function getQueryInfo() {
-   $dbr = wfGetDB( DB_SLAVE );
+   $dbr = wfGetDB( DB_REPLICA );
$query = parent::getQueryInfo();
$exceptionList = $this->getExceptionList();
if ( $exceptionList ) {
diff --git a/languages/Language.php b/languages/Language.php
index 12f26c3..941f4b8 100644
--- a/languages/Language.php
+++ b/languages/Language.php
@@ -4537,7 +4537,7 @@
public function formatExpiry( $expiry, $format = true, $infinity = 
'infinity' ) {
static $dbInfinity;
if ( $dbInfinity === null ) {
-   $dbInfinity = wfGetDB( DB_SLAVE )->getInfinity();
+   $dbInfinity = wfGetDB( DB_REPLICA )->getInfinity();
}
 
if ( $expiry == '' || $expiry === 'infinity' || $expiry == 
$dbInfinity ) {
diff --git a/profileinfo.php b/profileinfo.php
index 466f26a..83ae193 100644
--- a/profileinfo.php
+++ b/profileinfo.php
@@ -150,7 +150,7 @@
exit( 1 );
 }
 
-$dbr = wfGetDB( DB_SLAVE );
+$dbr = wfGetDB( DB_REPLICA );
 
 if ( !$dbr->tableExists( 'profiling' ) ) {
echo 'No profiling table exists, so we can\'t show you 
anything.'
diff --git a/tests/phpunit/MediaWikiTestCase.php 
b/tests/phpunit/MediaWikiTestCase.php
index 215d292..4afe710 100644
--- a/tests/phpunit/MediaWikiTestCase.php
+++ b/tests/phpunit/MediaWikiTestCase.php
@@ -1490,7 +1490,7 @@
' method should return true. Use @group 
Database or $this->tablesUsed.' );
}
 
-   $db = wfGetDB( DB_SLAVE );
+   $db = wfGetDB( DB_REPLICA );
 
$res = $db->select( $table, $fields, $condition, wfGetCaller(), 
[ 'ORDER BY' => $fields ] );
$this->assertNotEmpty( $res, "query failed: " . 
$db->lastError() );
diff --git a/tests/phpunit/includes/RevisionStorageTest.php 
b/tests/phpunit/includes/RevisionStorageTest.php
index 642ada2..3ba82a6 100644
--- a/tests/phpunit/includes/RevisionStorageTest.php
+++ b/tests/phpunit/includes/RevisionStorageTest.php
@@ -145,7 +145,7 @@
public function testConstructFromRow() {
$orig = $this->makeRevision();
 
-   $dbr = wfGetDB( DB_SLAVE );
+   $dbr = wfGetDB( DB_REPLICA );
$res = $dbr->select( 'revision', '*', [ 'rev_id' => 
$orig->getId() ] );
$this->assertTrue( is_object( $res ), 'query failed' );
 
@@ -163,7 +163,7 @@
public function testNewFromRow() {
$orig = $this->makeRevision();
 
-   $dbr = wfGetDB( DB_SLAVE );
+   $dbr = wfGetDB( DB_REPLICA );
$res = $dbr->select( 'revision', '*', [ 'rev_id' => 
$orig->getId() ] );
$this->assertTrue( is_object( $res ), 'query failed' );
 
@@ -187,7 +187,7 @@
$orig = $page->getRevision();
$page->doDeleteArticle( 'test Revision::newFromArchiveRow' );
 
-   $dbr = wfGetDB( DB_SLAVE );
+   $dbr = wfGetDB( DB_REPLICA );
$res = $dbr->select( 'archive', '*', [ 'ar_rev_id' => 
$orig->getId() ] );

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Replace remaining uses of deprecated DB_SLAVE with DB_REPLICA

2017-08-04 Thread Code Review
Bartosz DziewoƄski has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/370242 )

Change subject: Replace remaining uses of deprecated DB_SLAVE with DB_REPLICA
..

Replace remaining uses of deprecated DB_SLAVE with DB_REPLICA

Change 950cf6016c10953213e5f985dfc18a32d8673197 took care of the most,
but a few remain, either outside of includes/ and maintenance/
directories (which that change was limited to), or in code introduced
afterwards.

Change-Id: I9c363d0219ea7e71cde520faba39406949a36d27
---
M docs/database.txt
M includes/specials/SpecialUncategorizedcategories.php
M languages/Language.php
M profileinfo.php
M tests/phpunit/MediaWikiTestCase.php
M tests/phpunit/includes/RevisionStorageTest.php
M tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php
M tests/phpunit/includes/WatchedItemStoreUnitTest.php
M tests/phpunit/includes/db/LBFactoryTest.php
M tests/phpunit/includes/page/WikiPageTest.php
10 files changed, 19 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/42/370242/1

diff --git a/docs/database.txt b/docs/database.txt
index 44ec764..dbc9204 100644
--- a/docs/database.txt
+++ b/docs/database.txt
@@ -17,7 +17,7 @@
 
 To make a read query, something like this usually suffices:
 
-$dbr = wfGetDB( DB_SLAVE );
+$dbr = wfGetDB( DB_REPLICA );
 $res = $dbr->select( /* ...see docs... */ );
 foreach ( $res as $row ) {
...
diff --git a/includes/specials/SpecialUncategorizedcategories.php 
b/includes/specials/SpecialUncategorizedcategories.php
index 77b6926..5ff9e04 100644
--- a/includes/specials/SpecialUncategorizedcategories.php
+++ b/includes/specials/SpecialUncategorizedcategories.php
@@ -68,7 +68,7 @@
}
 
public function getQueryInfo() {
-   $dbr = wfGetDB( DB_SLAVE );
+   $dbr = wfGetDB( DB_REPLICA );
$query = parent::getQueryInfo();
$exceptionList = $this->getExceptionList();
if ( $exceptionList ) {
diff --git a/languages/Language.php b/languages/Language.php
index 12f26c3..941f4b8 100644
--- a/languages/Language.php
+++ b/languages/Language.php
@@ -4537,7 +4537,7 @@
public function formatExpiry( $expiry, $format = true, $infinity = 
'infinity' ) {
static $dbInfinity;
if ( $dbInfinity === null ) {
-   $dbInfinity = wfGetDB( DB_SLAVE )->getInfinity();
+   $dbInfinity = wfGetDB( DB_REPLICA )->getInfinity();
}
 
if ( $expiry == '' || $expiry === 'infinity' || $expiry == 
$dbInfinity ) {
diff --git a/profileinfo.php b/profileinfo.php
index 466f26a..83ae193 100644
--- a/profileinfo.php
+++ b/profileinfo.php
@@ -150,7 +150,7 @@
exit( 1 );
 }
 
-$dbr = wfGetDB( DB_SLAVE );
+$dbr = wfGetDB( DB_REPLICA );
 
 if ( !$dbr->tableExists( 'profiling' ) ) {
echo 'No profiling table exists, so we can\'t show you 
anything.'
diff --git a/tests/phpunit/MediaWikiTestCase.php 
b/tests/phpunit/MediaWikiTestCase.php
index 215d292..4afe710 100644
--- a/tests/phpunit/MediaWikiTestCase.php
+++ b/tests/phpunit/MediaWikiTestCase.php
@@ -1490,7 +1490,7 @@
' method should return true. Use @group 
Database or $this->tablesUsed.' );
}
 
-   $db = wfGetDB( DB_SLAVE );
+   $db = wfGetDB( DB_REPLICA );
 
$res = $db->select( $table, $fields, $condition, wfGetCaller(), 
[ 'ORDER BY' => $fields ] );
$this->assertNotEmpty( $res, "query failed: " . 
$db->lastError() );
diff --git a/tests/phpunit/includes/RevisionStorageTest.php 
b/tests/phpunit/includes/RevisionStorageTest.php
index 642ada2..3ba82a6 100644
--- a/tests/phpunit/includes/RevisionStorageTest.php
+++ b/tests/phpunit/includes/RevisionStorageTest.php
@@ -145,7 +145,7 @@
public function testConstructFromRow() {
$orig = $this->makeRevision();
 
-   $dbr = wfGetDB( DB_SLAVE );
+   $dbr = wfGetDB( DB_REPLICA );
$res = $dbr->select( 'revision', '*', [ 'rev_id' => 
$orig->getId() ] );
$this->assertTrue( is_object( $res ), 'query failed' );
 
@@ -163,7 +163,7 @@
public function testNewFromRow() {
$orig = $this->makeRevision();
 
-   $dbr = wfGetDB( DB_SLAVE );
+   $dbr = wfGetDB( DB_REPLICA );
$res = $dbr->select( 'revision', '*', [ 'rev_id' => 
$orig->getId() ] );
$this->assertTrue( is_object( $res ), 'query failed' );
 
@@ -187,7 +187,7 @@
$orig = $page->getRevision();
$page->doDeleteArticle( 'test Revision::newFromArchiveRow' );
 
-   $dbr = wfGetDB( DB_SLAVE );
+   $dbr = wfGetDB( DB_REPLICA );
$res = $dbr->select( 'archive', '*', [ 'ar_rev_id' => 
$orig->getId() ] );