use new disable hook
authorJoey Hess <joey@kitenet.net>
Mon, 26 Jul 2010 20:23:10 +0000 (16:23 -0400)
committerJoey Hess <joey@kitenet.net>
Mon, 26 Jul 2010 20:23:10 +0000 (16:23 -0400)
clean up xapian db when plugin is disabled

IkiWiki/Plugin/search.pm

index ff5d0ccbe616379b0a7efdadbd1858e4a8cf098e..1cf762fce162fd6b7355c536bb5d06232d8a16ae 100644 (file)
@@ -13,6 +13,7 @@ sub import {
        hook(type => "indexhtml", id => "search", call => \&indexhtml);
        hook(type => "delete", id => "search", call => \&delete);
        hook(type => "cgi", id => "search", call => \&cgi);
+       hook(type => "disable", id => "search", call => \&disable);
 }
 
 sub getsetup () {
@@ -245,4 +246,10 @@ sub setupfiles () {
 }
 }
 
+sub disable () {
+       if (-d $config{wikistatedir}."/xapian") {
+               system("rm", "-rf", $config{wikistatedir}."/xapian");
+       }
+}
+
 1