Remove database encoding check from RebuildDataPage
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 23 Feb 2021 10:06:44 +0000 (11:06 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 23 Feb 2021 10:06:44 +0000 (11:06 +0100)
see 1238dfad4af8f94ea1c7aad09872fdf3d580cff5
see #3570

wcfsetup/install/files/acp/templates/rebuildData.tpl
wcfsetup/install/files/lib/acp/page/RebuildDataPage.class.php

index edaa212ec787d7d10394991f7dbf030b20f322b8..4b7370de114bfeea7e739ef0a670894d52073b06 100644 (file)
                                        // callbacks
                                        callbackAbort: null,
                                        callbackSuccess: () => {
-                                               {if $convertEncoding}
-                                                       var span = button.nextElementSibling;
-                                                       if (span && span.nodeName === 'SPAN') elRemove(span);
-                                                               
-                                                       span = elCreate('span');
-                                                       span.innerHTML = ' <span class="icon icon16 fa-check green"></span> {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 = ' <span class="icon icon16 fa-check green"></span> {lang}wcf.acp.worker.success{/lang}';
+                                               button.parentNode.insertBefore(span, button.nextElementSibling);
                                        }
                                });
                        });
        </header>
        
        {foreach from=$objectTypes item=objectType}
-               {assign var=_allowRebuild value=true}
-               {if !$convertEncoding && $objectType->objectType != 'com.woltlab.wcf.databaseConvertEncoding'}
-                       {assign var=_allowRebuild value=false}
-               {/if}
-               
                <dl class="wide">
                        <dd>
                                <a href="#"
-                                  class="button small jsRebuildDataWorker{if !$_allowRebuild} disabled{/if}"
+                                  class="button small jsRebuildDataWorker"
                                   data-class-name="{$objectType->className}" data-object-type="{$objectType->objectType}"
                                >{lang}wcf.acp.rebuildData.{@$objectType->objectType}{/lang}</a>
                                <small>{lang}wcf.acp.rebuildData.{@$objectType->objectType}.description{/lang}</small>
index eddbdc25c353a533a773c63c4826a6839d249081..adaa1dd928309432a075491555a3f2e007f27faa 100644 (file)
@@ -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,
         ]);
     }