r105453 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105452‎ | r105453 | r105454 >
Date:19:23, 7 December 2011
Author:krinkle
Status:ok
Tags:
Comment:
[HarvardResearch] Disable by default.

Also, static mw.config demo is now on:
https://test.wikipedia.org/w/index.php?title=Special:NoticeTemplate/view&template=Harvard_prototype
Modified paths:
  • /trunk/extensions/CentralNotice/CentralNotice.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/CentralNotice.php
@@ -94,8 +94,11 @@
9595 'scripts' => 'bannerstats.js',
9696 );
9797
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+);
100103
101104 /**
102105 * UnitTestsList hook handler
@@ -247,7 +250,7 @@
248251 */
249252 function efCentralNoticeDefaults( &$vars ) {
250253 // Using global $wgUser for compatibility with 1.18
251 - global $wgNoticeProject, $wgUser, $wgMemc;
 254+ global $wgNoticeProject, $wgUser, $wgMemc, $wgNoticeBanner_Harvard2011, $wgContLang;
252255
253256 // Initialize global Javascript variables. We initialize Geo with empty values so if the geo
254257 // IP lookup fails we don't have any surprises.
@@ -258,7 +261,7 @@
259262 // XXX: Temporary WMF-specific code for the 2011 Harvard survey invitation banner.
260263 // Only do this for logged-in users, keeping anonymous user output equal (for Squid-cache).
261264 // 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' ) ) {
263266
264267 $cacheKey = wfMemcKey( 'CentralNotice', 'Harvard2011', 'v1', $wgUser->getId() );
265268 $value = $wgMemc->get( $cacheKey );
@@ -278,13 +281,12 @@
279282 $value = false;
280283
281284 } else {
282 - global $wgNoticeBanner_Harvard2011_salt, $wgContLang;
283285
284286 $launchTimestamp = wfTimestamp( TS_UNIX, '2011-12-08 00:00:00' );
285287 $groups = $wgUser->getGroups();
286288 $registrationDate = $wgUser->getRegistration() ? $wgUser->getRegistration() : 0;
287289 $daysOld = floor( ( $launchTimestamp - wfTimestamp( TS_UNIX, $registrationDate ) ) / ( 60*60*24 ) );
288 - $salt = $wgNoticeBanner_Harvard2011_salt;
 290+ $salt = $wgNoticeBanner_Harvard2011['salt'];
289291
290292 // Variables
291293 $hashData = array(

Follow-up revisions

RevisionCommit summaryAuthorDate
r105588CentralNotice MFT r105239, 105241, r105267, r105450, r105452, r105453, r105586reedy20:57, 8 December 2011

Status & tagging log