[MediaWiki-commits] [Gerrit] mediawiki...PageForms[master]: Revert of 164d2d64ccf9 - DB_REPLICA was only added in MW 1.28

2017-12-17 Thread Yaron Koren (Code Review)
Yaron Koren has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398776 )

Change subject: Revert of 164d2d64ccf9 - DB_REPLICA was only added in MW 1.28
..

Revert of 164d2d64ccf9 - DB_REPLICA was only added in MW 1.28

Change-Id: I571973d5aa595cb44c5008d1c71634249dec589e
---
M includes/PF_AutocompleteAPI.php
M includes/PF_FormEditAction.php
M includes/PF_FormLinker.php
M includes/PF_Utils.php
M includes/PF_ValuesUtils.php
M includes/forminputs/PF_Tree.php
M specials/PF_CreateForm.php
7 files changed, 10 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageForms 
refs/changes/76/398776/2

diff --git a/includes/PF_AutocompleteAPI.php b/includes/PF_AutocompleteAPI.php
index ff5501a..b57bd77 100644
--- a/includes/PF_AutocompleteAPI.php
+++ b/includes/PF_AutocompleteAPI.php
@@ -187,7 +187,7 @@
global $smwgDefaultStore;
 
$values = array();
-   $db = wfGetDB( DB_REPLICA );
+   $db = wfGetDB( DB_SLAVE );
$sqlOptions = array();
$sqlOptions['LIMIT'] = $wgPageFormsMaxAutocompleteValues;
 
diff --git a/includes/PF_FormEditAction.php b/includes/PF_FormEditAction.php
index c68d566..9d6f93e 100644
--- a/includes/PF_FormEditAction.php
+++ b/includes/PF_FormEditAction.php
@@ -225,7 +225,7 @@
 * (hopefully) pretty rare.
 */
