Wikia code/includes/WebStart.php
From MediaWiki.org
< Wikia code | includes
Merged first diff here: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97330 (and deleted it from the area below).
Are hooks ready by the point where we get to the last diff here? If so, that should be in a hook.
--- D:\Programming\SVN\mediawiki\branches\REL1_16\phase3\includes\WebStart.php 2011-07-18 22:31:28.171875000 +0100 +++ D:\Programming\SVN\wikia\trunk\includes\WebStart.php 2011-08-17 15:28:46.533203100 +0100 @@ -45,7 +45,7 @@ } else { $wgRUstart = array(); } -unset( $IP ); +#--- removed by eloy, make harm in our directory layout --- unset( $IP ); # Valid web server entry point, enable includes. # Please don't move this line to includes/Defines.php. This line essentially @@ -131,3 +131,26 @@ if ( !defined( 'MW_NO_SETUP' ) ) { require_once( "$IP/includes/Setup.php" ); } + +if(is_object($wgRequest) && $wgRequest->wasPosted() && wfReadOnly()) { + if ( + ( strpos(strtolower($_SERVER['SCRIPT_URL']), 'datacenter') === false ) && + ( strpos(strtolower($_SERVER['SCRIPT_URL']), 'api.php') === false ) + ) { + +$js = <<<EOD +<script type="text/javascript"> +var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); +document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); +</script> +<script type="text/javascript"> +try { +var pageTracker = _gat._getTracker("UA-288915-41"); +pageTracker._trackEvent("error", "PostInReadOnly"); +} catch(err) {}</script> +EOD; + echo "<html><head>{$js}</head><body>{$wgReadOnly}</body></html>"; + die(-1); + + } +}