Localisation updates for core messages from translatewiki.net (2009-09-23 21:48 UTC)
[lhc/web/wiklou.git] / api.php
diff --git a/api.php b/api.php
index 6c32baa..ae40c6b 100644 (file)
--- a/api.php
+++ b/api.php
@@ -38,6 +38,7 @@
 require (dirname(__FILE__) . '/includes/WebStart.php');
 
 wfProfileIn('api.php');
+$starttime = microtime( true );
 
 // URL safety checks
 //
@@ -118,9 +119,28 @@ $processor->execute();
 wfDoUpdates();
 
 // Log what the user did, for book-keeping purposes.
+$endtime = microtime( true );
 wfProfileOut('api.php');
 wfLogProfilingData();
 
+// Log the request
+if ( $wgAPIRequestLog ) {
+       $items = array(
+                       wfTimestamp( TS_MW ),
+                       $endtime - $starttime,
+                       wfGetIP(),
+                       $_SERVER['HTTP_USER_AGENT']
+       );
+       $items[] = $wgRequest->wasPosted() ? 'POST' : 'GET';
+       if ( $processor->getModule()->mustBePosted() ) {
+               $items[] = "action=" . $wgRequest->getVal( 'action' );
+       } else {
+               $items[] = wfArrayToCGI( $wgRequest->getValues() );
+       }
+       wfErrorLog( implode( ',', $items ) . "\n", $wgAPIRequestLog );
+       wfDebug( "Logged API request to $wgAPIRequestLog\n" );
+}
+
 // Shut down the database
 wfGetLBFactory()->shutdown();