X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/bb93fccf0690344aa77f9538a508959a6de09847..a5de24ec9700c56f8945668c3647b45a7a9b71c2:/IkiWiki/Plugin/remove.pm?ds=sidebyside diff --git a/IkiWiki/Plugin/remove.pm b/IkiWiki/Plugin/remove.pm index 781501662..2e3614cca 100644 --- a/IkiWiki/Plugin/remove.pm +++ b/IkiWiki/Plugin/remove.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::remove; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "remove", call => \&getsetup); @@ -54,6 +54,26 @@ sub check_canremove ($$$) { error("renaming of attachments is not allowed"); } } + + my $canremove; + IkiWiki::run_hooks(canremove => sub { + return if defined $canremove; + my $ret=shift->($page, $q, $session); + if (defined $ret) { + if ($ret eq "") { + $canremove=1; + } + elsif (ref $ret eq 'CODE') { + $ret->(); + $canremove=0; + } + elsif (defined $ret) { + error($ret); + $canremove=0; + } + } + }); + return $canremove; } sub formbuilder_setup (@) {