|
# File rbot/keywords.rb, line 176
def upgrade_data
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]
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]
old.each {|k,v|
new[k] = v
}
old.close
new.close
File.delete("#{@bot.botclass}/keywords.db")
end
end
|