http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73444
Revision: 73444
Author: kaldari
Date: 2010-09-21 03:02:04 +0000 (Tue, 21 Sep 2010)
Log Message:
-----------
more database switching
Modified Paths:
--------------
trunk/extensions/CentralNotice/CentralNotice.db.php
trunk/extensions/CentralNotice/SpecialBannerLoader.php
Modified: trunk/extensions/CentralNotice/CentralNotice.db.php
===================================================================
--- trunk/extensions/CentralNotice/CentralNotice.db.php 2010-09-21 02:56:46 UTC
(rev 73443)
+++ trunk/extensions/CentralNotice/CentralNotice.db.php 2010-09-21 03:02:04 UTC
(rev 73444)
@@ -19,11 +19,12 @@
* By default returns enabled campaigns, if $enabled set to false,
returns both enabled and disabled campaigns
*/
static function getNotices( $project = false, $language = false, $date
= false, $enabled = true, $preferred = false, $location = false ) {
+ global $wgCentralDBname;
$notices = array();
// Database setup
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname );
if ( !$date ) {
$encTimestamp = $dbr->addQuotes( $dbr->timestamp() );
@@ -122,7 +123,9 @@
* Given one or more campaign ids, return all banners bound to them
*/
static function selectTemplatesAssigned( $campaigns ) {
- $dbr = wfGetDB( DB_SLAVE );
+ global $wgCentralDBname;
+
+ $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname );
if ( $campaigns ) {
// Pull templates based on join with assignments
Modified: trunk/extensions/CentralNotice/SpecialBannerLoader.php
===================================================================
--- trunk/extensions/CentralNotice/SpecialBannerLoader.php 2010-09-21
02:56:46 UTC (rev 73443)
+++ trunk/extensions/CentralNotice/SpecialBannerLoader.php 2010-09-21
03:02:04 UTC (rev 73444)
@@ -16,12 +16,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();
@@ -48,9 +44,6 @@
} else {
echo "<!-- No banner specified -->";
}
-
- // Switch back to local wiki database
- $wgDBname = $localDBname;
}
/**
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs