search: generate configuration files once only when rebuilding
authorGabriel McManus <gmcmanus@gmail.com>
Sun, 6 Jul 2008 16:06:10 +0000 (02:06 +1000)
committerJoey Hess <joey@kodama.kitenet.net>
Mon, 7 Jul 2008 05:53:06 +0000 (01:53 -0400)
IkiWiki/Plugin/search.pm

index 8fc2f3724c9f4666e675aeaa79bc43e839230792..7b41bbde9152da89dad16937a9e0bca3f122f933 100644 (file)
@@ -194,14 +194,16 @@ sub xapiandb () { #{{{
        return $db;
 } #}}}
 
+my $setup;
 sub setupfiles () { #{{{
-       if (! -e $config{wikistatedir}."/xapian" || $config{rebuild}) {
+       if (! defined $setup and ! -e $config{wikistatedir}."/xapian" || $config{rebuild}) {
                writefile("omega.conf", $config{wikistatedir}."/xapian",
                        "database_dir .\n".
                        "template_dir ./templates\n");
                writefile("query", $config{wikistatedir}."/xapian/templates",
                        IkiWiki::misctemplate(gettext("search"),
                                readfile(IkiWiki::template_file("searchquery.tmpl"))));
+               $setup=1;
        }
 } #}}}