Wikia code/includes/SquidUpdate.php
< Wikia code | includes
This page is obsolete. It is being retained for archival purposes. It may document extensions or features that are obsolete and/or no longer supported. Do not rely on the information here being up-to-date. The information shown below refers to the now unmaintained 1.16 MediaWiki release. The current stable release number is 1.43.0. |
--- D:\Programming\SVN\mediawiki\branches\REL1_16\phase3\includes\SquidUpdate.php 2011-07-18 22:31:28.263671900 +0100
+++ D:\Programming\SVN\wikia\trunk\includes\SquidUpdate.php 2011-08-17 15:28:46.624023400 +0100
@@ -82,6 +82,7 @@
static function purge( $urlArr ) {
global $wgSquidServers, $wgHTCPMulticastAddress, $wgHTCPPort;
+ global $wgPurgeSquidViaStomp, $wgPurgeSquidViaScribe;
/*if ( (@$wgSquidServers[0]) == 'echo' ) {
echo implode("<br />\n", $urlArr) . "<br />\n";
@@ -92,6 +93,13 @@
return;
}
+
+ if( $wgPurgeSquidViaScribe ) {
+ SquidUpdate::ScribePurge( $urlArr );
+ return true;
+ }
+
+
if ( $wgHTCPMulticastAddress && $wgHTCPPort ) {
return SquidUpdate::HTCPPurge( $urlArr );
}
@@ -181,6 +189,44 @@
}
/**
+ * wikia function
+ * @
+ * @access public
+ * @static
+ */
+ static function ScribePurge( $urlArr ) {
+ global $wgEnableScribeReport;
+ wfProfileIn( __METHOD__ );
+ $key = 'varnish_purges';
+
+ if ( empty($wgEnableScribeReport) ) {
+ wfProfileOut( __METHOD__ );
+ return true;
+ }
+
+ try {
+ foreach ( $urlArr as $url ) {
+ if ( !is_string( $url ) ) {
+ throw new MWException( 'Bad purge URL' );
+ }
+ $url = SquidUpdate::expand( $url );
+
+ wfDebug( "Purging URL $url via Scribe\n" );
+ $data = Wikia::json_encode( array('url' => $url,
+ 'time' => time(),
+ )
+ );
+ WScribeClient::singleton($key)->send($data);
+ }
+ }
+ catch( TException $e ) {
+ Wikia::log( __METHOD__, 'scribeClient exception', $e->getMessage() );
+ }
+
+ wfProfileOut( __METHOD__ );
+ }
+
+ /**
* Expand local URLs to fully-qualified URLs using the internal protocol
* and host defined in $wgInternalServer. Input that's already fully-
* qualified will be passed through unchanged.