r91115 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91114‎ | r91115 | r91116 >
Date:21:53, 29 June 2011
Author:awjrichards
Status:ok
Tags:
Comment:
MFT r76455, r80805 and r83564-91107
Modified paths:
  • /branches/wmf/1.17wmf1/extensions/CentralNotice/CentralNotice.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/extensions/CentralNotice/CentralNotice.php
@@ -25,11 +25,10 @@
2626
2727 // Enable the notice-hosting infrastructure on this wiki...
2828 // Leave at false for wikis that only use a sister site for the control.
29 -// All remaining options apply only to the infrastructure wiki.
3029 $wgNoticeInfrastructure = true;
3130
3231 // The name of the database which hosts the centralized campaign data
33 -$wgCentralDBname = '';
 32+$wgCentralDBname = $wgDBname;
3433
3534 // The script path on the wiki that hosts the CentralNotice infrastructure
3635 // For example 'http://meta.wikimedia.org/w/index.php'
@@ -40,24 +39,14 @@
4140 // for cached content
4241 $wgCentralNoticeLoader = true;
4342
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;
4645
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';
4948
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 -
6049 // Source for live counter information
61 -$wgNoticeCounterSource = "http://donate.wikimedia.org/counter.php";
 50+$wgNoticeCounterSource = 'http://wikimediafoundation.org/wiki/Special:ContributionTotal?action=raw';
