From 4ab130b023f86c6dd4ff087ae84ce925c2c4542c Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Mon, 30 Jan 2006 15:40:46 +0000 Subject: [PATCH] remove memcached polution ... ah, and namespace notices on the way --- includes/GlobalFunctions.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index fc5dd5c627..a300252836 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -406,11 +406,9 @@ function wfMsgNoDBForContent( $key ) { */ function wfMsgReal( $key, $args, $useDB, $forContent=false, $transform = true ) { $fname = 'wfMsgReal'; - wfProfileIn( $fname ); $message = wfMsgGetKey( $key, $useDB, $forContent, $transform ); $message = wfMsgReplaceArgs( $message, $args ); - wfProfileOut( $fname ); return $message; } @@ -1429,8 +1427,7 @@ function wfGetSiteNotice() { $siteNotice = $anonNotice; } } - $siteNotice .= wfGetNamespaceNotice(); - + wfProfileOut( $fname ); return( $siteNotice ); } @@ -1604,6 +1601,19 @@ function wfMkdirParents( $fullDir, $mode ) { */ function wfIncrStats( $key ) { global $wgDBname, $wgMemc; + /* LIVE HACK AVOID MEMCACHED ACCESSES DURING HIGH LOAD */ + if ($wgDBname != 'enwiki' and $wgDBname != 'dewiki' and $wgDBname != 'commonswiki' and $wgDBname != 'testwiki') + return true; + static $socket; + if (!$socket) { + $socket=socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); + $statline="{$wgDBname} - 1 1 1 1 1 -total\n"; + socket_sendto($socket,$statline,strlen($statline),0,"webster","3811"); + } + $statline="{$wgDBname} - 1 1 1 1 1 {$key}\n"; + socket_sendto($socket,$statline,strlen($statline),0,"webster","3811"); + return true; + $key = "$wgDBname:stats:$key"; if ( is_null( $wgMemc->incr( $key ) ) ) { $wgMemc->add( $key, 1 ); -- 2.20.1