Mercurial > wow > reaction
view Profile.lua @ 215:258ca67bde4a
Fix upgrade script to not throw errors on profile swap
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Fri, 19 Nov 2010 14:33:11 -0800 |
parents | 8ba8ab8bf6dd |
children | a4e7475633b3 |
line wrap: on
line source
local _, addonTable = ... local ReAction = addonTable.ReAction ReAction.PROFILEVERSION_LATEST = 1 ReAction.defaultProfile = { profile = { dbversion = nil, bars = { }, options = { hideBlizzardBars = false, hideBlizzardVehicleBar = false, }, }, global = { skipKeybindWarning = false, } } function ReAction:UpgradeProfile() local db = self.db if not db.profile.dbversion then -- upgrade from legacy db to v1 -- (1) remove unused defaultBars table (cleanup) db.profile.defaultBars = nil -- (2) HideBlizzard is no longer a module local hb = db:GetNamespace("HideBlizzard",true) or db:RegisterNamespace("HideBlizzard") if hb then db.profile.options.hideBlizzardBars = hb.profile.hide db.profile.options.hideBlizzardVehicleBar = hb.profile.hideVehicle hb:ResetProfile() end -- (3) LBF is no longer a module local bf = db:GetNamespace("ButtonFacade",true) or db:RegisterNamespace("ButtonFacade") if bf then for name, bar in pairs(db.profile.bars) do bar.ButtonFacade = bf.profile[name] or bar.ButtonFacade end bf:ResetProfile() end db.profile.dbversion = 1 end db.profile.dbversion = self.PROFILEVERSION_LATEST end