6251
6352 // Domain to set global cookies for.
6453 // Example: '.wikipedia.org'
@@ -68,6 +57,7 @@
6958 $wgExtensionCredits['other'][] = array(
7059 'path' => __FILE__,
7160 'name' => 'CentralNotice',
 61+ 'version' => '2.0',
7262 'author' => array( 'Brion Vibber', 'Ryan Kaldari' ),
7363 'url' => 'http://www.mediawiki.org/wiki/Extension:CentralNotice',
7464 'descriptionmsg' => 'centralnotice-desc',
@@ -82,9 +72,17 @@
8373 $wgAvailableRights[] = 'centralnotice-admin';
8474 $wgGroupPermissions['sysop']['centralnotice-admin'] = true; // Only sysops can make change
8575
 76+# Unit tests
 77+$wgHooks['UnitTestsList'][] = 'efCentralNoticeUnitTests';
 78+
 79+function efCentralNoticeUnitTests( &$files ) {
 80+ $files[] = dirname( __FILE__ ) . '/tests/CentralNoticeTest.php';
 81+ return true;
 82+}
 83+
8684 function efCentralNoticeSetup() {
8785 global $wgHooks, $wgNoticeInfrastructure, $wgAutoloadClasses, $wgSpecialPages;
88 - global $wgCentralNoticeLoader;
 86+ global $wgCentralNoticeLoader, $wgSpecialPageGroups;
8987
9088 $dir = dirname( __FILE__ ) . '/';
9189
@@ -96,19 +94,21 @@
9795 $wgHooks['SkinAfterBottomScripts'][] = 'efCentralNoticeGeoLoader';
9896 }
9997
 98+ $specialDir = $dir . 'special/';
 99+
100100 $wgSpecialPages['BannerLoader'] = 'SpecialBannerLoader';
101 - $wgAutoloadClasses['SpecialBannerLoader'] = $dir . 'SpecialBannerLoader.php';
 101+ $wgAutoloadClasses['SpecialBannerLoader'] = $specialDir . 'SpecialBannerLoader.php';
102102
103103 $wgSpecialPages['BannerListLoader'] = 'SpecialBannerListLoader';
104 - $wgAutoloadClasses['SpecialBannerListLoader'] = $dir . 'SpecialBannerListLoader.php';
 104+ $wgAutoloadClasses['SpecialBannerListLoader'] = $specialDir . 'SpecialBannerListLoader.php';
105105
106106 $wgSpecialPages['BannerController'] = 'SpecialBannerController';
107 - $wgAutoloadClasses['SpecialBannerController'] = $dir . 'SpecialBannerController.php';
 107+ $wgAutoloadClasses['SpecialBannerController'] = $specialDir . 'SpecialBannerController.php';
108108
109109 $wgSpecialPages['HideBanners'] = 'SpecialHideBanners';
110 - $wgAutoloadClasses['SpecialHideBanners'] = $dir . 'SpecialHideBanners.php';
 110+ $wgAutoloadClasses['SpecialHideBanners'] = $specialDir . 'SpecialHideBanners.php';
111111
112 - $wgAutoloadClasses['CentralNotice'] = $dir . 'SpecialCentralNotice.php';
 112+ $wgAutoloadClasses['CentralNotice'] = $specialDir . 'SpecialCentralNotice.php';
113113 $wgAutoloadClasses['CentralNoticeDB'] = $dir . 'CentralNotice.db.php';
114114 $wgAutoloadClasses['TemplatePager'] = $dir . 'TemplatePager.php';
115115
@@ -117,10 +117,10 @@
118118 $wgSpecialPageGroups['CentralNotice'] = 'wiki'; // Wiki data and tools"
119119
120120 $wgSpecialPages['NoticeTemplate'] = 'SpecialNoticeTemplate';
121 - $wgAutoloadClasses['SpecialNoticeTemplate'] = $dir . 'SpecialNoticeTemplate.php';
 121+ $wgAutoloadClasses['SpecialNoticeTemplate'] = $specialDir . 'SpecialNoticeTemplate.php';
122122
123123 $wgSpecialPages['BannerAllocation'] = 'SpecialBannerAllocation';
124 - $wgAutoloadClasses['SpecialBannerAllocation'] = $dir . 'SpecialBannerAllocation.php';
 124+ $wgAutoloadClasses['SpecialBannerAllocation'] = $specialDir . 'SpecialBannerAllocation.php';
125125 }
126126 }
127127
@@ -130,33 +130,37 @@
131131 global $wgDBtype, $wgExtNewTables, $wgExtNewFields;
132132
133133 if ( $wgDBtype == 'mysql' ) {
134 - $wgExtNewTables[] = array( 'cn_notices',
 134+ $wgExtNewTables[] = array( 'cn_notices',
135135 $base . '/CentralNotice.sql' );
136136 $wgExtNewFields[] = array( 'cn_notices', 'not_preferred',
137137 $base . '/patches/patch-notice_preferred.sql' );
138 - $wgExtNewTables[] = array( 'cn_notice_languages',
 138+ $wgExtNewTables[] = array( 'cn_notice_languages',
139139 $base . '/patches/patch-notice_languages.sql' );
140 - $wgExtNewFields[] = array( 'cn_templates', 'tmp_display_anon',
 140+ $wgExtNewFields[] = array( 'cn_templates', 'tmp_display_anon',
141141 $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',
143145 $base . '/patches/patch-notice_countries.sql' );
144 - $wgExtNewTables[] = array( 'cn_notice_projects',
 146+ $wgExtNewTables[] = array( 'cn_notice_projects',
145147 $base . '/patches/patch-notice_projects.sql' );
146148 }
147149 } else {
148150 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 ) );
161165 }
162166 }
163167 return true;
@@ -167,7 +171,7 @@
168172
169173 // Include '.js' to exempt script from squid cache override
170174 $centralLoader = SpecialPage::getTitleFor( 'BannerController' )->getLocalUrl( 'cache=/cn.js' );
171 -
 175+
172176 // Insert the banner controller Javascript into the <head>
173177 $wgOut->addScriptFile( $centralLoader );
174178
Property changes on: branches/wmf/1.17wmf1/extensions/CentralNotice/CentralNotice.php
___________________________________________________________________
Added: svn:mergeinfo
175179 Merged /branches/wmf-deployment/extensions/CentralNotice/CentralNotice.php:r60970
176180 Merged /branches/wmf/1.16wmf4/extensions/CentralNotice/CentralNotice.php:r67177,69199,76243,77266
177181 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
178182 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

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r76455Small bugfixes for mergesort functionality.diederik16:39, 10 November 2010
r80805Add missing global...reedy10:29, 23 January 2011
r83564Syncing up to head of trunk from r81460tomasz02:32, 9 March 2011

Status & tagging log