aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/comments.pm
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2012-04-07 17:52:29 +0100
committerSimon McVittie <smcv@debian.org>2012-04-07 17:52:29 +0100
commit5674e7fc1273800554c23ad6194e8a06dee851ae (patch)
treec5ae178e0a15350dc44507c5612bd58dae98e2f4 /IkiWiki/Plugin/comments.pm
parentf5f41fa59af064ce3d5e038154950aefdc8d6f65 (diff)
downloadikiwiki-5674e7fc1273800554c23ad6194e8a06dee851ae.tar
ikiwiki-5674e7fc1273800554c23ad6194e8a06dee851ae.tar.gz
prune: do not prune beyond an optional base directory, and add a test
Previously, prune("wiki/srcdir/sandbox/test.mdwn") could delete srcdir or even wiki, if they happened to be empty. This is rarely what you want: there's usually some base directory (destdir, srcdir, transientdir or another subdirectory of wikistatedir) beyond which you do not want to delete.
Diffstat (limited to 'IkiWiki/Plugin/comments.pm')
-rw-r--r--IkiWiki/Plugin/comments.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index 0d5e3c078..4bf8ae469 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -665,9 +665,11 @@ sub commentmoderation ($$) {
my $page=IkiWiki::dirname($f);
my $file="$config{srcdir}/$f";
+ my $filedir="$config{srcdir}";
if (! -e $file) {
# old location
$file="$config{wikistatedir}/comments_pending/".$f;
+ $filedir="$config{wikistatedir}/comments_pending";
}
if ($action eq 'Accept') {
@@ -682,7 +684,7 @@ sub commentmoderation ($$) {
}
require IkiWiki::Render;
- IkiWiki::prune($file);
+ IkiWiki::prune($file, $filedir);
}
}