diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-12-18 15:00:41 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-12-18 15:00:41 +0800 |
commit | eafed9609f704ab063332c164eddd2bf5fc760ce (patch) | |
tree | 8b0ac443807967abbd2a9eda2372f5841bd57e72 | |
parent | 7c26b1341dd93b126d5e09289c2aa857d045e6f3 (diff) | |
download | pttbbs-eafed9609f704ab063332c164eddd2bf5fc760ce.tar pttbbs-eafed9609f704ab063332c164eddd2bf5fc760ce.tar.gz pttbbs-eafed9609f704ab063332c164eddd2bf5fc760ce.tar.bz2 pttbbs-eafed9609f704ab063332c164eddd2bf5fc760ce.tar.lz pttbbs-eafed9609f704ab063332c164eddd2bf5fc760ce.tar.xz pttbbs-eafed9609f704ab063332c164eddd2bf5fc760ce.tar.zst pttbbs-eafed9609f704ab063332c164eddd2bf5fc760ce.zip |
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1419 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rwxr-xr-x | staticweb/manbuilder.pl | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/staticweb/manbuilder.pl b/staticweb/manbuilder.pl index 60b3de96..dafd1761 100755 --- a/staticweb/manbuilder.pl +++ b/staticweb/manbuilder.pl @@ -9,7 +9,7 @@ use BBSFileHeader; use Data::Serializer; use Compress::Zlib; -my(%db, $idx, $serial); +my(%db, $idx, $serial, $idxname); sub main { @@ -25,14 +25,16 @@ sub main if( /\.db$/ ){ next if( $Getopt::Std::opt_n ); + $idxname = substr($_, 0, -3). '.idx'; print "building idx for $_\n"; tie %db, 'DB_File', $_, O_RDONLY, 0664, $DB_HASH; - $idx = OurNet::FuzzyIndex->new(substr($_, 0, -3). '.idx'); + $idx = OurNet::FuzzyIndex->new($idxname); buildidx(); } else{ tie %db, 'DB_File', "$_.db", O_CREAT | O_RDWR, 0664, $DB_HASH; - $idx = OurNet::FuzzyIndex->new("$_.idx") + $idxname = "$_.idx"; + $idx = OurNet::FuzzyIndex->new($idxname) if( !$Getopt::Std::opt_n ); build("/home/bbs/man/boards/".substr($_, 0, 1)."/$_", ''); $db{_buildtime} = time(); @@ -42,20 +44,23 @@ sub main if( $idx ){ undef $idx; - chmod 0664, "$_.idx"; + chmod 0664, $idxname; } } } sub buildidx { - my $gzipped = $db{_gzip}; + my($gzipped, $content); + $gzipped = $db{_gzip}; foreach( keys %db ){ next if( /^title/ || /\/$/ ); # 是 title 或目錄的都跳過 + $content = $db{$_}; + $content = Compress::Zlib::memGunzip($content) + if( $gzipped ); + $idx->insert($_, - ($db{"title-$_"}. "\n". - ($gzipped ? Compress::Zlib::memGunzip($db{$_}) : - $db{$_}))); + ($db{"title-$_"}. "\n$content")); } } |