diff options
author | intrigeri <intrigeri@boum.org> | 2009-01-01 16:48:43 +0100 |
---|---|---|
committer | intrigeri <intrigeri@boum.org> | 2009-01-01 16:52:34 +0100 |
commit | 3316f9cc737c091ff79270f75fc30dd349616b12 (patch) | |
tree | 3def77919357d58567afa2750a9c45cae5611582 /IkiWiki/Plugin/rename.pm | |
parent | 741b26aa176b34d0359a2b89dd6d8293fcdf2b3d (diff) | |
download | ikiwiki-3316f9cc737c091ff79270f75fc30dd349616b12.tar ikiwiki-3316f9cc737c091ff79270f75fc30dd349616b12.tar.gz |
rename: implemented new canrename hook
Signed-off-by: intrigeri <intrigeri@boum.org>
Diffstat (limited to 'IkiWiki/Plugin/rename.pm')
-rw-r--r-- | IkiWiki/Plugin/rename.pm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm index 25ddd2d65..740ca8ac4 100644 --- a/IkiWiki/Plugin/rename.pm +++ b/IkiWiki/Plugin/rename.pm @@ -87,6 +87,26 @@ sub check_canrename ($$$$$$) { IkiWiki::Plugin::attachment::check_canattach($session, $dest, $srcfile); } } + + my $canrename; + IkiWiki::run_hooks(canrename => sub { + return if defined $canrename; + my $ret=shift->($src, $q, $session); + if (defined $ret) { + if ($ret eq "") { + $canrename=1; + } + elsif (ref $ret eq 'CODE') { + $ret->(); + $canrename=0; + } + elsif (defined $ret) { + error($ret); + $canrename=0; + } + } + }); + return $canrename; } sub rename_form ($$$) { |