http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89279
Revision: 89279
Author: kaldari
Date: 2011-06-01 19:04:42 +0000 (Wed, 01 Jun 2011)
Log Message:
-----------
better function names
Modified Paths:
--------------
trunk/extensions/CentralNotice/CentralNotice.db.php
trunk/extensions/CentralNotice/SpecialBannerListLoader.php
trunk/extensions/CentralNotice/SpecialCentralNotice.php
Modified: trunk/extensions/CentralNotice/CentralNotice.db.php
===================================================================
--- trunk/extensions/CentralNotice/CentralNotice.db.php 2011-06-01 18:57:33 UTC
(rev 89278)
+++ trunk/extensions/CentralNotice/CentralNotice.db.php 2011-06-01 19:04:42 UTC
(rev 89279)
@@ -12,7 +12,7 @@
* Return campaigns in the system within given constraints
* 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 ) {
+ static function getCampaigns( $project = false, $language = false,
$date = false, $enabled = true, $preferred = false, $location = false ) {
global $wgCentralDBname;
$notices = array();
@@ -121,7 +121,7 @@
/*
* Given one or more campaign ids, return all banners bound to them
*/
- static function selectTemplatesAssigned( $campaigns ) {
+ static function selectBannersAssigned( $campaigns ) {
global $wgCentralDBname;
$dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname );
Modified: trunk/extensions/CentralNotice/SpecialBannerListLoader.php
===================================================================
--- trunk/extensions/CentralNotice/SpecialBannerListLoader.php 2011-06-01
18:57:33 UTC (rev 89278)
+++ trunk/extensions/CentralNotice/SpecialBannerListLoader.php 2011-06-01
19:04:42 UTC (rev 89279)
@@ -59,12 +59,12 @@
$templates = array();
// See if we have any preferred campaigns for this language and
project
- $notices = CentralNoticeDB::getNotices( $this->project,
$this->language, null, 1, 1, $this->location );
+ $notices = CentralNoticeDB::getCampaigns( $this->project,
$this->language, null, 1, 1, $this->location );
// Quick short circuit to show preferred campaigns
if ( $notices ) {
// Pull banners
- $templates = CentralNoticeDB::selectTemplatesAssigned(
$notices );
+ $templates = CentralNoticeDB::selectBannersAssigned(
$notices );
}
// Didn't find any preferred banners so do an old style lookup
Modified: trunk/extensions/CentralNotice/SpecialCentralNotice.php
===================================================================
--- trunk/extensions/CentralNotice/SpecialCentralNotice.php 2011-06-01
18:57:33 UTC (rev 89278)
+++ trunk/extensions/CentralNotice/SpecialCentralNotice.php 2011-06-01
19:04:42 UTC (rev 89279)
@@ -75,7 +75,7 @@
$lockedNotices = $wgRequest->getArray( 'locked'
);
if ( $lockedNotices ) {
// Build list of campaigns to lock
- $unlockedNotices = array_diff(
$this->getNoticesName(), $lockedNotices );
+ $unlockedNotices = array_diff(
$this->getAllCampaignNames(), $lockedNotices );
// Set locked/unlocked flag accordingly
foreach ( $lockedNotices as $notice ) {
@@ -86,7 +86,7 @@
}
// Handle updates if no post content came
through (all checkboxes unchecked)
} elseif ( $method !== 'addNotice' ) {
- $allNotices = $this->getNoticesName();
+ $allNotices =
$this->getAllCampaignNames();
foreach ( $allNotices as $notice ) {
$this->updateLock( $notice, '0'
);
}
@@ -96,7 +96,7 @@
$enabledNotices = $wgRequest->getArray(
'enabled' );
if ( $enabledNotices ) {
// Build list of campaigns to disable
- $disabledNotices = array_diff(
$this->getNoticesName(), $enabledNotices );
+ $disabledNotices = array_diff(
$this->getAllCampaignNames(), $enabledNotices );
// Set enabled/disabled flag accordingly
foreach ( $enabledNotices as $notice ) {
@@ -107,7 +107,7 @@
}
// Handle updates if no post content came
through (all checkboxes unchecked)
} elseif ( $method !== 'addNotice' ) {
- $allNotices = $this->getNoticesName();
+ $allNotices =
$this->getAllCampaignNames();
foreach ( $allNotices as $notice ) {
$this->updateEnabled( $notice,
'0' );
}
@@ -117,7 +117,7 @@
$preferredNotices = $wgRequest->getArray(
'preferred' );
if ( $preferredNotices ) {
// Build list of campaigns to unset
- $unsetNotices = array_diff(
$this->getNoticesName(), $preferredNotices );
+ $unsetNotices = array_diff(
$this->getAllCampaignNames(), $preferredNotices );
// Set flag accordingly
foreach ( $preferredNotices as $notice
) {
@@ -128,7 +128,7 @@
}
// Handle updates if no post content came
through (all checkboxes unchecked)
} elseif ( $method !== 'addNotice' ) {
- $allNotices = $this->getNoticesName();
+ $allNotices =
$this->getAllCampaignNames();
foreach ( $allNotices as $notice ) {
$this->updatePreferred(
$notice, '0' );
}
@@ -198,7 +198,7 @@
* Get all the campaigns in the database
* @return an array of campaign names
*/
- function getNoticesName() {
+ function getAllCampaignNames() {
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'cn_notices', 'not_name', null, __METHOD__
);
$notices = array();
@@ -1144,7 +1144,7 @@
$templates = array();
if ( $campaigns ) {
// Pull all banners assigned to the campaigns
- $templates = CentralNoticeDB::selectTemplatesAssigned(
$campaigns );
+ $templates = CentralNoticeDB::selectBannersAssigned(
$campaigns );
}
return $templates;
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs