Index: trunk/extensions/CentralNotice/SpecialBannerListLoader.php |
— | — | @@ -59,12 +59,12 @@ |
60 | 60 | $templates = array(); |
61 | 61 | |
62 | 62 | // See if we have any preferred campaigns for this language and project |
63 | | - $notices = CentralNoticeDB::getNotices( $this->project, $this->language, null, 1, 1, $this->location ); |
| 63 | + $notices = CentralNoticeDB::getCampaigns( $this->project, $this->language, null, 1, 1, $this->location ); |
64 | 64 | |
65 | 65 | // Quick short circuit to show preferred campaigns |
66 | 66 | if ( $notices ) { |
67 | 67 | // Pull banners |
68 | | - $templates = CentralNoticeDB::selectTemplatesAssigned( $notices ); |
| 68 | + $templates = CentralNoticeDB::selectBannersAssigned( $notices ); |
69 | 69 | } |
70 | 70 | |
71 | 71 | // Didn't find any preferred banners so do an old style lookup |
Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | $lockedNotices = $wgRequest->getArray( 'locked' ); |
77 | 77 | if ( $lockedNotices ) { |
78 | 78 | // Build list of campaigns to lock |
79 | | - $unlockedNotices = array_diff( $this->getNoticesName(), $lockedNotices ); |
| 79 | + $unlockedNotices = array_diff( $this->getAllCampaignNames(), $lockedNotices ); |
80 | 80 | |
81 | 81 | // Set locked/unlocked flag accordingly |
82 | 82 | foreach ( $lockedNotices as $notice ) { |
— | — | @@ -86,7 +86,7 @@ |
87 | 87 | } |
88 | 88 | // Handle updates if no post content came through (all checkboxes unchecked) |
89 | 89 | } elseif ( $method !== 'addNotice' ) { |
90 | | - $allNotices = $this->getNoticesName(); |
| 90 | + $allNotices = $this->getAllCampaignNames(); |
91 | 91 | foreach ( $allNotices as $notice ) { |
92 | 92 | $this->updateLock( $notice, '0' ); |
93 | 93 | } |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | $enabledNotices = $wgRequest->getArray( 'enabled' ); |
98 | 98 | if ( $enabledNotices ) { |
99 | 99 | // Build list of campaigns to disable |
100 | | - $disabledNotices = array_diff( $this->getNoticesName(), $enabledNotices ); |
| 100 | + $disabledNotices = array_diff( $this->getAllCampaignNames(), $enabledNotices ); |
101 | 101 | |
102 | 102 | // Set enabled/disabled flag accordingly |
103 | 103 | foreach ( $enabledNotices as $notice ) { |
— | — | @@ -107,7 +107,7 @@ |
108 | 108 | } |
109 | 109 | // Handle updates if no post content came through (all checkboxes unchecked) |
110 | 110 | } elseif ( $method !== 'addNotice' ) { |
111 | | - $allNotices = $this->getNoticesName(); |
| 111 | + $allNotices = $this->getAllCampaignNames(); |
112 | 112 | foreach ( $allNotices as $notice ) { |
113 | 113 | $this->updateEnabled( $notice, '0' ); |
114 | 114 | } |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | $preferredNotices = $wgRequest->getArray( 'preferred' ); |
119 | 119 | if ( $preferredNotices ) { |
120 | 120 | // Build list of campaigns to unset |
121 | | - $unsetNotices = array_diff( $this->getNoticesName(), $preferredNotices ); |
| 121 | + $unsetNotices = array_diff( $this->getAllCampaignNames(), $preferredNotices ); |
122 | 122 | |
123 | 123 | // Set flag accordingly |
124 | 124 | foreach ( $preferredNotices as $notice ) { |
— | — | @@ -128,7 +128,7 @@ |
129 | 129 | } |
130 | 130 | // Handle updates if no post content came through (all checkboxes unchecked) |
131 | 131 | } elseif ( $method !== 'addNotice' ) { |
132 | | - $allNotices = $this->getNoticesName(); |
| 132 | + $allNotices = $this->getAllCampaignNames(); |
133 | 133 | foreach ( $allNotices as $notice ) { |
134 | 134 | $this->updatePreferred( $notice, '0' ); |
135 | 135 | } |
— | — | @@ -198,7 +198,7 @@ |
199 | 199 | * Get all the campaigns in the database |
200 | 200 | * @return an array of campaign names |
201 | 201 | */ |
202 | | - function getNoticesName() { |
| 202 | + function getAllCampaignNames() { |
203 | 203 | $dbr = wfGetDB( DB_SLAVE ); |
204 | 204 | $res = $dbr->select( 'cn_notices', 'not_name', null, __METHOD__ ); |
205 | 205 | $notices = array(); |
— | — | @@ -1144,7 +1144,7 @@ |
1145 | 1145 | $templates = array(); |
1146 | 1146 | if ( $campaigns ) { |
1147 | 1147 | // Pull all banners assigned to the campaigns |
1148 | | - $templates = CentralNoticeDB::selectTemplatesAssigned( $campaigns ); |
| 1148 | + $templates = CentralNoticeDB::selectBannersAssigned( $campaigns ); |
1149 | 1149 | } |
1150 | 1150 | return $templates; |
1151 | 1151 | } |
Index: trunk/extensions/CentralNotice/CentralNotice.db.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | * Return campaigns in the system within given constraints |
14 | 14 | * By default returns enabled campaigns, if $enabled set to false, returns both enabled and disabled campaigns |
15 | 15 | */ |
16 | | - static function getNotices( $project = false, $language = false, $date = false, $enabled = true, $preferred = false, $location = false ) { |
| 16 | + static function getCampaigns( $project = false, $language = false, $date = false, $enabled = true, $preferred = false, $location = false ) { |
17 | 17 | global $wgCentralDBname; |
18 | 18 | |
19 | 19 | $notices = array(); |
— | — | @@ -121,7 +121,7 @@ |
122 | 122 | /* |
123 | 123 | * Given one or more campaign ids, return all banners bound to them |
124 | 124 | */ |
125 | | - static function selectTemplatesAssigned( $campaigns ) { |
| 125 | + static function selectBannersAssigned( $campaigns ) { |
126 | 126 | global $wgCentralDBname; |
127 | 127 | |
128 | 128 | $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname ); |