Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -3823,6 +3823,12 @@ |
3824 | 3824 | $wgAPIMaxUncachedDiffs = 1; |
3825 | 3825 | |
3826 | 3826 | /** |
| 3827 | + * Log file or URL (TCP or UDP) to log API requests to, or false to disable |
| 3828 | + * API request logging |
| 3829 | + */ |
| 3830 | +$wgAPIRequestLog = false; |
| 3831 | + |
| 3832 | +/** |
3827 | 3833 | * Parser test suite files to be run by parserTests.php when no specific |
3828 | 3834 | * filename is passed to it. |
3829 | 3835 | * |
Index: trunk/phase3/api.php |
— | — | @@ -38,6 +38,7 @@ |
39 | 39 | require (dirname(__FILE__) . '/includes/WebStart.php'); |
40 | 40 | |
41 | 41 | wfProfileIn('api.php'); |
| 42 | +$starttime = microtime( true ); |
42 | 43 | |
43 | 44 | // URL safety checks |
44 | 45 | // |
— | — | @@ -118,9 +119,21 @@ |
119 | 120 | wfDoUpdates(); |
120 | 121 | |
121 | 122 | // Log what the user did, for book-keeping purposes. |
| 123 | +$endtime = microtime( true ); |
122 | 124 | wfProfileOut('api.php'); |
123 | 125 | wfLogProfilingData(); |
124 | 126 | |
| 127 | +// Log the request |
| 128 | +if ( $wgAPIRequestLog ) { |
| 129 | + wfErrorLog( implode( ',', array( |
| 130 | + wfTimestamp( TS_MW ), |
| 131 | + $endtime - $starttime, |
| 132 | + wfGetIP(), |
| 133 | + wfArrayToCGI( $wgRequest->getValues() ) |
| 134 | + ) ) . "\n", $wgAPIRequestLog ); |
| 135 | + wfDebug( "Logged API request to $wgAPIRequestLog\n" ); |
| 136 | +} |
| 137 | + |
125 | 138 | // Shut down the database |
126 | 139 | wfGetLBFactory()->shutdown(); |
127 | 140 | |