Pass src, srcfile, dest and destfile to the canrename hook.
authorintrigeri <intrigeri@boum.org>
Thu, 1 Jan 2009 17:04:37 +0000 (18:04 +0100)
committerintrigeri <intrigeri@boum.org>
Thu, 1 Jan 2009 17:04:37 +0000 (18:04 +0100)
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 <intrigeri@boum.org>
IkiWiki/Plugin/po.pm
IkiWiki/Plugin/rename.pm
doc/plugins/write.mdwn

index cb48aaf0d63197221be51cdf9431387d0f768058..c0c7557e461e9dba79b955d18c4c2c2d8046c310 100644 (file)
@@ -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
index 5c198f45721b5f441325dd8f44aed276253b53d1..82639a073349f8f2ef1d5943df11b653a2f88a9a 100644 (file)
@@ -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;
index a1e14cb948989fe82f14eb54b8267aeec7975d23..92e372cfab11b86d613e6ae15816c66774e2513e 100644 (file)
@@ -335,7 +335,11 @@ bypass it). It works exactly like the `canedit` hook.
 
 This hook can be used to implement arbitrary access methods to control when
 a page can be renamed using the web interface (commits from revision control
-bypass it). It works exactly like the `canedit` hook.
+bypass it). It works exactly like the `canedit` and `canremove` hook,
+but is passed:
+* a CGI object
+* a session object
+* the named parameters `src`, `srcfile`, `dest` and `destfile`.
 
 ### editcontent