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

Change subject: Use wfWikiID() so we also get any $wgDBprefix
......................................................................


Use wfWikiID() so we also get any $wgDBprefix

This only fixes it for local deliveries, not remote ones.

Change-Id: Ib0aef1915dd19e51a5f63fe15936e4e388cc1d44
---
M MassMessage.body.php
M MassMessage.hooks.php
M tests/MassMessageTest.php
3 files changed, 7 insertions(+), 11 deletions(-)

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



diff --git a/MassMessage.body.php b/MassMessage.body.php
index c3671c1..733761b 100644
--- a/MassMessage.body.php
+++ b/MassMessage.body.php
@@ -116,10 +116,8 @@
         * @return array
         */
        public static function normalizeTargets( $data ) {
-               global $wgDBname;
                $targets = array();
                foreach ( $data as $target ) {
-
                        if ( !isset( $target['dbname'] ) ) {
                                $dbname = self::getDBName( $target['site'] );
                                if ( $dbname == null ) {
@@ -129,7 +127,7 @@
                                $target['dbname'] = $dbname;
                        }
 
-                       if ( $target['dbname'] == $wgDBname ) {
+                       if ( $target['dbname'] == wfWikiID() ) {
                                $title = Title::newFromText( $target['title'] );
                                if ( $title === null ) {
                                        continue;
diff --git a/MassMessage.hooks.php b/MassMessage.hooks.php
index 0c0d064..8c76dbf 100644
--- a/MassMessage.hooks.php
+++ b/MassMessage.hooks.php
@@ -29,10 +29,10 @@
                $data = array( 'site' => $site, 'title' => $page );
                if ( trim( $site ) === '' ) {
                        // Assume it's a local delivery
-                       global $wgServer, $wgDBname;
+                       global $wgServer;
                        $site = MassMessage::getBaseUrl( $wgServer );
                        $data['site'] = $site;
-                       $data['dbname'] = $wgDBname;
+                       $data['dbname'] = wfWikiID();
                }
                // Use a message so wikis can customize the output
                $msg = wfMessage( 'massmessage-target' )->params( $site, 
$wgScript, $page )->plain();
diff --git a/tests/MassMessageTest.php b/tests/MassMessageTest.php
index 093acb8..b7fd07f 100644
--- a/tests/MassMessageTest.php
+++ b/tests/MassMessageTest.php
@@ -2,8 +2,6 @@
 
 /**
  * Tests for the MassMessage extension...
- *
- * @group Database
  */
 
 class MassMessageTest extends MediaWikiTestCase {
@@ -81,16 +79,16 @@
         * @return array
         */
        public static function provideGetParserFunctionTargets() {
-               global $wgDBname, $wgContLang;
+               global $wgContLang;
                $proj = $wgContLang->getFormattedNsText( NS_PROJECT ); // 
Output changes based on wikiname
 
                return array(
                        // project page, no site provided
-                       array( '{{#target:Project:Example}}', array( 'title' => 
$proj . ':Example', 'dbname' => $wgDBname ), ),
+                       array( '{{#target:Project:Example}}', array( 'title' => 
$proj . ':Example', 'dbname' => wfWikiID() ), ),
                        // user talk page, no site provided
-                       array( '{{#target:User talk:Example}}', array( 'dbname' 
=> $wgDBname, 'title' => 'User talk:Example' ), ),
+                       array( '{{#target:User talk:Example}}', array( 'dbname' 
=> wfWikiID(), 'title' => 'User talk:Example' ), ),
                        // local redirect being followed
-                       array( '{{#target:User talk:Is a redirect}}', array( 
'dbname' => $wgDBname, 'title' => 'User talk:Redirect target' ) ),
+                       array( '{{#target:User talk:Is a redirect}}', array( 
'dbname' => wfWikiID(), 'title' => 'User talk:Redirect target' ) ),
                        // invalid titles
                        array( '{{#target:User:<><}}', array(), ),
                        array( '{{#target:Project:!!!<><><><>', array(), ),

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib0aef1915dd19e51a5f63fe15936e4e388cc1d44
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/MassMessage
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to