CentralNotice

From Wikitech
Revision as of 20:27, 26 September 2012 by Kaldari (Talk | contribs)

Jump to: navigation, search

CentralNotice is a message managment extension used extensively during the annual WikiMedia fundraiser along with various campaigns that the foundation and chapters are involved with.

Contents

Operations

Disabling & Re-enabling CentralNotice

To disable CentralNotice, do the following:

  • Login to fenari
  • Edit the InitialiseSettings.php file
  • cd /home/wikipedia/common/wmf-config && vim InitialiseSettings.php
  • Locate the section wmgUseCentralNotice
  • Comment out all lines that set a wiki to true, EXCEPT first entry default
  • Set default to false.
  • Save changes and sync out the file:
  • sync-file InitialiseSettings.php 'disabling CentralNotice'

To re-enable it, just uncomment the lines you commented out, and put true for default

Caching

Special:BannerListLoader is excluded from the normal Squid cache header override. This is accomplished by having "cache=/cn.js" in the URL, which matches a regex filter on the Squid side. The BannerListLoader is normally cached for 5 minutes on the server side and 5 minutes on the client side.

Special:BannerLoader is subject to the normal Squid cache header override. It is cached for 10 minutes on the server side and not cached at all on the client side.

The way that banners are delivered to the client is somewhat complicated, mainly due to the requirement that banners be geotargetable. The following is a brief explanation of the process. On every wiki page request, there are several things that get loaded for CentralNotice:

  • First, a direct call to bits.wikimedia.org/geoiplookup to load the GeoIP info - this happens in the head. bits.wikimedia.org/geoiplookup just returns a 1 line JS statement that sets the global Geo variable, including the important bit - Geo.country. IPv6 lookups are not yet supported.
  • Next, it loads bannerController.js through a ResourceLoader module, also in the head. bannerController.js doesn't have any self executing code, it's just a bunch of function definitions.
  • Next, as soon as the siteNotice div loads in the page, it calls the initialize function from bannerController.js. This causes bannerController.js to make an AJAX request for for the BannerListLoader (which has a URL like https://en.wikipedia.org/w/index.php?cache=%2Fcn.js&title=Special%3ABannerListLoader&language=en&project=wikipedia&country=US). The BannerListLoader returns a JSON string with the banners that the user is eligible to see. This file is supposed to be cached for 5 minutes on the server side and 5 minutes on the client side.
  • BannerController then processes this list and makes a JSON-P request to the BannerLoader on meta wiki. The BannerLoader returns a JS statement to load a banner through a callback function in the BannerController.

Issues

Cache-Control headers

As of January 2011, the Cache-Control headers for Special:BannerController and Special:BannerListLoader are invalid. Specifically, they have an extra max-age parameter added by Apache. Due to this problem, banner lists may be cached by some browsers for 4 days instead of 10 minutes. See Bug 26338.

Memcached failure

If there is a memcached lookup failure when a banner is requested, the banner will not be shown. Instead, the Special:BannerLoader file will load with just the JavaScript comment "/* Failed cache lookup */". No error or other output from CentralNotice will be shown to the user.

If this happens:

  • Identify which memcached node/s is the problematic one by running php /home/wikipedia/common/php-1.5/maintenance/mctest.php on a host that has nfs mounted.
  • For each host listed with a get: 0 time remove them from /home/wikipedia/common/php-1.5/mc-pmtpa.php and replace with a spare.
  • sync-file to the cluster

GeoIP lookup failure

CentralNotice adds a GeoIP lookup to the head of each page request. Once the lookup is completed, the rest of the JavaScript gets executed and the banner is displayed. If the GeoIP lookup fails, it may block the execution of other JavaScript or delay loading the page. If this is a chronic problem, it may be necessary to increase caching for the GeoIP lookups or to completely disable CentralNotice.

Banners bump down page content after page has loaded

See /Optimizing banner loading

Personal tools
Namespaces

Variants
Actions
Navigation
Ops documentation
Wiki
Toolbox