Index: branches/wmf/1.17wmf1/extensions/CentralNotice/CentralNotice.php |
— | — | @@ -25,11 +25,10 @@ |
26 | 26 | |
27 | 27 | // Enable the notice-hosting infrastructure on this wiki... |
28 | 28 | // Leave at false for wikis that only use a sister site for the control. |
29 | | -// All remaining options apply only to the infrastructure wiki. |
30 | 29 | $wgNoticeInfrastructure = true; |
31 | 30 | |
32 | 31 | // The name of the database which hosts the centralized campaign data |
33 | | -$wgCentralDBname = ''; |
| 32 | +$wgCentralDBname = $wgDBname; |
34 | 33 | |
35 | 34 | // The script path on the wiki that hosts the CentralNotice infrastructure |
36 | 35 | // For example 'http://meta.wikimedia.org/w/index.php' |
— | — | @@ -40,24 +39,14 @@ |
41 | 40 | // for cached content |
42 | 41 | $wgCentralNoticeLoader = true; |
43 | 42 | |
44 | | -// If true, notice only displays if 'sitenotice=yes' is in the query string |
45 | | -$wgNoticeTestMode = false; |
| 43 | +// Flag for turning on fundraising specific features |
| 44 | +$wgNoticeEnableFundraising = true; |
46 | 45 | |
47 | | -// Array of '$lang.$project' for exceptions to the test mode rule |
48 | | -$wgNoticeEnabledSites = array(); |
| 46 | +// Base URL for default fundraiser landing page (without query string) |
| 47 | +$wgNoticeFundraisingUrl = 'http://wikimediafoundation.org/wiki/Special:LandingCheck'; |
49 | 48 | |
50 | | -// Client-side cache timeout for the loader JS stub. |
51 | | -// If 0, clients will (probably) rechceck it on every hit, |
52 | | -// which is good for testing. |
53 | | -$wgNoticeTimeout = 0; |
54 | | - |
55 | | -// Server-side cache timeout for the loader JS stub. |
56 | | -// Should be big if you won't include the counter info in the text, |
57 | | -// smallish if you will. :) |
58 | | -$wgNoticeServerTimeout = 0; |
59 | | - |
60 | 49 | // Source for live counter information |
61 | | -$wgNoticeCounterSource = "http://donate.wikimedia.org/counter.php"; |
| 50 | +$wgNoticeCounterSource = 'http://wikimediafoundation.org/wiki/Special:ContributionTotal?action=raw'; |
62 | 51 | |
63 | 52 | // Domain to set global cookies for. |
64 | 53 | // Example: '.wikipedia.org' |
— | — | @@ -68,6 +57,7 @@ |
69 | 58 | $wgExtensionCredits['other'][] = array( |
70 | 59 | 'path' => __FILE__, |
71 | 60 | 'name' => 'CentralNotice', |
| 61 | + 'version' => '2.0', |
72 | 62 | 'author' => array( 'Brion Vibber', 'Ryan Kaldari' ), |
73 | 63 | 'url' => 'http://www.mediawiki.org/wiki/Extension:CentralNotice', |
74 | 64 | 'descriptionmsg' => 'centralnotice-desc', |
— | — | @@ -82,9 +72,17 @@ |
83 | 73 | $wgAvailableRights[] = 'centralnotice-admin'; |
84 | 74 | $wgGroupPermissions['sysop']['centralnotice-admin'] = true; // Only sysops can make change |
85 | 75 | |
| 76 | +# Unit tests |
| 77 | +$wgHooks['UnitTestsList'][] = 'efCentralNoticeUnitTests'; |
| 78 | + |
| 79 | +function efCentralNoticeUnitTests( &$files ) { |
| 80 | + $files[] = dirname( __FILE__ ) . '/tests/CentralNoticeTest.php'; |
| 81 | + return true; |
| 82 | +} |
| 83 | + |
86 | 84 | function efCentralNoticeSetup() { |
87 | 85 | global $wgHooks, $wgNoticeInfrastructure, $wgAutoloadClasses, $wgSpecialPages; |
88 | | - global $wgCentralNoticeLoader; |
| 86 | + global $wgCentralNoticeLoader, $wgSpecialPageGroups; |
89 | 87 | |
90 | 88 | $dir = dirname( __FILE__ ) . '/'; |
91 | 89 | |
— | — | @@ -96,19 +94,21 @@ |
97 | 95 | $wgHooks['SkinAfterBottomScripts'][] = 'efCentralNoticeGeoLoader'; |
98 | 96 | } |
99 | 97 | |
| 98 | + $specialDir = $dir . 'special/'; |
| 99 | + |
100 | 100 | $wgSpecialPages['BannerLoader'] = 'SpecialBannerLoader'; |
101 | | - $wgAutoloadClasses['SpecialBannerLoader'] = $dir . 'SpecialBannerLoader.php'; |
| 101 | + $wgAutoloadClasses['SpecialBannerLoader'] = $specialDir . 'SpecialBannerLoader.php'; |
102 | 102 | |
103 | 103 | $wgSpecialPages['BannerListLoader'] = 'SpecialBannerListLoader'; |
104 | | - $wgAutoloadClasses['SpecialBannerListLoader'] = $dir . 'SpecialBannerListLoader.php'; |
| 104 | + $wgAutoloadClasses['SpecialBannerListLoader'] = $specialDir . 'SpecialBannerListLoader.php'; |
105 | 105 | |
106 | 106 | $wgSpecialPages['BannerController'] = 'SpecialBannerController'; |
107 | | - $wgAutoloadClasses['SpecialBannerController'] = $dir . 'SpecialBannerController.php'; |
| 107 | + $wgAutoloadClasses['SpecialBannerController'] = $specialDir . 'SpecialBannerController.php'; |
108 | 108 | |
109 | 109 | $wgSpecialPages['HideBanners'] = 'SpecialHideBanners'; |
110 | | - $wgAutoloadClasses['SpecialHideBanners'] = $dir . 'SpecialHideBanners.php'; |
| 110 | + $wgAutoloadClasses['SpecialHideBanners'] = $specialDir . 'SpecialHideBanners.php'; |
111 | 111 | |
112 | | - $wgAutoloadClasses['CentralNotice'] = $dir . 'SpecialCentralNotice.php'; |
| 112 | + $wgAutoloadClasses['CentralNotice'] = $specialDir . 'SpecialCentralNotice.php'; |
113 | 113 | $wgAutoloadClasses['CentralNoticeDB'] = $dir . 'CentralNotice.db.php'; |
114 | 114 | $wgAutoloadClasses['TemplatePager'] = $dir . 'TemplatePager.php'; |
115 | 115 | |
— | — | @@ -117,10 +117,10 @@ |
118 | 118 | $wgSpecialPageGroups['CentralNotice'] = 'wiki'; // Wiki data and tools" |
119 | 119 | |
120 | 120 | $wgSpecialPages['NoticeTemplate'] = 'SpecialNoticeTemplate'; |
121 | | - $wgAutoloadClasses['SpecialNoticeTemplate'] = $dir . 'SpecialNoticeTemplate.php'; |
| 121 | + $wgAutoloadClasses['SpecialNoticeTemplate'] = $specialDir . 'SpecialNoticeTemplate.php'; |
122 | 122 | |
123 | 123 | $wgSpecialPages['BannerAllocation'] = 'SpecialBannerAllocation'; |
124 | | - $wgAutoloadClasses['SpecialBannerAllocation'] = $dir . 'SpecialBannerAllocation.php'; |
| 124 | + $wgAutoloadClasses['SpecialBannerAllocation'] = $specialDir . 'SpecialBannerAllocation.php'; |
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
— | — | @@ -130,33 +130,37 @@ |
131 | 131 | global $wgDBtype, $wgExtNewTables, $wgExtNewFields; |
132 | 132 | |
133 | 133 | if ( $wgDBtype == 'mysql' ) { |
134 | | - $wgExtNewTables[] = array( 'cn_notices', |
| 134 | + $wgExtNewTables[] = array( 'cn_notices', |
135 | 135 | $base . '/CentralNotice.sql' ); |
136 | 136 | $wgExtNewFields[] = array( 'cn_notices', 'not_preferred', |
137 | 137 | $base . '/patches/patch-notice_preferred.sql' ); |
138 | | - $wgExtNewTables[] = array( 'cn_notice_languages', |
| 138 | + $wgExtNewTables[] = array( 'cn_notice_languages', |
139 | 139 | $base . '/patches/patch-notice_languages.sql' ); |
140 | | - $wgExtNewFields[] = array( 'cn_templates', 'tmp_display_anon', |
| 140 | + $wgExtNewFields[] = array( 'cn_templates', 'tmp_display_anon', |
141 | 141 | $base . '/patches/patch-template_settings.sql' ); |
142 | | - $wgExtNewTables[] = array( 'cn_notice_countries', |
| 142 | + $wgExtNewFields[] = array( 'cn_templates', 'tmp_fundraising', |
| 143 | + $base . '/patches/patch-template_fundraising.sql' ); |
| 144 | + $wgExtNewTables[] = array( 'cn_notice_countries', |
143 | 145 | $base . '/patches/patch-notice_countries.sql' ); |
144 | | - $wgExtNewTables[] = array( 'cn_notice_projects', |
| 146 | + $wgExtNewTables[] = array( 'cn_notice_projects', |
145 | 147 | $base . '/patches/patch-notice_projects.sql' ); |
146 | 148 | } |
147 | 149 | } else { |
148 | 150 | if ( $updater->getDB()->getType() == 'mysql' ) { |
149 | | - $updater->addExtensionUpdate( array( 'addTable', 'cn_notices', |
150 | | - $base . '/CentralNotice.sql' ) ); |
151 | | - $updater->addExtensionUpdate( array( 'addField', 'cn_notices', 'not_preferred', |
152 | | - $base . '/patches/patch-notice_preferred.sql' ) ); |
153 | | - $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_languages', |
154 | | - $base . '/patches/patch-notice_languages.sql' ) ); |
155 | | - $updater->addExtensionUpdate( array( 'addField', 'cn_templates', 'tmp_display_anon', |
156 | | - $base . '/patches/patch-template_settings.sql' ) ); |
157 | | - $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_countries', |
158 | | - $base . '/patches/patch-notice_countries.sql' ) ); |
159 | | - $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_projects', |
160 | | - $base . '/patches/patch-notice_projects.sql' ) ); |
| 151 | + $updater->addExtensionUpdate( array( 'addTable', 'cn_notices', |
| 152 | + $base . '/CentralNotice.sql', true ) ); |
| 153 | + $updater->addExtensionUpdate( array( 'addField', 'cn_notices', 'not_preferred', |
| 154 | + $base . '/patches/patch-notice_preferred.sql', true ) ); |
| 155 | + $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_languages', |
| 156 | + $base . '/patches/patch-notice_languages.sql', true ) ); |
| 157 | + $updater->addExtensionUpdate( array( 'addField', 'cn_templates', 'tmp_display_anon', |
| 158 | + $base . '/patches/patch-template_settings.sql', true ) ); |
| 159 | + $updater->addExtensionUpdate( array( 'addField', 'cn_templates', 'tmp_fundraising', |
| 160 | + $base . '/patches/patch-template_fundraising.sql', true ) ); |
| 161 | + $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_countries', |
| 162 | + $base . '/patches/patch-notice_countries.sql', true ) ); |
| 163 | + $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_projects', |
| 164 | + $base . '/patches/patch-notice_projects.sql', true ) ); |
161 | 165 | } |
162 | 166 | } |
163 | 167 | return true; |
— | — | @@ -167,7 +171,7 @@ |
168 | 172 | |
169 | 173 | // Include '.js' to exempt script from squid cache override |
170 | 174 | $centralLoader = SpecialPage::getTitleFor( 'BannerController' )->getLocalUrl( 'cache=/cn.js' ); |
171 | | - |
| 175 | + |
172 | 176 | // Insert the banner controller Javascript into the <head> |
173 | 177 | $wgOut->addScriptFile( $centralLoader ); |
174 | 178 | |
Property changes on: branches/wmf/1.17wmf1/extensions/CentralNotice/CentralNotice.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
175 | 179 | Merged /branches/wmf-deployment/extensions/CentralNotice/CentralNotice.php:r60970 |
176 | 180 | Merged /branches/wmf/1.16wmf4/extensions/CentralNotice/CentralNotice.php:r67177,69199,76243,77266 |
177 | 181 | Merged /trunk/extensions/CentralNotice/CentralNotice.php:r62820-67552,67557,67559-71720,71725-71731,71734-71739,71748-71753,71774-71997,72058-72131,72136-73830,73847,73850,73852,73855,73959,73963,73973,73980,73983,73991,73994-73995,74000-74321,74325-74406,75376-75470,75567,75643,75646,75674,75680,75726,75849,75889,75908,75973,76141,76145,76333,76347,76351,76356-76358,76361,76363,76445,76455,76462,76543,76763,77622-79761,79780,79783-80145,80147-80148,80150,80152-80602,80805,81461-83563,83565-91111 |
178 | 182 | Merged /trunk/phase3/extensions/CentralNotice/CentralNotice.php:r63545-63546,63549,63643,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816,77555,77558-77560,77563-77565,77573 |