From 485df5c928f8a3bbfe87bad92f58c10c73e93e7d Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 7 Sep 2017 14:42:18 +0200 Subject: [PATCH] Force disable the HTML bbcode on upgrade Fixes #2388 --- com.woltlab.wcf/package.xml | 2 + ...update_com.woltlab.wcf_3.1_postUpgrade.php | 39 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 wcfsetup/install/files/acp/update_com.woltlab.wcf_3.1_postUpgrade.php diff --git a/com.woltlab.wcf/package.xml b/com.woltlab.wcf/package.xml index 70e35347b4..659e520f7d 100644 --- a/com.woltlab.wcf/package.xml +++ b/com.woltlab.wcf/package.xml @@ -84,6 +84,8 @@ defaultStyle.tar + + acp/update_com.woltlab.wcf_3.1_postUpgrade.php diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.1_postUpgrade.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.1_postUpgrade.php new file mode 100644 index 0000000000..bb273ef6ef --- /dev/null +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_3.1_postUpgrade.php @@ -0,0 +1,39 @@ + + * @package WoltLabSuite\Core + */ +// force disable of HTML bbcode for all groups +$sql = "UPDATE wcf".WCF_N."_user_group_option_value + SET optionValue = ? + WHERE groupID = ? + AND optionID = ?"; +$updateStatement = WCF::getDB()->prepareStatement($sql); + +$sql = "SELECT * + FROM wcf".WCF_N."_user_group_option_value + WHERE optionID IN ( + SELECT optionID + FROM wcf".WCF_N."_user_group_option + WHERE optionType = ? + )"; +$statement = WCF::getDB()->prepareStatement($sql); +$statement->execute(['BBCodeSelect']); + +WCF::getDB()->beginTransaction(); +while ($row = $statement->fetchArray()) { + $value = $row['optionValue']; + if (!empty($value)) $value .= ','; + $value .= 'html'; + + $updateStatement->execute([ + $value, + $row['groupID'], + $row['optionID'] + ]); +} +WCF::getDB()->commitTransaction(); -- 2.20.1