implemented pruning, s3 support now complete-ish
authorJoey Hess <joey@kodama.kitenet.net>
Thu, 8 May 2008 03:51:25 +0000 (23:51 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Thu, 8 May 2008 03:51:25 +0000 (23:51 -0400)
IkiWiki/Plugin/amazon_s3.pm
debian/changelog

index b5629eb4ab383b799a1e2d12e5abbb3addf24e89..0613d4357f22b10582ec481b25f8855eff233e3e 100644 (file)
@@ -152,10 +152,25 @@ sub writefile ($$$;$$) { #{{{
 sub prune ($) { #{{{
        my $file=shift;
 
 sub prune ($) { #{{{
        my $file=shift;
 
-       my $bucket=IkiWiki::Plugin::amazon_s3::getbucket();
-       print STDERR "wrapped prune\n";
+       # If a file in the destdir is being pruned, need to delete it out
+       # of S3 as well.
+       if ($file =~ /^\Q$config{destdir}\/\E(.*)/) {
+               my $key=$config{amazon_s3_prefix}.$1;
+               print STDERR "wrapped prune ($key)\n";
+               my $bucket=IkiWiki::Plugin::amazon_s3::getbucket();
+               my $res=$bucket->delete_key($key);
+               if ($res && $key=~/(^|\/)index.$config{htmlext}$/) {
+                       # index.html special case: Delete other file too
+                       $key=~s/index.$config{htmlext}$//;
+                       $res=$bucket->delete_key($key);
+               }
+               if (! $res) {
+                       error(gettext("Failed to delete file from S3: ").
+                               $bucket->err.": ".$bucket->errstr."\n");
+               }
+       }
 
 
-       return $IkiWiki::Plugin::amazon_s3::subs{'IkiWiki::writefile'}->($file);
+       return $IkiWiki::Plugin::amazon_s3::subs{'IkiWiki::prune'}->($file);
 } #}}}
 
 1
 } #}}}
 
 1
index 3ff3f0087c6526d3b3e2958e3c24017609bde4d3..118a0347d64cb6204dbae9a13b2b5e07c68a56fe 100644 (file)
@@ -1,5 +1,7 @@
 ikiwiki (2.46) UNRELEASED; urgency=low
 
 ikiwiki (2.46) UNRELEASED; urgency=low
 
+  * amazon_s3: New plugin, which injects wiki pages into Amazon S3, allowing
+    ikiwiki to be used without a dedicated web server.
   * aggregate: Add support for web-based triggering of aggregation 
     for people stuck on shared hosting without cron. (Sheesh.) Enabled
     via the `aggregate_webtrigger` configuration optiom.
   * aggregate: Add support for web-based triggering of aggregation 
     for people stuck on shared hosting without cron. (Sheesh.) Enabled
     via the `aggregate_webtrigger` configuration optiom.