|
# File rbot/registry.rb, line 44
def upgrade_data
if File.exist?("#{@bot.botclass}/registry.db")
puts "upgrading old-style (rbot 0.9.5 or earlier) plugin registry to new format"
old = BDB::Hash.open "#{@bot.botclass}/registry.db", nil,
"r+", 0600, "set_pagesize" => 1024,
"set_cachesize" => [0, 32 * 1024, 0]
new = BDB::CIBtree.open "#{@bot.botclass}/plugin_registry.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}/registry.db")
end
end
|