http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73441
Revision: 73441
Author: kaldari
Date: 2010-09-21 02:45:00 +0000 (Tue, 21 Sep 2010)
Log Message:
-----------
trying a different method of switching the database
Modified Paths:
--------------
trunk/extensions/CentralNotice/CentralNotice.php
trunk/extensions/CentralNotice/SpecialBannerListLoader.php
trunk/extensions/CentralNotice/SpecialCentralNotice.php
Modified: trunk/extensions/CentralNotice/CentralNotice.php
===================================================================
--- trunk/extensions/CentralNotice/CentralNotice.php 2010-09-21 02:36:37 UTC
(rev 73440)
+++ trunk/extensions/CentralNotice/CentralNotice.php 2010-09-21 02:45:00 UTC
(rev 73441)
@@ -28,7 +28,7 @@
$wgNoticeInfrastructure = true;
// The name of the database which hosts the centralized campaign data
-$wgCentralDBname = 'metawiki';
+$wgCentralDBname = 'my_wiki';
// Enable the loader itself
// Allows to control the loader visibility, without destroying infrastructure
Modified: trunk/extensions/CentralNotice/SpecialBannerListLoader.php
===================================================================
--- trunk/extensions/CentralNotice/SpecialBannerListLoader.php 2010-09-21
02:36:37 UTC (rev 73440)
+++ trunk/extensions/CentralNotice/SpecialBannerListLoader.php 2010-09-21
02:45:00 UTC (rev 73441)
@@ -18,12 +18,8 @@
}
function execute( $par ) {
- global $wgOut, $wgRequest, $wgDBname, $wgCentralDBname;
+ global $wgOut, $wgRequest;
- // Temporarily switch to central wiki database
- $localDBname = $wgDBname;
- $wgDBname = $wgCentralDBname;
-
$wgOut->disable();
$this->sendHeaders();
@@ -47,9 +43,6 @@
} else {
echo "/* No site specified */";
}
-
- // Switch back to local wiki database
- $wgDBname = $localDBname;
}
/**
Modified: trunk/extensions/CentralNotice/SpecialCentralNotice.php
===================================================================
--- trunk/extensions/CentralNotice/SpecialCentralNotice.php 2010-09-21
02:36:37 UTC (rev 73440)
+++ trunk/extensions/CentralNotice/SpecialCentralNotice.php 2010-09-21
02:45:00 UTC (rev 73441)
@@ -1005,8 +1005,10 @@
* @return A 2D array of running banners with associated weights and
settings
*/
static function selectNoticeTemplates( $project, $language, $location =
null ) {
+ global $wgCentralDBname;
+
$campaigns = array();
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname );
$encTimestamp = $dbr->addQuotes( $dbr->timestamp() );
// Pull non-geotargeted campaigns
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs