summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki/Plugin/editpage.pm28
-rw-r--r--IkiWiki/Plugin/po.pm10
-rw-r--r--IkiWiki/Plugin/skeleton.pm.example10
-rw-r--r--doc/plugins/write.mdwn15
4 files changed, 5 insertions, 58 deletions
diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm
index 4540b55d0..cfed51afd 100644
--- a/IkiWiki/Plugin/editpage.pm
+++ b/IkiWiki/Plugin/editpage.pm
@@ -117,33 +117,6 @@ sub check_content (@) {
return defined $ok ? $ok : 1;
}
-sub check_cansave ($$$$) {
- my $page=shift;
- my $content=shift;
- my $q=shift;
- my $session=shift;
-
- my $cansave;
- run_hooks(cansave => sub {
- return if defined $cansave;
- my $ret=shift->($page, $content, $q, $session);
- if (defined $ret) {
- if ($ret eq "") {
- $cansave=1;
- }
- elsif (ref $ret eq 'CODE') {
- $ret->();
- $cansave=0;
- }
- else {
- error($ret);
- $cansave=0;
- }
- }
- });
- return $cansave;
-}
-
sub cgi_editpage ($$) {
my $q=shift;
my $session=shift;
@@ -439,7 +412,6 @@ sub cgi_editpage ($$) {
}
my $content=$form->field('editcontent');
- check_cansave($page, $content, $q, $session);
check_content(content => $content, page => $page,
cgi => $q, session => $session,
subject => $message);
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index 0a970284c..daac95eb1 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -49,7 +49,7 @@ sub import {
hook(type => "rename", id => "po", call => \&renamepages, first => 1);
hook(type => "delete", id => "po", call => \&mydelete);
hook(type => "change", id => "po", call => \&change);
- hook(type => "cansave", id => "po", call => \&cansave);
+ hook(type => "checkcontent", id => "po", call => \&checkcontent);
hook(type => "canremove", id => "po", call => \&canremove);
hook(type => "canrename", id => "po", call => \&canrename);
hook(type => "editcontent", id => "po", call => \&editcontent);
@@ -436,11 +436,11 @@ sub change(@) {
}
}
-sub cansave ($$$$) {
- my ($page, $content, $cgi, $session) = (shift, shift, shift, shift);
+sub checkcontent (@) {
+ my %params=@_;
- if (istranslation($page)) {
- my $res = isvalidpo($content);
+ if (istranslation($params{page})) {
+ my $res = isvalidpo($params{content});
if ($res) {
return undef;
}
diff --git a/IkiWiki/Plugin/skeleton.pm.example b/IkiWiki/Plugin/skeleton.pm.example
index 7506816f1..59503a462 100644
--- a/IkiWiki/Plugin/skeleton.pm.example
+++ b/IkiWiki/Plugin/skeleton.pm.example
@@ -30,7 +30,6 @@ sub import {
hook(type => "auth", id => "skeleton", call => \&auth);
hook(type => "sessioncgi", id => "skeleton", call => \&sessioncgi);
hook(type => "canedit", id => "skeleton", call => \&canedit);
- hook(type => "cansave", id => "skeleton", call => \&cansave);
hook(type => "checkcontent", id => "skeleton", call => \&checkcontent);
hook(type => "editcontent", id => "skeleton", call => \&editcontent);
hook(type => "formbuilder_setup", id => "skeleton", call => \&formbuilder_setup);
@@ -182,15 +181,6 @@ sub canedit ($$$) {
debug("skeleton plugin running in canedit");
}
-sub cansave ($$$$) {
- my $page=shift;
- my $content=shift;
- my $cgi=shift;
- my $session=shift;
-
- debug("skeleton plugin running in cansave");
-}
-
sub canremove ($$$) {
my $page=shift;
my $cgi=shift;
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 7ba01ae53..05dfc5d09 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -321,21 +321,6 @@ This hook should avoid directly redirecting the user to a signin page,
since it's sometimes used to test to see which pages in a set of pages a
user can edit.
-### cansave
-
- hook(type => "cansave", id => "foo", call => \&cansave);
-
-This hook can be used to implement arbitrary access methods to control
-when a page being edited can be saved using the web interface (commits
-from revision control bypass it).
-
-When a page is about to be saved, each registered cansave hook is
-called in turn, and passed the page name, the edited content, a CGI
-object and a session object.
-
-The return value of a cansave hook is interpreted the same as for the
-canedit hook.
-
### canremove
hook(type => "canremove", id => "foo", call => \&canremove);