From 4b997e0c8cad0bae608158dfca662660bf94cd5c Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 1 Sep 2020 16:44:53 +0200 Subject: [PATCH] Report any duplicate usernames before applying the upgrade Fixes #3544 --- com.woltlab.wcf/files_pre.tar | Bin 4910080 -> 4912128 bytes com.woltlab.wcf/package.xml | 3 ++ .../update_com.woltlab.wcf_5.3_preUpdate.php | 31 ++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3_preUpdate.php diff --git a/com.woltlab.wcf/files_pre.tar b/com.woltlab.wcf/files_pre.tar index 7d79221d99332885d3a9472db18efb9bf5ca0ea7..5835c63a372f0647dcf1f1bb607fa0224634461a 100644 GIT binary patch delta 1158 zcmZ8fO>Y}j6pc%P%x+%7Uo!CxVLxSBVu9MW51T_s6q9_{AT#rZfjHfei z)T9WxizBgQQ3>x53&e(1H;sh40Aq+zMsdBMY87s|I%5(DYm|p=o==}U9)q`F#SdS!Os&X2D&~wJ+0F;)w^uo4yn@*$nbW_ ziu|5q8j2|jIT&@zxuz7#5S$8Fd%|OLyd1GcjHKTrncm6~586)Z-l? z;D8!!4%Db__KW^*;MiRykg^Cbl#Ase-R$>N%V^W8+g=;tLNiGOMz3V9Jk>Y0)^B8!|D3L^ zT;KTc5J<6QX_}#%^_A^)`KGr8I|y`b_4>xvN3{G&f=wuNZEfk}YwN4YI{kkOs?p{2 zqDWKXu*;qjfx^D9V6(cqoXr(#a?rjwx|sm7@ff)yEdy1k@eZ4j;_RoT&*D_6@XYH+}6b8r7qXi9?aa$vEyKo>%BR{KKN zxF;+!%YWo-cuW#WSK@Ib*}Nm}kQ?=s1(JJ?#-bpTiC2)#~`@4as{9fwAf z{{kTk7A;v8wjyHHnspmCMQw?R+qPp@!k(m*w2Z8MIe7&K4iz0KId4<0?~c=qB|SI?VwANoFj2eZH7SNtdVE<}Ri9J9qa_W%F@ diff --git a/com.woltlab.wcf/package.xml b/com.woltlab.wcf/package.xml index f3ea210b97..c0b97fd4ad 100644 --- a/com.woltlab.wcf/package.xml +++ b/com.woltlab.wcf/package.xml @@ -55,6 +55,9 @@ Guzzle can not be found during the development of the regular file PIP. --> files_pre.tar + + acp/update_com.woltlab.wcf_5.3_preUpdate.php + acp/update_com.woltlab.wcf_5.3.php diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3_preUpdate.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3_preUpdate.php new file mode 100644 index 0000000000..bbcb970fc6 --- /dev/null +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3_preUpdate.php @@ -0,0 +1,31 @@ + + * @package WoltLabSuite\Core + */ + +$sql = "SELECT username, COUNT(username) + FROM wcf" . WCF_N . "_user + GROUP BY username + HAVING COUNT(username) > ?"; +$statement = WCF::getDB()->prepareStatement($sql); +$statement->execute([1]); +$usernames = $statement->fetchList('username'); + +if (!empty($usernames)) { + if (WCF::getLanguage()->getFixedLanguageCode() === 'de') { + $message = "Ein oder mehr Benutzernamen sind mehrfach gegeben, diese Konten müssen zusammengeführt oder gelöscht werden: %s"; + } + else { + $message = "One or more usernames exist multiple times, these accounts must be merged or deleted: %s"; + } + + throw new \RuntimeException(sprintf($message, implode(', ', $usernames))); +} -- 2.20.1