]> sipb.mit.edu Git - ikiwiki.git/commitdiff
only pass named parameters to the canremove hook
authorintrigeri <intrigeri@boum.org>
Mon, 26 Jan 2009 22:07:19 +0000 (23:07 +0100)
committerintrigeri <intrigeri@boum.org>
Mon, 26 Jan 2009 22:07:19 +0000 (23:07 +0100)
Signed-off-by: intrigeri <intrigeri@boum.org>
IkiWiki/Plugin/po.pm
IkiWiki/Plugin/remove.pm
IkiWiki/Plugin/skeleton.pm.example
doc/plugins/write.mdwn

index b579d1f0831a4934017af66fc2079e772cf3b010..363720e1dfefc55230c6bda250256172ed58e8ca 100644 (file)
@@ -442,10 +442,10 @@ sub checkcontent (@) {
        return undef;
 }
 
-sub canremove ($$$) {
-       my ($page, $cgi, $session) = (shift, shift, shift);
+sub canremove (@) {
+       my %params = @_;
 
-       if (istranslation($page)) {
+       if (istranslation($params{page})) {
                return gettext("Can not remove a translation. Removing the master page, ".
                               "though, removes its translations as well.");
        }
index 3f1704846407aa55baad6dd662ba4c263dd25cec..cbc8a0f2ce70719e770fc64853feaaa37252f23b 100644 (file)
@@ -58,7 +58,7 @@ sub check_canremove ($$$) {
        my $canremove;
        IkiWiki::run_hooks(canremove => sub {
                return if defined $canremove;
-               my $ret=shift->($page, $q, $session);
+               my $ret=shift->(page => $page, cgi => $q, session => $session);
                if (defined $ret) {
                        if ($ret eq "") {
                                $canremove=1;
index ec5a0c72518284c848deb0b2a26aeaa84361aee5..6a97fb2f2b7cf4ade487f853886d720272a8bcb0 100644 (file)
@@ -183,10 +183,8 @@ sub canedit ($$$) {
        debug("skeleton plugin running in canedit");
 }
 
-sub canremove ($$$) {
-       my $page=shift;
-       my $cgi=shift;
-       my $session=shift;
+sub canremove (@) {
+       my %params=@_;
 
        debug("skeleton plugin running in canremove");
 }
index b60dc66f201899349e9916137b0f936d3973917e..dde0d431c3f1ed4d6ca813c45480ef2f25807584 100644 (file)
@@ -325,9 +325,11 @@ user can edit.
 
        hook(type => "canremove", id => "foo", call => \&canremove);
 
-This hook can be used to implement arbitrary access methods to control when
-a page can be removed using the web interface (commits from revision control
-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 removed using the web interface (commits from
+revision control bypass it). It works exactly like the `canedit` hook,
+but is passed the named parameters `cgi` (a CGI object), `session`
+(a session object) and `page` (the page subject to deletion).
 
 ### canrename
 
@@ -335,7 +337,7 @@ 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` and `canremove` hook,
+bypass it). It works exactly like the `canedit` hook,
 but is passed the named parameters `cgi` (a CGI object), `session` (a
 session object), `src`, `srcfile`, `dest` and `destfile`.