/** * Assume all users are new. Add them to real db with a prefix_ */ function merge_core(GDO_Database $db_from, GDO_Database $db_to, array &$db_offsets, $prefix, $prevar) { GDO::setCurrentDB($db_to); merge_calc_offset($db_from, $db_to, $db_offsets, 'GWF_User'); merge_gids($db_from, $db_to, $db_offsets, $prefix, $prevar); merge_users($db_from, $db_to, $db_offsets, $prefix, $prevar); merge_add_offset($db_from, $db_to, 'GWF_UserGroup', 'ug_userid', $db_offsets['GWF_User']); merge_use_mapping($db_from, $db_to, 'GWF_UserGroup', 'ug_groupid', $db_offsets['GWF_Group']); merge_table($db_from, $db_to, 'GWF_UserGroup'); }
public static function onMerge(GDO_Database $db_from, GDO_Database $db_to, array &$db_offsets, $prefix, $prevar) { merge_calc_offset($db_from, $db_to, $db_offsets, 'GWF_VoteMulti'); merge_calc_offset($db_from, $db_to, $db_offsets, 'GWF_VoteScore'); // VoteMulti merge_add_offset($db_from, $db_to, 'GWF_VoteMulti', 'vm_id', $db_offsets['GWF_VoteMulti']); merge_add_offset($db_from, $db_to, 'GWF_VoteMulti', 'vm_uid', $db_offsets['GWF_User']); merge_use_mapping($db_from, $db_to, 'GWF_VoteMulti', 'vm_gid', $db_offsets['GWF_Group']); merge_table($db_from, $db_to, 'GWF_VoteMulti'); // VoteMultiOpt merge_add_offset($db_from, $db_to, 'GWF_VoteMultiOpt', 'vmo_vmid', $db_offsets['GWF_VoteMulti']); merge_table($db_from, $db_to, 'GWF_VoteMultiOpt'); // VoteMultiRow merge_add_offset($db_from, $db_to, 'GWF_VoteMultiRow', 'vmr_vmid', $db_offsets['GWF_VoteMulti']); merge_add_offset($db_from, $db_to, 'GWF_VoteMultiRow', 'vmr_uid', $db_offsets['GWF_User']); merge_table($db_from, $db_to, 'GWF_VoteMultiRow'); // VoteScore merge_add_offset($db_from, $db_to, 'GWF_VoteScore', 'vs_id', $db_offsets['GWF_VoteScore']); merge_table($db_from, $db_to, 'GWF_VoteScore'); // VoteScoreRow merge_add_offset($db_from, $db_to, 'GWF_VoteScoreRow', 'vsr_vsid', $db_offsets['GWF_VoteScore']); merge_add_offset($db_from, $db_to, 'GWF_VoteScoreRow', 'vsr_uid', $db_offsets['GWF_User']); merge_table($db_from, $db_to, 'GWF_VoteScoreRow'); }
public static function onMerge(GDO_Database $db_from, GDO_Database $db_to, array &$db_offsets, $prefix, $prevar) { self::includeClasses(); self::calcOffsets($db_from, $db_to, $db_offsets, $prefix, $prevar); // WC_Challenge merge_add_offset($db_from, $db_to, 'WC_Challenge', 'chall_id', $db_offsets['WC_Challenge']); merge_add_offset($db_from, $db_to, 'WC_Challenge', 'chall_vote_dif', $db_offsets['GWF_VoteScore']); merge_add_offset($db_from, $db_to, 'WC_Challenge', 'chall_vote_edu', $db_offsets['GWF_VoteScore']); merge_add_offset($db_from, $db_to, 'WC_Challenge', 'chall_vote_fun', $db_offsets['GWF_VoteScore']); merge_use_mapping($db_from, $db_to, 'WC_Challenge', 'chall_board', $db_offsets['GWF_ForumBoard']); merge_use_mapping($db_from, $db_to, 'WC_Challenge', 'chall_sboard', $db_offsets['GWF_ForumBoard']); merge_fix_uid_blob($db_from, $db_to, $db_offsets, 'WC_Challenge', 'chall_creator', ','); merge_fix_uname_blob($db_from, $db_to, $db_offsets, 'WC_Challenge', 'chall_creator_name', ','); merge_use_mapping($db_from, $db_to, 'WC_Challenge', 'chall_gid', $db_offsets['GWF_Group']); merge_table($db_from, $db_to, 'WC_Challenge'); // WC_ChallSolved merge_add_offset($db_from, $db_to, 'WC_ChallSolved', 'csolve_uid', $db_offsets['GWF_User']); merge_add_offset($db_from, $db_to, 'WC_ChallSolved', 'csolve_cid', $db_offsets['WC_Challenge']); merge_table($db_from, $db_to, 'WC_ChallSolved'); // WC_FavCats merge_add_offset($db_from, $db_to, 'WC_FavCats', 'wcfc_uid', $db_offsets['GWF_User']); merge_table($db_from, $db_to, 'WC_FavCats'); // WC_FirstLink merge_add_offset($db_from, $db_to, 'WC_FirstLink', 'fili_sid', $db_offsets['WC_Site']); merge_add_offset($db_from, $db_to, 'WC_FirstLink', 'fili_uid', $db_offsets['GWF_User']); merge_table($db_from, $db_to, 'WC_FirstLink'); // WC_Freeze merge_add_offset($db_from, $db_to, 'WC_Freeze', 'wcf_sid', $db_offsets['WC_Site']); merge_add_offset($db_from, $db_to, 'WC_Freeze', 'wcf_uid', $db_offsets['GWF_User']); merge_table($db_from, $db_to, 'WC_Freeze'); // WC_HistorySite merge_add_offset($db_from, $db_to, 'WC_HistorySite', 'sitehist_sid', $db_offsets['WC_Site']); merge_table($db_from, $db_to, 'WC_HistorySite'); // WC_HistoryUser # DEPRECATED // merge_add_offset($db_from, $db_to, 'WC_HistoryUser', 'userhist_uid', $db_offsets['GWF_User']); // merge_add_offset($db_from, $db_to, 'WC_HistoryUser', 'userhist_sid', $db_offsets['WC_Site']); // merge_table($db_from, $db_to, 'WC_HistoryUser'); // WC_HistoryUser2 merge_add_offset($db_from, $db_to, 'WC_HistoryUser2', 'userhist_uid', $db_offsets['GWF_User']); merge_add_offset($db_from, $db_to, 'WC_HistoryUser2', 'userhist_sid', $db_offsets['WC_Site']); merge_table($db_from, $db_to, 'WC_HistoryUser2'); // WC_MathChall merge_add_offset($db_from, $db_to, 'WC_MathChall', 'wmc_id', $db_offsets['WC_MathChall']); merge_add_offset($db_from, $db_to, 'WC_MathChall', 'wmc_cid', $db_offsets['WC_Challenge']); merge_add_offset($db_from, $db_to, 'WC_MathChall', 'wmc_uid', $db_offsets['GWF_User']); merge_table($db_from, $db_to, 'WC_MathChall'); // WC_RegAt merge_add_offset($db_from, $db_to, 'WC_RegAt', 'regat_uid', $db_offsets['GWF_User']); merge_add_offset($db_from, $db_to, 'WC_RegAt', 'regat_sid', $db_offsets['WC_Site']); merge_table($db_from, $db_to, 'WC_RegAt'); // WC_Site merge_add_offset($db_from, $db_to, 'WC_Site', 'site_id', $db_offsets['WC_Site']); merge_add_offset($db_from, $db_to, 'WC_Site', 'site_vote_dif', $db_offsets['GWF_VoteScore']); merge_add_offset($db_from, $db_to, 'WC_Site', 'site_vote_fun', $db_offsets['GWF_VoteScore']); merge_use_mapping($db_from, $db_to, 'WC_Site', 'site_boardid', $db_offsets['GWF_ForumBoard']); merge_add_offset($db_from, $db_to, 'WC_Site', 'site_threadid', $db_offsets['GWF_ForumThread']); merge_table($db_from, $db_to, 'WC_Site'); self::fix_missing_site_threads($db_from, $db_to, $db_offsets); // WC_SiteAdmin merge_add_offset($db_from, $db_to, 'WC_SiteAdmin', 'siteadmin_uid', $db_offsets['GWF_User']); merge_add_offset($db_from, $db_to, 'WC_SiteAdmin', 'siteadmin_sid', $db_offsets['WC_Site']); merge_table($db_from, $db_to, 'WC_SiteAdmin'); // WC_SiteCats merge_add_offset($db_from, $db_to, 'WC_SiteCats', 'sitecat_sid', $db_offsets['WC_Site']); merge_table($db_from, $db_to, 'WC_SiteCats'); // WC_SiteDescr merge_add_offset($db_from, $db_to, 'WC_SiteDescr', 'site_desc_sid', $db_offsets['WC_Site']); merge_table($db_from, $db_to, 'WC_SiteDescr'); // WC_SiteFavorites merge_add_offset($db_from, $db_to, 'WC_SiteFavorites', 'sitefav_uid', $db_offsets['GWF_User']); merge_add_offset($db_from, $db_to, 'WC_SiteFavorites', 'sitefav_sid', $db_offsets['WC_Site']); merge_table($db_from, $db_to, 'WC_SiteFavorites'); // WC_SiteMaster merge_add_offset($db_from, $db_to, 'WC_SiteMaster', 'sitemas_uid', $db_offsets['GWF_User']); merge_add_offset($db_from, $db_to, 'WC_SiteMaster', 'sitemas_sid', $db_offsets['WC_Site']); merge_table($db_from, $db_to, 'WC_SiteMaster'); // WC_SolutionBlock # NOT NEEDED // WC_Warbox merge_add_offset($db_from, $db_to, 'WC_Warbox', 'wb_id', $db_offsets['WC_Warbox']); merge_add_offset($db_from, $db_to, 'WC_Warbox', 'wb_sid', $db_offsets['WC_Site']); merge_table($db_from, $db_to, 'WC_Warbox'); // WC_Warchall # DEPRECATED // WC_Warchalls # DEPRECATED // WC_Warflag merge_add_offset($db_from, $db_to, 'WC_Warflag', 'wf_id', $db_offsets['WC_Warflag']); merge_add_offset($db_from, $db_to, 'WC_Warflag', 'wf_wbid', $db_offsets['WC_Warbox']); merge_add_offset($db_from, $db_to, 'WC_Warflag', 'wf_last_solved_by', $db_offsets['GWF_User']); merge_table($db_from, $db_to, 'WC_Warflag'); // WC_Warflags merge_add_offset($db_from, $db_to, 'WC_Warflags', 'wf_wfid', $db_offsets['WC_Warflag']); merge_add_offset($db_from, $db_to, 'WC_Warflags', 'wf_uid', $db_offsets['GWF_User']); merge_table($db_from, $db_to, 'WC_Warflags'); // WC_WarToken merge_add_offset($db_from, $db_to, 'WC_WarToken', 'wt_uid', $db_offsets['GWF_User']); merge_table($db_from, $db_to, 'WC_WarToken'); }
public static function onMerge(GDO_Database $db_from, GDO_Database $db_to, array &$db_offsets, $prefix, $prevar) { self::includeClasses(); self::calcOffsets($db_from, $db_to, $db_offsets, $prefix, $prevar); self::calcMaps($db_from, $db_to, $db_offsets, $prefix, $prevar); self::fixPIDs($db_from, $db_to, $db_offsets, $prefix, $prevar); // GWF_ForumAttachment merge_add_offset($db_from, $db_to, 'GWF_ForumAttachment', 'fatt_aid', $db_offsets['GWF_ForumAttachment']); merge_add_offset($db_from, $db_to, 'GWF_ForumAttachment', 'fatt_uid', $db_offsets['GWF_User']); merge_add_offset($db_from, $db_to, 'GWF_ForumAttachment', 'fatt_pid', $db_offsets['GWF_ForumPost']); merge_table($db_from, $db_to, 'GWF_ForumAttachment'); // GWF_ForumBoard # DONE WITH MAPS AND FIX-PID // GWF_ForumOptions merge_add_offset($db_from, $db_to, 'GWF_ForumOptions', 'fopt_uid', $db_offsets['GWF_User']); merge_table($db_from, $db_to, 'GWF_ForumOptions'); // GWF_ForumPost merge_add_offset($db_from, $db_to, 'GWF_ForumPost', 'post_pid', $db_offsets['GWF_ForumPost']); merge_add_offset($db_from, $db_to, 'GWF_ForumPost', 'post_tid', $db_offsets['GWF_ForumThread']); merge_use_mapping($db_from, $db_to, 'GWF_ForumPost', 'post_gid', $db_offsets['GWF_Group']); merge_add_offset($db_from, $db_to, 'GWF_ForumPost', 'post_uid', $db_offsets['GWF_User']); merge_add_offset($db_from, $db_to, 'GWF_ForumPost', 'post_euid', $db_offsets['GWF_User']); merge_fix_uname($db_from, $db_to, $db_offsets, 'GWF_ForumPost', 'post_eusername'); merge_fix_uid_blob($db_from, $db_to, $db_offsets, 'GWF_ForumPost', 'post_thanks_by'); merge_fix_uname_blob($db_from, $db_to, $db_offsets, 'GWF_ForumPost', 'post_thanks_txt'); merge_fix_uid_blob($db_from, $db_to, $db_offsets, 'GWF_ForumPost', 'post_voted_up'); merge_fix_uid_blob($db_from, $db_to, $db_offsets, 'GWF_ForumPost', 'post_voted_down'); merge_table($db_from, $db_to, 'GWF_ForumPost'); // GWF_ForumPostHistory merge_add_offset($db_from, $db_to, 'GWF_ForumPostHistory', 'fph_id', $db_offsets['GWF_ForumPostHistory']); merge_add_offset($db_from, $db_to, 'GWF_ForumPostHistory', 'fph_pid', $db_offsets['GWF_ForumPost']); merge_use_mapping($db_from, $db_to, 'GWF_ForumPostHistory', 'fph_gid', $db_offsets['GWF_Group']); merge_add_offset($db_from, $db_to, 'GWF_ForumPostHistory', 'fph_euid', $db_offsets['GWF_User']); merge_table($db_from, $db_to, 'GWF_ForumPostHistory'); // GWF_ForumSubscrBoard merge_add_offset($db_from, $db_to, 'GWF_ForumSubscrBoard', 'subscr_uid', $db_offsets['GWF_User']); merge_use_mapping($db_from, $db_to, 'GWF_ForumSubscrBoard', 'subscr_bid', $db_offsets['GWF_ForumBoard']); merge_table($db_from, $db_to, 'GWF_ForumSubscrBoard'); // GWF_ForumSubscription merge_add_offset($db_from, $db_to, 'GWF_ForumSubscription', 'subscr_uid', $db_offsets['GWF_User']); merge_add_offset($db_from, $db_to, 'GWF_ForumSubscription', 'subscr_tid', $db_offsets['GWF_ForumThread']); merge_table($db_from, $db_to, 'GWF_ForumSubscription'); // GWF_ForumThread merge_add_offset($db_from, $db_to, 'GWF_ForumThread', 'thread_tid', $db_offsets['GWF_ForumThread']); merge_add_offset($db_from, $db_to, 'GWF_ForumThread', 'thread_uid', $db_offsets['GWF_User']); merge_add_offset($db_from, $db_to, 'GWF_ForumThread', 'thread_lastpost', $db_offsets['GWF_ForumPost']); merge_add_offset($db_from, $db_to, 'GWF_ForumThread', 'thread_pollid', $db_offsets['GWF_VoteMulti']); merge_use_mapping($db_from, $db_to, 'GWF_ForumThread', 'thread_bid', $db_offsets['GWF_ForumBoard']); merge_use_mapping($db_from, $db_to, 'GWF_ForumThread', 'thread_gid', $db_offsets['GWF_Group']); merge_fix_uname($db_from, $db_to, $db_offsets, 'GWF_ForumThread', 'thread_firstposter'); merge_fix_uname($db_from, $db_to, $db_offsets, 'GWF_ForumThread', 'thread_lastposter'); merge_fix_uid_blob($db_from, $db_to, $db_offsets, 'GWF_ForumThread', 'thread_unread'); merge_fix_uid_blob($db_from, $db_to, $db_offsets, 'GWF_ForumThread', 'thread_force_unread'); merge_table($db_from, $db_to, 'GWF_ForumThread'); }