The patch can be applied as follows:
In the subroutine DoPost add the following line in this context:
$user = &GetParam("username", ""); # If the person doing editing chooses, send out email notification if ($EmailNotify) { &EmailNotify($id, $user) if &GetParam("do_email_notify", "") eq 'on'; } &SubscriberNotify($id,$user); # ADD THIS LINE if (&GetParam("recent_edit", "") eq 'on') { $isEdit = 1; }
Then, towards the end of the wiki.pl file add the following two routines:
sub GetPageText { my ($fname) = @_; my (%MyPage) = (); my (%MySection) = (); my (%MyText) = (); my ($retText) = ""; if (-f $fname) { my ($data) = &ReadFileOrDie($fname); %MyPage = split(/$FS1/,$data,-1); %MySection = split(/$FS2/,$MyPage{'text_default'},-1); %MyText = split(/$FS3/,$MySection{'data'},-1); $retText = $MyText{'text'}; } return $retText; } sub SubscriberNotify { local $/ = "\n"; # don't slurp whole files in this sub. return if (&GetParam("recent_edit","") eq 'on'); my ($id, $user) = @_; my @subscribers; my ($mailFile) = &GetPageFile("$id/Mail"); if (-r $mailFile) { my ($pageText) = &GetPageText($mailFile); @subscribers = grep /^[ \t]*[^ \t]*\@[^ \t]*[ \t]*$/, split(/[ \t\n]/,$pageText); if ($#subscribers >= 0) { my $toAddress = join(",",@subscribers); my $home_url = $q->url(); my $page_url = $home_url . "?$id"; my $editors_summary = $q->param("summary"); if (($editors_summary eq "*") or ($editors_summary eq "")){ $editors_summary = ""; } else { $editors_summary = "\n Summary: $editors_summary"; } my $content = <<"END_MAIL_CONTENT"; The $SiteName page $id at $page_url has been changed by $user to revision $Page{revision}. $editors_summary To remove yourself from this list, edit ${page_url}/Mail END_MAIL_CONTENT my $subject = "The $id page at $SiteName has been changed."; # I'm setting the "reply-to" field to be the same as the "to:" field # which seems appropriate for a mailing list, especially since the # $EmailFrom string needn't be a real email address. &SendEmail($toAddress, $EmailFrom, "", $subject, $content); } } }
Just before the #END_OF_OTHER_CODE comment near the end of the file.