--- /dev/null
+<?php
+namespace wcf\system\worker;
+use wcf\data\object\type\ObjectTypeCache;
+use wcf\system\request\LinkHandler;
+use wcf\system\search\SearchIndexManager;
+use wcf\system\WCF;
+
+/**
+ * Worker implementation for search table engine conversion.
+ *
+ * @author Tim Duesterhus, Alexander Ebert
+ * @copyright 2001-2020 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\System\Worker
+ */
+class SearchEngineConvertInnoDbWorker extends AbstractRebuildDataWorker {
+ /**
+ * @inheritDoc
+ */
+ protected $limit = 1;
+
+ /**
+ * @inheritDoc
+ */
+ public function initObjectList() {
+ // This rebuild worker has no database object list
+ // therefore we do nothing in this method an overwrite
+ // the parent method, that it does not throw an exception.
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function countObjects() {
+ if ($this->count === null) {
+ $this->count = count($this->getTables());
+ }
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getProceedURL() {
+ return LinkHandler::getInstance()->getLink('RebuildData');
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function validate() {
+ WCF::getSession()->checkPermissions(['admin.management.canRebuildData']);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function execute() {
+ $tables = $this->getTables();
+
+ $sql = "SELECT LOWER(ENGINE)
+ FROM INFORMATION_SCHEMA.TABLES
+ WHERE TABLE_NAME = ?
+ AND TABLE_SCHEMA = ?";
+ $checkStatement = WCF::getDB()->prepareStatement($sql);
+
+ $convertTables = array_slice($tables, $this->limit * $this->loopCount, $this->limit);
+ foreach ($convertTables as $table) {
+ $checkStatement->execute([
+ $table,
+ WCF::getDB()->getDatabaseName(),
+ ]);
+ if ($checkStatement->fetchSingleColumn() !== 'innodb') {
+ $sql = "ALTER TABLE " . $table . " ENGINE = InnoDB";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute();
+ }
+ }
+ }
+
+ /**
+ * Returns the list of known database tables.
+ *
+ * @return string[]
+ */
+ protected function getTables() {
+ $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.searchableObjectType');
+ $tableNames = [];
+ foreach ($objectTypes as $objectType) {
+ $tableNames[] = SearchIndexManager::getTableName($objectType->objectType);
+ }
+
+ return $tableNames;
+ }
+}
<item name="wcf.acp.rebuildData.com.woltlab.wcf.activityPointEvent.description"><![CDATA[Berechnet Punkte pro Aktivität neu]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.activityPointItems"><![CDATA[Punkte-Aktivitäten aktualisieren]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.activityPointItems.description"><![CDATA[Berechnet Anzahl an Aktivitäten neu, für die Benutzer Punkte erhalten; aktualisiert Benutzerränge]]></item>
+ <item name="wcf.acp.rebuildData.com.woltlab.wcf.searchEngineConvertInnoDb.description"><![CDATA[Stellt die Tabellen des Suchindex auf die InnoDB-Engine um.]]></item>
+ <item name="wcf.acp.rebuildData.com.woltlab.wcf.searchEngineConvertInnoDb"><![CDATA[Suchindex auf InnoDB umstellen]]></item>
</category>
<category name="wcf.acp.rescueMode">
<item name="wcf.acp.rescueMode"><![CDATA[Systemwiederherstellung]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.activityPointEvent.description"><![CDATA[Recalculates points per activity.]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.activityPointItems"><![CDATA[Rebuilds Point Activities]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.activityPointItems.description"><![CDATA[Recalculates the number of activities for which users get points and rebuilds user ranks.]]></item>
+ <item name="wcf.acp.rebuildData.com.woltlab.wcf.searchEngineConvertInnoDb.description"><![CDATA[Migrates the search engine tables to the InnoDB storage engine.]]></item>
+ <item name="wcf.acp.rebuildData.com.woltlab.wcf.searchEngineConvertInnoDb"><![CDATA[Migrate Search Index to InnoDB]]></item>
</category>
<category name="wcf.acp.rescueMode">
<item name="wcf.acp.rescueMode"><![CDATA[Rescue Mode]]></item>