r102134 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102133‎ | r102134 | r102135 >
Date:00:41, 6 November 2011
Author:khorn
Status:ok
Tags:
Comment:
Adds the ability to log out out communication stats, through the regular logging functions.
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php
@@ -1242,25 +1242,46 @@
12431243 * @param type $vars
12441244 */
12451245 function saveCommunicationStats( $function = '', $additional = '', $vars = '' ) {
1246 - $params = array();
1247 - if ( self::getGlobal( 'SaveCommStats' ) ) {
 1246+ static $saveStats = null;
 1247+ static $saveDB = null;
 1248+
 1249+ if ( $saveStats === null ){
 1250+ $saveStats = self::getGlobal( 'SaveCommStats' );
 1251+ }
 1252+
 1253+ if ( !$saveStats ){
 1254+ return;
 1255+ }
 1256+
 1257+ if ( $saveDB === null ){
12481258 $db = ContributionTrackingProcessor::contributionTrackingConnection();
1249 -
1250 - //TODO: Actually define this table somewhere in the code, once we
1251 - //are reasonably certain we know what we want to see in it.
1252 - if ( !( $db->tableExists( 'communication_stats' ) ) ) {
1253 - return;
 1259+ if ( $db->tableExists( 'communication_stats' ) ) {
 1260+ $saveDB = true;
 1261+ } else {
 1262+ $saveDB = false;
12541263 }
1255 -
1256 - $params['contribution_id'] = $this->dataObj->getVal( 'contribution_tracking_id' );
 1264+ }
 1265+
 1266+ $params = array(
 1267+ 'contribution_id' => $this->dataObj->getVal( 'contribution_tracking_id' ),
 1268+ 'duration' => $this->getStopwatch( $function ),
 1269+ 'gateway' => self::getGatewayName(),
 1270+ 'function' => $function,
 1271+ 'vars' => $vars,
 1272+ 'additional' => $additional,
 1273+ );
 1274+
 1275+ if ( $saveDB ){
 1276+ $db = ContributionTrackingProcessor::contributionTrackingConnection();
12571277 $params['ts'] = $db->timestamp();
1258 - $params['duration'] = $this->getStopwatch( __FUNCTION__ );
1259 - $params['gateway'] = self::getGatewayName();
1260 - $params['function'] = $function;
1261 - $params['vars'] = $vars;
1262 - $params['additional'] = $additional;
1263 -
12641278 $db->insert( 'communication_stats', $params );
 1279+ } else {
 1280+ //save to syslog. But which syslog?
 1281+ $msg = '';
 1282+ foreach ($params as $key=>$val){
 1283+ $msg .= "$key:$val - ";
 1284+ }
 1285+ self::log($msg, LOG_INFO, '_commstats');
12651286 }
12661287 }
12671288

Follow-up revisions

RevisionCommit summaryAuthorDate
r102236MFT r90286, r100671, r100837, r100950, r101060, r101063, r101064, r101073, r1......khorn03:06, 7 November 2011
r102237MFT r90286, r100671, r100837, r100950, r101060, r101063, r101064, r101073, r1......khorn03:07, 7 November 2011

Status & tagging log