summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2009-01-26 23:02:31 +0100
committerintrigeri <intrigeri@boum.org>2009-01-26 23:02:31 +0100
commitf02672c113813c37a659991ae984a2368e15b8db (patch)
tree0594363b50f3ffb9ffa6fee6d0965538ae367977
parente0e94d47162840b01677f4a97c5f581d194ff0fb (diff)
only pass named parameters to the canrename hook
Signed-off-by: intrigeri <intrigeri@boum.org>
-rw-r--r--IkiWiki/Plugin/po.pm4
-rw-r--r--IkiWiki/Plugin/rename.pm5
-rw-r--r--IkiWiki/Plugin/skeleton.pm.example6
-rw-r--r--doc/plugins/write.mdwn6
4 files changed, 9 insertions, 12 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index da5812ebd..b579d1f08 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -452,9 +452,9 @@ sub canremove ($$$) {
return undef;
}
-sub canrename ($$@) {
- my ($cgi, $session) = (shift, shift);
+sub canrename (@) {
my %params = @_;
+ my $session = $params{session};
if (istranslation($params{src})) {
my $masterpage = masterpage($params{src});
diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm
index 37f643eef..b43c5282a 100644
--- a/IkiWiki/Plugin/rename.pm
+++ b/IkiWiki/Plugin/rename.pm
@@ -91,8 +91,9 @@ sub check_canrename ($$$$$$) {
my $canrename;
IkiWiki::run_hooks(canrename => sub {
return if defined $canrename;
- my $ret=shift->($q, $session, src => $src, srcfile => $srcfile,
- dest => $dest, destfile => $destfile);
+ my $ret=shift->(cgi => $q, session => $session,
+ src => $src, srcfile => $srcfile,
+ dest => $dest, destfile => $destfile);
if (defined $ret) {
if ($ret eq "") {
$canrename=1;
diff --git a/IkiWiki/Plugin/skeleton.pm.example b/IkiWiki/Plugin/skeleton.pm.example
index f5e401c05..ec5a0c725 100644
--- a/IkiWiki/Plugin/skeleton.pm.example
+++ b/IkiWiki/Plugin/skeleton.pm.example
@@ -191,10 +191,8 @@ sub canremove ($$$) {
debug("skeleton plugin running in canremove");
}
-sub canrename ($$$) {
- my $page=shift;
- my $cgi=shift;
- my $session=shift;
+sub canrename (@) {
+ my %params=@_;
debug("skeleton plugin running in canrename");
}
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 4704ba16d..b60dc66f2 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -336,10 +336,8 @@ 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,
-but is passed:
-* a CGI object
-* a session object
-* the named parameters `src`, `srcfile`, `dest` and `destfile`.
+but is passed the named parameters `cgi` (a CGI object), `session` (a
+session object), `src`, `srcfile`, `dest` and `destfile`.
### checkcontent