From e4de841374d4ebe0675b153e7b1e1a35349cd2e3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 23 Feb 2021 11:06:44 +0100 Subject: [PATCH] Remove database encoding check from RebuildDataPage see 1238dfad4af8f94ea1c7aad09872fdf3d580cff5 see #3570 --- .../files/acp/templates/rebuildData.tpl | 24 +++++------------ .../lib/acp/page/RebuildDataPage.class.php | 26 ------------------- 2 files changed, 7 insertions(+), 43 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/rebuildData.tpl b/wcfsetup/install/files/acp/templates/rebuildData.tpl index edaa212ec7..4b7370de11 100644 --- a/wcfsetup/install/files/acp/templates/rebuildData.tpl +++ b/wcfsetup/install/files/acp/templates/rebuildData.tpl @@ -21,17 +21,12 @@ // callbacks callbackAbort: null, callbackSuccess: () => { - {if $convertEncoding} - var span = button.nextElementSibling; - if (span && span.nodeName === 'SPAN') elRemove(span); - - span = elCreate('span'); - span.innerHTML = ' {lang}wcf.acp.worker.success{/lang}'; - button.parentNode.insertBefore(span, button.nextElementSibling); - {else} - // force reload after converting the database encoding - window.location.reload(); - {/if} + var span = button.nextElementSibling; + if (span && span.nodeName === 'SPAN') elRemove(span); + + span = elCreate('span'); + span.innerHTML = ' {lang}wcf.acp.worker.success{/lang}'; + button.parentNode.insertBefore(span, button.nextElementSibling); } }); }); @@ -62,15 +57,10 @@ {foreach from=$objectTypes item=objectType} - {assign var=_allowRebuild value=true} - {if !$convertEncoding && $objectType->objectType != 'com.woltlab.wcf.databaseConvertEncoding'} - {assign var=_allowRebuild value=false} - {/if} -
{lang}wcf.acp.rebuildData.{@$objectType->objectType}{/lang} {lang}wcf.acp.rebuildData.{@$objectType->objectType}.description{/lang} diff --git a/wcfsetup/install/files/lib/acp/page/RebuildDataPage.class.php b/wcfsetup/install/files/lib/acp/page/RebuildDataPage.class.php index eddbdc25c3..adaa1dd928 100644 --- a/wcfsetup/install/files/lib/acp/page/RebuildDataPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/RebuildDataPage.class.php @@ -21,12 +21,6 @@ class RebuildDataPage extends AbstractPage */ public $activeMenuItem = 'wcf.acp.menu.link.maintenance.rebuildData'; - /** - * disallow any rebuild actions unless `wcfN_user_storage` uses `utf8mb4` - * @var bool - */ - public $convertEncoding = false; - /** * @inheritDoc */ @@ -61,25 +55,6 @@ class RebuildDataPage extends AbstractPage return 0; }); - - // We're disallowing rebuilding any other data unless the - // database encoding has been converted to utf8mb4. The - // user_storage table is used as a reference, as it is the - // last WCF table that holds a varchar column. - // - // Querying the columns for each table to reliably detect - // the need of an encoding conversion isn't an option, as - // it turns out to be super slow to retrieve this data. - $sql = "SHOW FULL COLUMNS FROM wcf" . WCF_N . "_user_storage"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(); - while ($row = $statement->fetchArray()) { - if ($row['Field'] === 'field') { - if (\preg_match('~^utf8mb4~', $row['Collation'])) { - $this->convertEncoding = true; - } - } - } } /** @@ -90,7 +65,6 @@ class RebuildDataPage extends AbstractPage parent::assignVariables(); WCF::getTPL()->assign([ - 'convertEncoding' => $this->convertEncoding, 'objectTypes' => $this->objectTypes, ]); } -- 2.20.1