| Index: trunk/extensions/CentralNotice/CentralNotice.php |
| — | — | @@ -94,8 +94,11 @@ |
| 95 | 95 | 'scripts' => 'bannerstats.js', |
| 96 | 96 | ); |
| 97 | 97 | |
| 98 | | -// Temporary setting to configure salt for Harvard banner protocol |
| 99 | | -$wgNoticeBanner_Harvard2011_salt = 'default'; |
| | 98 | +// Temporary setting to enable and configure info for Harvard banner on en.wikipedia.org |
| | 99 | +$wgNoticeBanner_Harvard2011 = array( |
| | 100 | + 'enable' => false, |
| | 101 | + 'salt' => 'default', |
| | 102 | +); |
| 100 | 103 | |
| 101 | 104 | /** |
| 102 | 105 | * UnitTestsList hook handler |
| — | — | @@ -247,7 +250,7 @@ |
| 248 | 251 | */ |
| 249 | 252 | function efCentralNoticeDefaults( &$vars ) { |
| 250 | 253 | // Using global $wgUser for compatibility with 1.18 |
| 251 | | - global $wgNoticeProject, $wgUser, $wgMemc; |
| | 254 | + global $wgNoticeProject, $wgUser, $wgMemc, $wgNoticeBanner_Harvard2011, $wgContLang; |
| 252 | 255 | |
| 253 | 256 | // Initialize global Javascript variables. We initialize Geo with empty values so if the geo |
| 254 | 257 | // IP lookup fails we don't have any surprises. |
| — | — | @@ -258,7 +261,7 @@ |
| 259 | 262 | // XXX: Temporary WMF-specific code for the 2011 Harvard survey invitation banner. |
| 260 | 263 | // Only do this for logged-in users, keeping anonymous user output equal (for Squid-cache). |
| 261 | 264 | // Also, don't run if the UserDailyContribs-extension isn't installed. |
| 262 | | - if ( $wgUser->isLoggedIn() && function_exists( 'getUserEditCountSince' ) ) { |
| | 265 | + if ( $wgNoticeBanner_Harvard2011['enable'] && $wgUser->isLoggedIn() && function_exists( 'getUserEditCountSince' ) ) { |
| 263 | 266 | |
| 264 | 267 | $cacheKey = wfMemcKey( 'CentralNotice', 'Harvard2011', 'v1', $wgUser->getId() ); |
| 265 | 268 | $value = $wgMemc->get( $cacheKey ); |
| — | — | @@ -278,13 +281,12 @@ |
| 279 | 282 | $value = false; |
| 280 | 283 | |
| 281 | 284 | } else { |
| 282 | | - global $wgNoticeBanner_Harvard2011_salt, $wgContLang; |
| 283 | 285 | |
| 284 | 286 | $launchTimestamp = wfTimestamp( TS_UNIX, '2011-12-08 00:00:00' ); |
| 285 | 287 | $groups = $wgUser->getGroups(); |
| 286 | 288 | $registrationDate = $wgUser->getRegistration() ? $wgUser->getRegistration() : 0; |
| 287 | 289 | $daysOld = floor( ( $launchTimestamp - wfTimestamp( TS_UNIX, $registrationDate ) ) / ( 60*60*24 ) ); |
| 288 | | - $salt = $wgNoticeBanner_Harvard2011_salt; |
| | 290 | + $salt = $wgNoticeBanner_Harvard2011['salt']; |
| 289 | 291 | |
| 290 | 292 | // Variables |
| 291 | 293 | $hashData = array( |