// 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>
*/
public $activeMenuItem = 'wcf.acp.menu.link.maintenance.rebuildData';
- /**
- * disallow any rebuild actions unless `wcfN_user_storage` uses `utf8mb4`
- * @var bool
- */
- public $convertEncoding = false;
-
/**
* @inheritDoc
*/
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;
- }
- }
- }
}
/**
parent::assignVariables();
WCF::getTPL()->assign([
- 'convertEncoding' => $this->convertEncoding,
'objectTypes' => $this->objectTypes,
]);
}