There is something about this patch that doesn't sit right with me... Why can't you just do a pre/page:store hook to grab the old content, save it in memory, and then diff it with current content in a post/page:store hook?
What am I missing? Some race condition? Cheers, Brian On 15/05/05 15:47 +0530, Joshua N Pritikin wrote: > On Sun, 2005-05-15 at 15:18 +0530, Joshua N Pritikin wrote: > > I want to add a hook before store_content_commit or after > > store_content_prepare to run "diff -u file.new file | mail ...". > > To make this concrete, here is a Kwiki::Notify::Mail patch. > > -- > If you are an American then support http://fairtax.org > (Permanently replace 50,000+ pages of tax law with about 200 pages.) > --- Mail.pm Wed Jan 26 02:19:23 2005 > +++ /usr/local/share/perl/5.8.4/Kwiki/Notify/Mail.pm Sun May 15 15:36:46 2005 > @@ -21,9 +21,8 @@ > > sub register { > my $registry = shift; > - $registry->add(hook => 'page:store', > - post => 'notify', > - ); > + $registry->add(hook => 'page:store_content_commit', > + pre => 'notify'); > } > > sub notify { > @@ -43,7 +42,10 @@ > $page_name, > $edited_by) || 'unknown'; > > - my $body = "$site_title page $page_name edited by $edited_by\n"; > + my $body = "$site_title page $page_name edited by $edited_by\n\n"; > + > + my $file_path = $self->file_path; > + $body .= `diff --text -bBiu $file_path $file_path.new`; > > $notify_mail_obj->mail_it($to,$from,$subject,$body); > return $self;
