X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/523650d9c2b876152aaa9bc6c5d6363377ea7008..6c546c8f3182668c6d21d578b789674894f18c39:/IkiWiki/Plugin/amazon_s3.pm

diff --git a/IkiWiki/Plugin/amazon_s3.pm b/IkiWiki/Plugin/amazon_s3.pm
index 10bf358e4..a9da6bf12 100644
--- a/IkiWiki/Plugin/amazon_s3.pm
+++ b/IkiWiki/Plugin/amazon_s3.pm
@@ -133,7 +133,11 @@ sub getbucket {
 	}
 
 	if (! $bucket) {
-		error(gettext("Failed to create bucket in S3: ").
+		# Try to use existing bucket.
+		$bucket=$s3->bucket($config{amazon_s3_bucket});
+	}
+	if (! $bucket) {
+		error(gettext("Failed to create S3 bucket: ").
 			$s3->err.": ".$s3->errstr."\n");
 	}
 
@@ -178,7 +182,7 @@ sub writefile ($$$;$$) {
 
 	# First, write the file to disk.
 	my $ret=$IkiWiki::Plugin::amazon_s3::subs{'IkiWiki::writefile'}->($file, $destdir, $content, $binary, $writer);
-		
+
 	my @keys=IkiWiki::Plugin::amazon_s3::file2keys("$destdir/$file");
 
 	# Store the data in S3.
@@ -228,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);
 
@@ -246,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