Ori.livneh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/116881

Change subject: Make GeoIP script URL configurable
......................................................................

Make GeoIP script URL configurable

* Replace hard-coded '//bits.wikimedia.org/geoiplookup' with a
  configuration variable, $wgCentralGeoScriptURL, that is set to
  that value by default.
* When unset or false, no <script> tag will be injected.
* This fulfills a TODO :)
* With change I1a08c81da in place, we could set $wgCentralGeoScriptURL
  to false on the beta cluster.

Change-Id: I7154b8de671ed8cfcdf6d880eab9e34d09a21949
(cherry picked from commit a71221d1b093556e56bffea182358af0f8628164)
---
M CentralNotice.hooks.php
M CentralNotice.php
2 files changed, 10 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice 
refs/changes/81/116881/1

diff --git a/CentralNotice.hooks.php b/CentralNotice.hooks.php
index 66ccbbd..8afd800 100644
--- a/CentralNotice.hooks.php
+++ b/CentralNotice.hooks.php
@@ -181,10 +181,13 @@
  * @return bool
  */
 function efCentralNoticeLoader( $out, $skin ) {
-       global $wgCentralHost;
+       global $wgCentralHost, $wgCentralGeoScriptURL;
+
        // Insert the geoIP lookup
-       // TODO: Make this url configurable
-       $out->addHeadItem( 'geoip', '<script 
src="//bits.wikimedia.org/geoiplookup"></script>' );
+       if ( is_string( $wgCentralGeoScriptURL ) ) {
+               $out->addHeadItem( 'geoip', '<script src="' . htmlspecialchars( 
$wgCentralGeoScriptURL ) . '"></script>' );
+       }
+
        // Insert DNS prefetch for banner loading
        if ( $wgCentralHost ) {
                $out->addHeadItem( 'dns-prefetch', '<link rel="dns-prefetch" 
href="' . htmlspecialchars( $wgCentralHost ) . '" />' );
diff --git a/CentralNotice.php b/CentralNotice.php
index 0fa4357..d95ac96 100644
--- a/CentralNotice.php
+++ b/CentralNotice.php
@@ -77,6 +77,10 @@
 // when on a different subdomain than the wiki.
 $wgCentralHost = false;
 
+// URL of geolocation-data-laden script to inject via a <script> tag in <head>.
+// If false, do not inject a script tag.
+$wgCentralGeoScriptURL = '//bits.wikimedia.org/geoiplookup';
+
 // The script path on the wiki that hosts the CentralNotice infrastructure
 // For example 'http://meta.wikimedia.org/w/index.php'
 $wgCentralPagePath = false;

-- 
To view, visit https://gerrit.wikimedia.org/r/116881
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7154b8de671ed8cfcdf6d880eab9e34d09a21949
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: wmf_deploy
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to