From c5e9762830e9678b4266435e212307e42a1228e3 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sat, 28 Apr 2018 11:32:22 +0200 Subject: [PATCH] Profiler/Profiles * allow strings with less then 3 chars in name search * store name as binary to allow accent-sensitive search (note: guilds and arenateams have the same issue but utf8mb4_bin can't be applied blindly as the search also becomes case-sensitive (wich is already handled for profiles)) --- includes/types/profile.class.php | 4 ++-- setup/db_structure.sql | 2 +- setup/updates/1524907872_01.sql | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 setup/updates/1524907872_01.sql diff --git a/includes/types/profile.class.php b/includes/types/profile.class.php index 59e6fa2c..5c258eba 100644 --- a/includes/types/profile.class.php +++ b/includes/types/profile.class.php @@ -324,8 +324,8 @@ class ProfileListFilter extends Filter // name [str] - the table is case sensitive. Since i down't want to destroy indizes, lets alter the search terms if (!empty($_v['na'])) { - $lower = $this->modularizeString([$k.'.name'], Util::lower($_v['na']), !empty($_v['ex']) && $_v['ex'] == 'on'); - $proper = $this->modularizeString([$k.'.name'], Util::ucWords($_v['na']), !empty($_v['ex']) && $_v['ex'] == 'on'); + $lower = $this->modularizeString([$k.'.name'], Util::lower($_v['na']), !empty($_v['ex']) && $_v['ex'] == 'on', true); + $proper = $this->modularizeString([$k.'.name'], Util::ucWords($_v['na']), !empty($_v['ex']) && $_v['ex'] == 'on', true); $parts[] = ['OR', $lower, $proper]; } diff --git a/setup/db_structure.sql b/setup/db_structure.sql index 733d54d5..ad1c08e3 100644 --- a/setup/db_structure.sql +++ b/setup/db_structure.sql @@ -1827,7 +1827,7 @@ CREATE TABLE `aowow_profiler_profiles` ( `copy` int(10) unsigned DEFAULT NULL, `icon` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `user` int(11) unsigned DEFAULT NULL, - `name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, + `name` varchar(50) COLLATE utf8mb4_bin NOT NULL, `race` tinyint(3) unsigned NOT NULL, `class` tinyint(3) unsigned NOT NULL, `level` tinyint(3) unsigned NOT NULL, diff --git a/setup/updates/1524907872_01.sql b/setup/updates/1524907872_01.sql new file mode 100644 index 00000000..cb36cb0e --- /dev/null +++ b/setup/updates/1524907872_01.sql @@ -0,0 +1 @@ +ALTER TABLE `aowow_profiler_profiles` CHANGE COLUMN `name` `name` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_bin' AFTER `user`;