$wgRateLimitLog is meant to log rate limiting occuring in MediaWiki. The
feature was introduced by
e46d19e72d3 / r9202 in 2005. We might not
have wfDebugLog() at that time and we used error_log() with the global
pointing to a file. A later patch converted to file_put_contents().
On Wikimedia production the variable is set to a udp:// URL, I am not
sure file_put_contents() can write to it. Additionally the warning are
suppressed which I tend to hate.
Instead use the log bucket 'ratelimit'.
For backcompabitilibity purposes, if $wgRateLmitLog is still set:
attempt to set $wgDebugLogGroup['ratelimit'] with its value.
Change-Id: I86131c4a8053800afd9f41fa1906c998a88736c6
/**
* Set to a filename to log rate limiter hits.
+ *
+ * @deprecated since 1.23, use $wgDebugLogGroups['ratelimit'] instead
*/
$wgRateLimitLog = null;
);
}
+// Back compatibility for $wgRateLimitLog deprecated with 1.23
+if ( $wgRateLimitLog && ! array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) {
+ $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog;
+}
+
wfProfileOut( $fname . '-defaults2' );
wfProfileIn( $fname . '-misc1' );
return false;
}
- global $wgMemc, $wgRateLimitLog;
+ global $wgMemc;
wfProfileIn( __METHOD__ );
$limits = $wgRateLimits[$action];
// Already pinged?
if ( $count ) {
if ( $count >= $max ) {
- wfDebug( __METHOD__ . ": tripped! $key at $count $summary\n" );
- if ( $wgRateLimitLog ) {
- wfSuppressWarnings();
- file_put_contents( $wgRateLimitLog, wfTimestamp( TS_MW ) . ' ' . wfWikiID() . ': ' . $this->getName() . " tripped $key at $count $summary\n", FILE_APPEND );
- wfRestoreWarnings();
- }
+ wfDebugLog( 'ratelimit', $this->getName() . " tripped! $key at $count $summary");
$triggered = true;
} else {
wfDebug( __METHOD__ . ": ok. $key at $count $summary\n" );