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

Change subject: Reuse $wgCentralDBname for the Choice infrastructure
......................................................................


Reuse $wgCentralDBname for the Choice infrastructure

I don't think we need to make this independently conditional of the
main infrastructure config.

Change-Id: If967c4a6b65773b0ba3b8235b1b07498747c1863
---
M CentralNotice.php
M includes/BannerChoiceDataProvider.php
M includes/CNBannerChoiceDataResourceLoaderModule.php
3 files changed, 8 insertions(+), 12 deletions(-)

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



diff --git a/CentralNotice.php b/CentralNotice.php
index e659a3b..fb177e7 100644
--- a/CentralNotice.php
+++ b/CentralNotice.php
@@ -85,15 +85,11 @@
 // For example 'http://meta.wikimedia.org/w/index.php'
 $wgCentralPagePath = false;
 
-// The wiki ID for direct database queries on the infrastructure wiki database.
-// Leave this set to false to use the Web API instead.
-$wgCentralNoticeInfrastructureId = false;
-
 // The API path on the wiki that hosts the CentralNotice infrastructure
 // For example 'http://meta.wikimedia.org/api.php'
 // This must be set if you enable the selection of banners on the client and
 // you don't have direct access to the infrastructure database (see
-// $wgCentralNoticeInfrastructureId).
+// $wgCentralDBname).
 $wgCentralNoticeApiUrl = false;
 
 // How long to cache the banner choice data in memcached, in seconds
diff --git a/includes/BannerChoiceDataProvider.php 
b/includes/BannerChoiceDataProvider.php
index 210d81b..6827b6d 100644
--- a/includes/BannerChoiceDataProvider.php
+++ b/includes/BannerChoiceDataProvider.php
@@ -13,7 +13,7 @@
 
        /**
         * Query the infrastructure DB using the wiki ID in
-        * $wgCentralNoticeInfrastructureId
+        * $wgCentralDBname
         */
        const USE_INFRASTRUCTURE_DB = 1;
 
@@ -51,7 +51,7 @@
         *   are provided.
         */
        public function getChoices() {
-               global $wgCentralNoticeInfrastructureId;
+               global $wgCentralDBname;
 
                // For speed, we'll do our own queries instead of using methods 
in
                // Campaign and Banner.
@@ -62,7 +62,7 @@
                                break;
 
                        case self::USE_INFRASTRUCTURE_DB:
-                               $wikiId = $wgCentralNoticeInfrastructureId;
+                               $wikiId = $wgCentralDBname;
                                break;
 
                        default:
diff --git a/includes/CNBannerChoiceDataResourceLoaderModule.php 
b/includes/CNBannerChoiceDataResourceLoaderModule.php
index 908d0d3..3e7837f 100644
--- a/includes/CNBannerChoiceDataResourceLoaderModule.php
+++ b/includes/CNBannerChoiceDataResourceLoaderModule.php
@@ -28,9 +28,9 @@
        protected function getChoices( ResourceLoaderContext $context ) {
                global $wgNoticeProject,
                        $wgUser,
-                       $wgCentralNoticeInfrastructureId,
                        $wgCentralNoticeApiUrl,
-                       $wgCentralNoticeBannerChoiceDataCacheExpiry;
+                       $wgCentralNoticeBannerChoiceDataCacheExpiry,
+                       $wgCentralDBname;
 
                $project = $wgNoticeProject;
                $language = $context->getLanguage();
@@ -64,7 +64,7 @@
                // If something's amiss, we warn and return an empty array, but 
don't
                // bring everything to a standstill.
 
-               if ( $wgCentralNoticeInfrastructureId ) {
+               if ( $wgCentralDBname ) {
                         $choices = $this->getFromDb( $project, $language, 
$status );
 
                } else if ( $wgCentralNoticeApiUrl ) {
@@ -95,7 +95,7 @@
 
        /**
         * Get the banner choices data via a direct DB call using
-        * $wgCentralNoticeInfrastructureId.
+        * $wgCentralDBname.
         *
         * @param string $project
         * @param string $language

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If967c4a6b65773b0ba3b8235b1b07498747c1863
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Awight <[email protected]>
Gerrit-Reviewer: AndyRussG <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: Katie Horn <[email protected]>
Gerrit-Reviewer: Mwalker <[email protected]>
Gerrit-Reviewer: Ssmith <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to