From e895157397c4602359f8612e4ce9964bcabc8928 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Thu, 1 Jan 2009 18:04:37 +0100 Subject: Pass src, srcfile, dest and destfile to the canrename hook. This is not needed by the use I'm doing of it, but seems more consistent to me. Future users of this hook may need this data to make their mind. Signed-off-by: intrigeri --- IkiWiki/Plugin/po.pm | 9 +++++---- IkiWiki/Plugin/rename.pm | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'IkiWiki') diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index cb48aaf0d..c0c7557e4 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -432,11 +432,12 @@ sub canremove ($$$) { return undef; } -sub canrename ($$$) { - my ($page, $cgi, $session) = (shift, shift, shift); +sub canrename ($$@) { + my ($cgi, $session) = (shift, shift); + my %params = @_; - if (istranslation($page)) { - my $masterpage = masterpage($page); + if (istranslation($params{src})) { + my $masterpage = masterpage($params{src}); # Tell the difference between: # - a translation being renamed as a consequence of its master page # being renamed, which is allowed diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm index 5c198f457..82639a073 100644 --- a/IkiWiki/Plugin/rename.pm +++ b/IkiWiki/Plugin/rename.pm @@ -91,7 +91,8 @@ sub check_canrename ($$$$$$) { my $canrename; IkiWiki::run_hooks(canrename => sub { return if defined $canrename; - my $ret=shift->($src, $q, $session); + my $ret=shift->($q, $session, src => $src, srcfile => $srcfile, + dest => $dest, destfile => $destfile); if (defined $ret) { if ($ret eq "") { $canrename=1; -- cgit v1.2.3