Added a "changes" hook. Renamed the "change" hook to "rendered", but
the old hook name is called for now for back-compat.master
parent
1916f97472
commit
d68d255268
|
@ -26,7 +26,7 @@ sub import {
|
||||||
# Hook to change to do pinging since it's called late.
|
# Hook to change to do pinging since it's called late.
|
||||||
# This ensures each page only pings once and prevents slow
|
# This ensures each page only pings once and prevents slow
|
||||||
# pings interrupting page builds.
|
# pings interrupting page builds.
|
||||||
hook(type => "change", id => "inline", call => \&IkiWiki::pingurl);
|
hook(type => "rendered", id => "inline", call => \&IkiWiki::pingurl);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub getopt () {
|
sub getopt () {
|
||||||
|
|
|
@ -13,7 +13,7 @@ sub import {
|
||||||
hook(type => "needsbuild", id => "pinger", call => \&needsbuild);
|
hook(type => "needsbuild", id => "pinger", call => \&needsbuild);
|
||||||
hook(type => "preprocess", id => "ping", call => \&preprocess);
|
hook(type => "preprocess", id => "ping", call => \&preprocess);
|
||||||
hook(type => "delete", id => "pinger", call => \&ping);
|
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 () {
|
||||||
|
|
|
@ -47,7 +47,7 @@ sub import {
|
||||||
hook(type => "pagetemplate", id => "po", call => \&pagetemplate, last => 1);
|
hook(type => "pagetemplate", id => "po", call => \&pagetemplate, last => 1);
|
||||||
hook(type => "rename", id => "po", call => \&renamepages, first => 1);
|
hook(type => "rename", id => "po", call => \&renamepages, first => 1);
|
||||||
hook(type => "delete", id => "po", call => \&mydelete);
|
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 => "checkcontent", id => "po", call => \&checkcontent);
|
||||||
hook(type => "canremove", id => "po", call => \&canremove);
|
hook(type => "canremove", id => "po", call => \&canremove);
|
||||||
hook(type => "canrename", id => "po", call => \&canrename);
|
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 @rendered=@_;
|
||||||
|
|
||||||
my $updated_po_files=0;
|
my $updated_po_files=0;
|
||||||
|
|
|
@ -7,7 +7,7 @@ use IkiWiki 3.00;
|
||||||
|
|
||||||
sub import {
|
sub import {
|
||||||
hook(type => "getsetup", id => "rsync", call => \&getsetup);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@ sub import {
|
||||||
hook(type => "templatefile", id => "skeleton", call => \&templatefile);
|
hook(type => "templatefile", id => "skeleton", call => \&templatefile);
|
||||||
hook(type => "pageactions", id => "skeleton", call => \&pageactions);
|
hook(type => "pageactions", id => "skeleton", call => \&pageactions);
|
||||||
hook(type => "delete", id => "skeleton", call => \&delete);
|
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 => "cgi", id => "skeleton", call => \&cgi);
|
||||||
hook(type => "auth", id => "skeleton", call => \&auth);
|
hook(type => "auth", id => "skeleton", call => \&auth);
|
||||||
hook(type => "sessioncgi", id => "skeleton", call => \&sessioncgi);
|
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 ($) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ use IkiWiki 3.00;
|
||||||
sub import {
|
sub import {
|
||||||
hook(type => "getsetup", id => "transient", call => \&getsetup);
|
hook(type => "getsetup", id => "transient", call => \&getsetup);
|
||||||
hook(type => "checkconfig", id => "transient", call => \&checkconfig);
|
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 (@_) {
|
foreach my $file (@_) {
|
||||||
# If the corresponding file exists in the transient underlay
|
# If the corresponding file exists in the transient underlay
|
||||||
# and isn't actually being used, we can get rid of it.
|
# and isn't actually being used, we can get rid of it.
|
||||||
|
|
|
@ -829,8 +829,13 @@ sub refresh () {
|
||||||
run_hooks(delete => sub { shift->(@$del, @$internal_del) });
|
run_hooks(delete => sub { shift->(@$del, @$internal_del) });
|
||||||
}
|
}
|
||||||
if (%rendered) {
|
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 {
|
||||||
|
|
|
@ -5,7 +5,10 @@ ikiwiki (3.20120204) UNRELEASED; urgency=low
|
||||||
them.
|
them.
|
||||||
* meta: Export author information in html <meta> tag. Closes: #664779
|
* meta: Export author information in html <meta> tag. Closes: #664779
|
||||||
Thanks, Martin Michlmayr
|
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
|
||||||
|
|
||||||
|
|
|
@ -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
|
wiki, the referenced function is called, and passed the names of the
|
||||||
source files that were rendered.
|
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
|
### cgi
|
||||||
|
|
||||||
hook(type => "cgi", id => "foo", call => \&cgi);
|
hook(type => "cgi", id => "foo", call => \&cgi);
|
||||||
|
|
Loading…
Reference in New Issue