From c5d28a9bbc17d3662900094784a344a94db94167 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sat, 26 May 2018 13:21:30 +0200 Subject: [PATCH] Profiler/Chars * prefix characters flagged for rename to prevent collision with real char names (multiple chars flagged for rename will still collide, but what the hoo haa) * alter table index to prevent creation and subsequent conflict with duplicate entries of the same char (realm/guid pair) --- includes/profiler.class.php | 3 +++ includes/types/profile.class.php | 4 ++++ setup/db_structure.sql | 4 ++-- setup/updates/1527333495_01.sql | 8 ++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 setup/updates/1527333495_01.sql diff --git a/includes/profiler.class.php b/includes/profiler.class.php index b9dd1393..49b5ace4 100644 --- a/includes/profiler.class.php +++ b/includes/profiler.class.php @@ -401,6 +401,9 @@ class Profiler 'achievementpoints' => 0 ); + // char is flagged for rename + if ($char['at_login'] & 0x1) + $data['name'] = 'RENAME-'.$data['name']; /********************/ /* talents + glyphs */ diff --git a/includes/types/profile.class.php b/includes/types/profile.class.php index 06be3ff8..8496eed8 100644 --- a/includes/types/profile.class.php +++ b/includes/types/profile.class.php @@ -589,6 +589,10 @@ class RemoteProfileList extends ProfileList $distrib[$curTpl['realm']]++; } + // char is pending rename + if ($curTpl['at_login'] & 0x1) + $curTpl['name'] = 'RENAME-'.$curTpl['name']; + $curTpl['cuFlags'] = 0; } diff --git a/setup/db_structure.sql b/setup/db_structure.sql index 4025fa67..6cede6b5 100644 --- a/setup/db_structure.sql +++ b/setup/db_structure.sql @@ -1886,7 +1886,7 @@ CREATE TABLE `aowow_profiler_profiles` ( `glyphs2` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL, `activespec` tinyint(1) unsigned NOT NULL, PRIMARY KEY (`id`), - UNIQUE KEY `realm_realmGUID_name` (`realm`,`realmGUID`,`name`), + UNIQUE KEY `realm_realmGUID` (`realm`,`realmGUID`), KEY `user` (`user`), KEY `guild` (`guild`), CONSTRAINT `FK_aowow_profiler_profiles_aowow_profiler_guild` FOREIGN KEY (`guild`) REFERENCES `aowow_profiler_guild` (`id`) ON DELETE SET NULL ON UPDATE CASCADE @@ -3090,7 +3090,7 @@ UNLOCK TABLES; LOCK TABLES `aowow_dbversion` WRITE; /*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */; -INSERT INTO `aowow_dbversion` VALUES (1525094405,0,NULL,NULL); +INSERT INTO `aowow_dbversion` VALUES (1527333496,0,NULL,NULL); /*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */; UNLOCK TABLES; diff --git a/setup/updates/1527333495_01.sql b/setup/updates/1527333495_01.sql new file mode 100644 index 00000000..53f2cc57 --- /dev/null +++ b/setup/updates/1527333495_01.sql @@ -0,0 +1,8 @@ +-- clear synced chars to prevent conflicts +DELETE FROM `aowow_profiler_profiles` WHERE `realmGUID` IS NOT NULL; +-- clear queue +DELETE FROM `aowow_profiler_sync`; +-- update unique index +ALTER TABLE `aowow_profiler_profiles` + DROP INDEX `realm_realmGUID_name`, + ADD UNIQUE INDEX `realm_realmGUID` (`realm`, `realmGUID`);