static function getNumPagesPerForm() {
-   $dbr = wfGetDB( DB_REPLICA );
+   $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select(
array( 'category', 'page', 'page_props' ),
array( 'pp_value', 'SUM(cat_pages) AS total_pages' ),
diff --git a/includes/PF_FormLinker.php b/includes/PF_FormLinker.php
index a25bb53..8f6a731 100644
--- a/includes/PF_FormLinker.php
+++ b/includes/PF_FormLinker.php
@@ -21,7 +21,7 @@
}
 
$pageID = $title->getArticleID();
-   $dbr = wfGetDB( DB_REPLICA );
+   $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'page_props',
array(
'pp_value'
diff --git a/includes/PF_Utils.php b/includes/PF_Utils.php
index 00574f7..81b6c5f 100644
--- a/includes/PF_Utils.php
+++ b/includes/PF_Utils.php
@@ -234,7 +234,7 @@
 * Returns an array of all form names on this wiki.
*/
public static function getAllForms() {
-   $dbr = wfGetDB( DB_REPLICA );
+   $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'page',
'page_title',
array( 'page_namespace' => PF_NS_FORM,
diff --git a/includes/PF_ValuesUtils.php b/includes/PF_ValuesUtils.php
index a6cb598..e806a4b 100644
--- a/includes/PF_ValuesUtils.php
+++ b/includes/PF_ValuesUtils.php
@@ -51,7 +51,7 @@
 */
public static function getCategoriesForPage( $title = null ) {
$categories = array();
-   $db = wfGetDB( DB_REPLICA );
+   $db = wfGetDB( DB_SLAVE );
$conditions = null;
if ( !is_null( $title ) ) {
$titlekey = $title->getArticleID();
@@ -149,7 +149,7 @@
}
global $wgPageFormsMaxAutocompleteValues, 
$wgPageFormsUseDisplayTitle;
 
-   $db = wfGetDB( DB_REPLICA );
+   $db = wfGetDB( DB_SLAVE );
$top_category = str_replace( ' ', '_', $top_category );
$categories = array( $top_category );
$checkcategories = array( $top_category );
@@ -392,7 +392,7 @@
return wfMessage( 'pf-missingnamespace', 
wfEscapeWikiText( $namespace_name ) );
}
 
-   $db = wfGetDB( DB_REPLICA );
+   $db = wfGetDB( DB_SLAVE );
$tables = array( 'page' );
$columns = array( 'page_title' );
$conditions = array();
@@ -540,7 +540,7 @@
public static function getSQLConditionForAutocompleteInColumn( $column, 
$substring, $replaceSpaces = true ) {
global $wgDBtype, $wgPageFormsAutocompleteOnAllChars;
 
-   $db = wfGetDB( DB_REPLICA );
+   $db = wfGetDB( DB_SLAVE );
 
// CONVERT() is also supported in PostgreSQL, but it doesn't
// seem to work the same way.
diff --git a/includes/forminputs/PF_Tree.php b/includes/forminputs/PF_Tree.php
index 2802d49..b9efb29 100644
--- a/includes/forminputs/PF_Tree.php
+++ b/includes/forminputs/PF_Tree.php
@@ -86,7 +86,7 @@
 * @return array
 */
private static function getSubcategories( $categoryName ) {
-   $dbr = wfGetDb( DB_REPLICA );
+   $dbr = wfGetDb( DB_SLAVE );
 
$tables = array( 'page', 'categorylinks' );
$fields = array( 

[MediaWiki-commits] [Gerrit] mediawiki...PageForms[master]: Revert of 164d2d64ccf9 - DB_REPLICA was only added in MW 1.28

2017-12-17 Thread Yaron Koren (Code Review)
Yaron Koren has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/398776 )

Change subject: Revert of 164d2d64ccf9 - DB_REPLICA was only added in MW 1.28
..


Revert of 164d2d64ccf9 - DB_REPLICA was only added in MW 1.28

Change-Id: I571973d5aa595cb44c5008d1c71634249dec589e
---
M includes/PF_AutocompleteAPI.php
M includes/PF_FormEditAction.php
M includes/PF_FormLinker.php
M includes/PF_Utils.php
M includes/PF_ValuesUtils.php
M includes/forminputs/PF_Tree.php
M specials/PF_CreateForm.php
7 files changed, 10 insertions(+), 10 deletions(-)

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



diff --git a/includes/PF_AutocompleteAPI.php b/includes/PF_AutocompleteAPI.php
index ff5501a..b57bd77 100644
--- a/includes/PF_AutocompleteAPI.php
+++ b/includes/PF_AutocompleteAPI.php
@@ -187,7 +187,7 @@
global $smwgDefaultStore;
 
$values = array();
-   $db = wfGetDB( DB_REPLICA );
+   $db = wfGetDB( DB_SLAVE );
$sqlOptions = array();
$sqlOptions['LIMIT'] = $wgPageFormsMaxAutocompleteValues;
 
diff --git a/includes/PF_FormEditAction.php b/includes/PF_FormEditAction.php
index c68d566..9d6f93e 100644
--- a/includes/PF_FormEditAction.php
+++ b/includes/PF_FormEditAction.php
@@ -225,7 +225,7 @@
 * (hopefully) pretty rare.
 */
static function getNumPagesPerForm() {
-   $dbr = wfGetDB( DB_REPLICA );
+   $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select(
array( 'category', 'page', 'page_props' ),
array( 'pp_value', 'SUM(cat_pages) AS total_pages' ),
diff --git a/includes/PF_FormLinker.php b/includes/PF_FormLinker.php
index a25bb53..8f6a731 100644
--- a/includes/PF_FormLinker.php
+++ b/includes/PF_FormLinker.php
@@ -21,7 +21,7 @@
}
 
$pageID = $title->getArticleID();
-   $dbr = wfGetDB( DB_REPLICA );
+   $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'page_props',
array(
'pp_value'
diff --git a/includes/PF_Utils.php b/includes/PF_Utils.php
index 00574f7..81b6c5f 100644
--- a/includes/PF_Utils.php
+++ b/includes/PF_Utils.php
@@ -234,7 +234,7 @@
 * Returns an array of all form names on this wiki.
*/
public static function getAllForms() {
-   $dbr = wfGetDB( DB_REPLICA );
+   $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'page',
'page_title',
array( 'page_namespace' => PF_NS_FORM,
diff --git a/includes/PF_ValuesUtils.php b/includes/PF_ValuesUtils.php
index a6cb598..e806a4b 100644
--- a/includes/PF_ValuesUtils.php
+++ b/includes/PF_ValuesUtils.php
@@ -51,7 +51,7 @@
 */
public static function getCategoriesForPage( $title = null ) {
$categories = array();
-   $db = wfGetDB( DB_REPLICA );
+   $db = wfGetDB( DB_SLAVE );
$conditions = null;
if ( !is_null( $title ) ) {
$titlekey = $title->getArticleID();
@@ -149,7 +149,7 @@
}
global $wgPageFormsMaxAutocompleteValues, 
$wgPageFormsUseDisplayTitle;
 
-   $db = wfGetDB( DB_REPLICA );
+   $db = wfGetDB( DB_SLAVE );
$top_category = str_replace( ' ', '_', $top_category );
$categories = array( $top_category );
$checkcategories = array( $top_category );
@@ -392,7 +392,7 @@
return wfMessage( 'pf-missingnamespace', 
wfEscapeWikiText( $namespace_name ) );
}
 
-   $db = wfGetDB( DB_REPLICA );
+   $db = wfGetDB( DB_SLAVE );
$tables = array( 'page' );
$columns = array( 'page_title' );
$conditions = array();
@@ -540,7 +540,7 @@
public static function getSQLConditionForAutocompleteInColumn( $column, 
$substring, $replaceSpaces = true ) {
global $wgDBtype, $wgPageFormsAutocompleteOnAllChars;
 
-   $db = wfGetDB( DB_REPLICA );
+   $db = wfGetDB( DB_SLAVE );
 
// CONVERT() is also supported in PostgreSQL, but it doesn't
// seem to work the same way.
diff --git a/includes/forminputs/PF_Tree.php b/includes/forminputs/PF_Tree.php
index 2802d49..b9efb29 100644
--- a/includes/forminputs/PF_Tree.php
+++ b/includes/forminputs/PF_Tree.php
@@ -86,7 +86,7 @@
 * @return array
 */
private static function getSubcategories( $categoryName ) {
-   $dbr = wfGetDb( DB_REPLICA );
+   $dbr = wfGetDb( DB_SLAVE );
 
$tables = array( 'page', 'categorylinks' );
$fields = array( 'page_id',