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 <intrigeri@boum.org>master
parent
131d2d4e7c
commit
e895157397
|
@ -432,11 +432,12 @@ sub canremove ($$$) {
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub canrename ($$$) {
|
sub canrename ($$@) {
|
||||||
my ($page, $cgi, $session) = (shift, shift, shift);
|
my ($cgi, $session) = (shift, shift);
|
||||||
|
my %params = @_;
|
||||||
|
|
||||||
if (istranslation($page)) {
|
if (istranslation($params{src})) {
|
||||||
my $masterpage = masterpage($page);
|
my $masterpage = masterpage($params{src});
|
||||||
# Tell the difference between:
|
# Tell the difference between:
|
||||||
# - a translation being renamed as a consequence of its master page
|
# - a translation being renamed as a consequence of its master page
|
||||||
# being renamed, which is allowed
|
# being renamed, which is allowed
|
||||||
|
|
|
@ -91,7 +91,8 @@ sub check_canrename ($$$$$$) {
|
||||||
my $canrename;
|
my $canrename;
|
||||||
IkiWiki::run_hooks(canrename => sub {
|
IkiWiki::run_hooks(canrename => sub {
|
||||||
return if defined $canrename;
|
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 (defined $ret) {
|
||||||
if ($ret eq "") {
|
if ($ret eq "") {
|
||||||
$canrename=1;
|
$canrename=1;
|
||||||
|
|
|
@ -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
|
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
|
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
|
### editcontent
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue