Last modified: 2011-03-13 18:06:41 UTC
I propose to add an extension hook for RC notification. The current option of sending UDP packets is not very flexible, and different ways of notification would sometimes be helpful. The following functionality is included in the patch: * infrastructure for generic RC notification hooks. Each hook can also have arbitrary, per-instance configuration (port, etc) * UDP notification as before * Writing notifications to a file (or, more sensibly, to a fifo) * Three different formats: human-readable colorized (like is currently done), plain text, and CSV It would thus be for instance possible to send notifications to a separate IRC channel in a format that can be parsed more easily by scripts (I know of at least two scripts that currently parse the RC channels). For low-traffic sites, extensions for notification via e-mail, jabber, etc could be plugged in easily, as opposed to hacking the core code. patch to follow in a minute
Created attachment 964 [details] patch for DefaultSettings.php, RecentChange.php, and Setup.php - includes compatibility hack
Created attachment 972 [details] revamped this patch to use wfRunHooks. Moved all notification code into an extension. This only removes functionality from the main code. A patch containing extensions to handle rc notifications will follow in a minute.
Created attachment 973 [details] extensions to handle rc notification via UDP and plain file output. Patched against a dummy, not CVS. This provides a base class for hooks (RCHook.php) and two implementations (RC2UDP.php and RC2File.php) that handle RC-notifications. They can be used like this: $wgHooks['RecentChange'][] = new RC2UDP('localhost', 6666, array( 'prefix' => $wgSitename . ": ", 'colorize' => true, 'suffix' => "\n" ) ); $wgHooks['RecentChange'][] = new RC2File('/var/log/pub/testwiki.rc', array( 'csv' => true ) ); The first one would send UDP packets that are compatible with the current UDP nitification mechanism. The second would fill a file (or fifo) with entries in CSV format. Other combinations are possible.
RC2Email.php works. //the rc hook for emails I sent it to Daniel. I'm going to rewrite one part to use UserMailer.php instead of just using mail() - and perhaps I'll add formatting options. If you really want this code now (and you aren't picky about how it looks) - email me. - Mick
Created attachment 984 [details] extensions to handle rc notification via UDP and plain file output. Patched against a dummy, not CVS. removed print_r that was left over from debugging. oops!
Security review: * Remote code execution: RC2File.php, RC2UDP.php use an undefined variable as the prefix of a require_once, with no execution guard. Systems with register_globals on may be seriously compromised through these files. * Information disclosure: RC2File.php, RC2UDP.php will show error messages including local path information if executed via web with display_errors on. Compatibility review: * All files should use full PHP open tags (<?php, not <?) or they won't work on systems with short tags disabled Style review: * Some instances of "$a= $b" where "$a = $b" is expected * "else if" sometimes used where "elseif" is expected * Inconsistent parenthesis spacing Patch fails security review; needs fixing.
No activity in nearly 3 years, closing as WONTFIX.