]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Added a "changes" hook. Renamed the "change" hook to "rendered", but
authorJoey Hess <joey@kitenet.net>
Wed, 28 Mar 2012 22:41:47 +0000 (18:41 -0400)
committerJoey Hess <joey@kitenet.net>
Wed, 28 Mar 2012 22:43:07 +0000 (18:43 -0400)
the old hook name is called for now for back-compat.

IkiWiki/Plugin/inline.pm
IkiWiki/Plugin/pinger.pm
IkiWiki/Plugin/po.pm
IkiWiki/Plugin/rsync.pm
IkiWiki/Plugin/skeleton.pm.example
IkiWiki/Plugin/transient.pm
IkiWiki/Render.pm
debian/changelog
doc/plugins/write.mdwn

index 62910972f9581c0b06e189994f56f0956df9a084..3b49152f41660ead826aea112152cf20b265b790 100644 (file)
@@ -26,7 +26,7 @@ sub import {
        # Hook to change to do pinging since it's called late.
        # This ensures each page only pings once and prevents slow
        # pings interrupting page builds.
        # Hook to change to do pinging since it's called late.
        # This ensures each page only pings once and prevents slow
        # pings interrupting page builds.
-       hook(type => "change", id => "inline", call => \&IkiWiki::pingurl);
+       hook(type => "rendered", id => "inline", call => \&IkiWiki::pingurl);
 }
 
 sub getopt () {
 }
 
 sub getopt () {
index ea4f3e0dc563bac69a999ed42b4884f48b1892a7..588f7a42a4698f6ce72e24b4647df2bedc862c7a 100644 (file)
@@ -13,7 +13,7 @@ sub import {
        hook(type => "needsbuild", id => "pinger", call => \&needsbuild);
        hook(type => "preprocess", id => "ping", call => \&preprocess);
        hook(type => "delete", id => "pinger", call => \&ping);
        hook(type => "needsbuild", id => "pinger", call => \&needsbuild);
        hook(type => "preprocess", id => "ping", call => \&preprocess);
        hook(type => "delete", id => "pinger", call => \&ping);
-       hook(type => "change", id => "pinger", call => \&ping);
+       hook(type => "rendered", id => "pinger", call => \&ping);
 }
 
 sub getsetup () {
 }
 
 sub getsetup () {
index 287b5aa11de37304a8d330f80894879618a166bd..26c6463dabf5705eeb870f2b44bfa51e1cafed59 100644 (file)
@@ -47,7 +47,7 @@ sub import {
        hook(type => "pagetemplate", id => "po", call => \&pagetemplate, last => 1);
        hook(type => "rename", id => "po", call => \&renamepages, first => 1);
        hook(type => "delete", id => "po", call => \&mydelete);
        hook(type => "pagetemplate", id => "po", call => \&pagetemplate, last => 1);
        hook(type => "rename", id => "po", call => \&renamepages, first => 1);
        hook(type => "delete", id => "po", call => \&mydelete);
-       hook(type => "change", id => "po", call => \&change);
+       hook(type => "rendered", id => "po", call => \&rendered);
        hook(type => "checkcontent", id => "po", call => \&checkcontent);
        hook(type => "canremove", id => "po", call => \&canremove);
        hook(type => "canrename", id => "po", call => \&canrename);
        hook(type => "checkcontent", id => "po", call => \&checkcontent);
        hook(type => "canremove", id => "po", call => \&canremove);
        hook(type => "canrename", id => "po", call => \&canrename);
@@ -427,7 +427,7 @@ sub mydelete (@) {
        map { deletetranslations($_) } grep istranslatablefile($_), @deleted;
 }
 
        map { deletetranslations($_) } grep istranslatablefile($_), @deleted;
 }
 
-sub change (@) {
+sub rendered (@) {
        my @rendered=@_;
 
        my $updated_po_files=0;
        my @rendered=@_;
 
        my $updated_po_files=0;
index e38801e4a110b0b9e4790935de65f08bce30441e..1b85ea000120846ca5426e97be3603425e83cb1f 100644 (file)
@@ -7,7 +7,7 @@ use IkiWiki 3.00;
 
 sub import {
        hook(type => "getsetup", id => "rsync", call => \&getsetup);
 
 sub import {
        hook(type => "getsetup", id => "rsync", call => \&getsetup);
-       hook(type => "change", id => "rsync", call => \&postrefresh);
+       hook(type => "rendered", id => "rsync", call => \&postrefresh);
        hook(type => "delete", id => "rsync", call => \&postrefresh);
 }
 
        hook(type => "delete", id => "rsync", call => \&postrefresh);
 }
 
index 7974d5e5325f396a6bd90cc446e239bed9a0c44f..956c522017902086f69bb03f646fab7bf18f487a 100644 (file)
@@ -26,7 +26,8 @@ sub import {
        hook(type => "templatefile", id => "skeleton", call => \&templatefile);
        hook(type => "pageactions", id => "skeleton", call => \&pageactions);
        hook(type => "delete", id => "skeleton", call => \&delete);
        hook(type => "templatefile", id => "skeleton", call => \&templatefile);
        hook(type => "pageactions", id => "skeleton", call => \&pageactions);
        hook(type => "delete", id => "skeleton", call => \&delete);
-       hook(type => "change", id => "skeleton", call => \&change);
+       hook(type => "rendered", id => "skeleton", call => \&rendered);
+       hook(type => "changes", id => "skeleton", call => \&changes);
        hook(type => "cgi", id => "skeleton", call => \&cgi);
        hook(type => "auth", id => "skeleton", call => \&auth);
        hook(type => "sessioncgi", id => "skeleton", call => \&sessioncgi);
        hook(type => "cgi", id => "skeleton", call => \&cgi);
        hook(type => "auth", id => "skeleton", call => \&auth);
        hook(type => "sessioncgi", id => "skeleton", call => \&sessioncgi);
@@ -167,10 +168,16 @@ sub delete (@) {
        debug("skeleton plugin told that files were deleted: @files");
 }
 
        debug("skeleton plugin told that files were deleted: @files");
 }
 
-sub change (@) {
+sub rendered (@) {
        my @files=@_;
 
        my @files=@_;
 
-       debug("skeleton plugin told that changed files were rendered: @files");
+       debug("skeleton plugin told that files were rendered: @files");
+}
+
+sub changes (@) {
+       my @files=@_;
+
+       debug("skeleton plugin told that files were changed: @files");
 }
 
 sub cgi ($) {
 }
 
 sub cgi ($) {
index c0ad5fc11476ef4442cb64e81c7f5580e3795942..4ea4317d4fde56e6eb2652f70fe0c773316d4290 100644 (file)
@@ -8,7 +8,7 @@ use IkiWiki 3.00;
 sub import {
        hook(type => "getsetup", id => "transient",  call => \&getsetup);
        hook(type => "checkconfig", id => "transient", call => \&checkconfig);
 sub import {
        hook(type => "getsetup", id => "transient",  call => \&getsetup);
        hook(type => "checkconfig", id => "transient", call => \&checkconfig);
-       hook(type => "change", id => "transient", call => \&change);
+       hook(type => "rendered", id => "transient", call => \&rendered);
 }
 
 sub getsetup () {
 }
 
 sub getsetup () {
@@ -33,7 +33,7 @@ sub checkconfig () {
        }
 }
 
        }
 }
 
-sub change (@) {
+sub rendered (@) {
        foreach my $file (@_) {
                # If the corresponding file exists in the transient underlay
                # and isn't actually being used, we can get rid of it.
        foreach my $file (@_) {
                # If the corresponding file exists in the transient underlay
                # and isn't actually being used, we can get rid of it.
index adb39a983475cd6107335c66568e4e4c87acb752..98aab82043073e7a0af80e14087308da8a0ee4ce 100644 (file)
@@ -829,8 +829,13 @@ sub refresh () {
                run_hooks(delete => sub { shift->(@$del, @$internal_del) });
        }
        if (%rendered) {
                run_hooks(delete => sub { shift->(@$del, @$internal_del) });
        }
        if (%rendered) {
-               run_hooks(change => sub { shift->(keys %rendered) });
+               run_hooks(rendered => sub { shift->(keys %rendered) });
+               run_hooks(change => sub { shift->(keys %rendered) }); # back-compat
        }
        }
+       run_hooks(difference => sub {
+               shift->(@$new, @$changed, @$del,
+                       @$internal_new, @$internal_changed, @$internal_del);
+       });
 }
 
 sub clean_rendered {
 }
 
 sub clean_rendered {
index 90e619cd13f7b69c56084bf06ea024e825fa2bf6..861679b4e431a72066f2c2855ba4ebe6fc26790a 100644 (file)
@@ -5,7 +5,10 @@ ikiwiki (3.20120204) UNRELEASED; urgency=low
     them.
   * meta: Export author information in html <meta> tag. Closes: #664779
     Thanks, Martin Michlmayr
     them.
   * meta: Export author information in html <meta> tag. Closes: #664779
     Thanks, Martin Michlmayr
-  * changemail: New plugin, sends emails about changed pages.
+  * notifyemail: New plugin, sends email notifications about new and 
+    changed pages.
+  * Added a "changes" hook. Renamed the "change" hook to "rendered", but
+    the old hook name is called for now for back-compat.
 
  -- Joey Hess <joeyh@debian.org>  Wed, 21 Mar 2012 14:33:14 -0400
 
 
  -- Joey Hess <joeyh@debian.org>  Wed, 21 Mar 2012 14:33:14 -0400
 
index cc5f6e5edd253c2f954d0a7f390f10f402b217ec..4c66e51f865dc4f0490a18d9426286909dfd2d5e 100644 (file)
@@ -376,17 +376,28 @@ the second is a log message resembling
 
        hook(type => "delete", id => "foo", call => \&delete);
 
 
        hook(type => "delete", id => "foo", call => \&delete);
 
-Each time a page or pages is removed from the wiki, the referenced function
+After a page or pages is removed from the wiki, the referenced function
 is called, and passed the names of the source files that were removed.
 
 is called, and passed the names of the source files that were removed.
 
-### change
+### rendered
 
 
-       hook(type => "change", id => "foo", call => \&render);
+       hook(type => "rendered", id => "foo", call => \&rendered);
 
 
-Each time ikiwiki renders a change or addition (but not deletion) to the
+After ikiwiki renders a change or addition (but not deletion) to the
 wiki, the referenced function is called, and passed the names of the
 source files that were rendered.
 
 wiki, the referenced function is called, and passed the names of the
 source files that were rendered.
 
+(This hook used to be called "change", but that was not accurate.
+For now, plugins using the old hook name will still work.)
+
+### changes
+
+       hook(type => "changes", id => "foo", call => \&changes);
+
+After ikiwiki renders changes to the wiki, the referenced function is
+called, and passed the names of the source files that were added, modified,
+or deleted.
+
 ### cgi
 
        hook(type => "cgi", id => "foo", call => \&cgi);
 ### cgi
 
        hook(type => "cgi", id => "foo", call => \&cgi);