summaryrefslogtreecommitdiff
path: root/lib/rbot/keywords.rb
diff options
context:
space:
mode:
authorTom Gilbert <tom@linuxbrit.co.uk>2006-02-10 18:52:56 +0000
committerTom Gilbert <tom@linuxbrit.co.uk>2006-02-10 18:52:56 +0000
commit44688c76d937c2dade10aaa7bb7e70e508b33684 (patch)
tree30d0751ea9feab5c039f64e60e2811e2821a11fb /lib/rbot/keywords.rb
parent2ed83d89e5fad7d0bed1003fdc60b538a4187162 (diff)
use a db env for the databases to avoid some corruption problems (I hope)
Diffstat (limited to 'lib/rbot/keywords.rb')
-rw-r--r--lib/rbot/keywords.rb18
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/rbot/keywords.rb b/lib/rbot/keywords.rb
index cc91155c..83185d9f 100644
--- a/lib/rbot/keywords.rb
+++ b/lib/rbot/keywords.rb
@@ -131,12 +131,10 @@ module Irc
puts "upgrading keyword db #{f} (rbot 0.9.5 or prior) database format"
newname = f.gsub(/\.db$/, ".kdb")
old = BDB::Hash.open f, nil,
- "r+", 0600, "set_pagesize" => 1024,
- "set_cachesize" => [0, 32 * 1024, 0]
- new = BDB::CIBtree.open newname, nil,
- BDB::CREATE | BDB::EXCL | BDB::TRUNCATE,
- 0600, "set_pagesize" => 1024,
- "set_cachesize" => [0, 32 * 1024, 0]
+ "r+", 0600
+ new = BDB::CIBtree.open(newname, nil,
+ BDB::CREATE | BDB::EXCL,
+ 0600)
old.each {|k,v|
new[k] = v
}
@@ -186,12 +184,10 @@ module Irc
if File.exist?("#{@bot.botclass}/keywords.db")
puts "upgrading old keywords (rbot 0.9.5 or prior) database format"
old = BDB::Hash.open "#{@bot.botclass}/keywords.db", nil,
- "r+", 0600, "set_pagesize" => 1024,
- "set_cachesize" => [0, 32 * 1024, 0]
+ "r+", 0600
new = BDB::CIBtree.open "#{@bot.botclass}/keyword.db", nil,
- BDB::CREATE | BDB::EXCL | BDB::TRUNCATE,
- 0600, "set_pagesize" => 1024,
- "set_cachesize" => [0, 32 * 1024, 0]
+ BDB::CREATE | BDB::EXCL,
+ 0600
old.each {|k,v|
new[k] = v
}