r73973 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73972‎ | r73973 | r73974 >
Date:19:06, 29 September 2010
Author:kaldari
Status:resolved (Comments)
Tags:
Comment:
disabling geolookup if unneeded
Modified paths:
  • /trunk/extensions/CentralNotice/CentralNotice.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/CentralNotice.php
@@ -145,8 +145,11 @@
146146
147147 $centralLoader = SpecialPage::getTitleFor( 'BannerController' )->getLocalUrl();
148148
149 - // Insert the geo IP lookup into the <head>
150 - $wgOut->addScriptFile( 'http://geoiplookup.wikimedia.org/' );
 149+ $dbr = wfGetDB( DB_SLAVE );
 150+ $row = $dbr->selectRow( 'cn_notices', 'not_name', array( 'not_enabled = 1', 'not_geo = 1' ) );
 151+ if ( $row ) {
 152+ $wgOut->addScriptFile( 'http://geoiplookup.wikimedia.org/' );
 153+ }
151154
152155 // Insert the banner controller Javascript into the <head>
153156 $wgOut->addScriptFile( $centralLoader );

Follow-up revisions

RevisionCommit summaryAuthorDate
r73974restoring comment accidently deleted in r73973kaldari19:08, 29 September 2010

Comments

#Comment by Catrope (talk | contribs)   16:10, 3 October 2010

This is very nice, but it does seem to break assumptions in other JS about Geo always being defined.

#Comment by Kaldari (talk | contribs)   20:43, 4 October 2010

fixed in r74272. Now that it's loaded at the bottom of the page, geo lookup slowness won't be an issue.

Status & tagging log