diff options
author | Simon McVittie <smcv@debian.org> | 2012-04-07 17:52:29 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2012-04-07 17:52:29 +0100 |
commit | 5674e7fc1273800554c23ad6194e8a06dee851ae (patch) | |
tree | c5ae178e0a15350dc44507c5612bd58dae98e2f4 /IkiWiki/Plugin/amazon_s3.pm | |
parent | f5f41fa59af064ce3d5e038154950aefdc8d6f65 (diff) | |
download | ikiwiki-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/amazon_s3.pm')
-rw-r--r-- | IkiWiki/Plugin/amazon_s3.pm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/amazon_s3.pm b/IkiWiki/Plugin/amazon_s3.pm index cfd8cd347..a9da6bf12 100644 --- a/IkiWiki/Plugin/amazon_s3.pm +++ b/IkiWiki/Plugin/amazon_s3.pm @@ -232,8 +232,9 @@ sub writefile ($$$;$$) { } # This is a wrapper around the real prune. -sub prune ($) { +sub prune ($;$) { my $file=shift; + my $up_to=shift; my @keys=IkiWiki::Plugin::amazon_s3::file2keys($file); @@ -250,7 +251,7 @@ sub prune ($) { } } - return $IkiWiki::Plugin::amazon_s3::subs{'IkiWiki::prune'}->($file); + return $IkiWiki::Plugin::amazon_s3::subs{'IkiWiki::prune'}->($file, $up_to); } 1 |