From: Tim Düsterhus Date: Fri, 27 Aug 2021 09:32:50 +0000 (+0200) Subject: Add update_com.woltlab.wcf_5.5_ensureInnoDbSearch.php X-Git-Tag: 5.5.0_Alpha_1~464^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3244154fc679012e2bdc58b086029cb295108e59;p=GitHub%2FWoltLab%2FWCF.git Add update_com.woltlab.wcf_5.5_ensureInnoDbSearch.php --- diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_ensureInnoDbSearch.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_ensureInnoDbSearch.php new file mode 100644 index 0000000000..438253c965 --- /dev/null +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_ensureInnoDbSearch.php @@ -0,0 +1,33 @@ +getObjectTypes('com.woltlab.wcf.searchableObjectType'); +$tableNames = []; +foreach ($objectTypes as $objectType) { + $tableNames[] = SearchIndexManager::getTableName($objectType->objectType); +} +$conditionBuilder = new PreparedStatementConditionBuilder(true); +$conditionBuilder->add('TABLE_NAME IN (?)', [$tableNames]); +$conditionBuilder->add('TABLE_SCHEMA = ?', [WCF::getDB()->getDatabaseName()]); +$conditionBuilder->add('ENGINE <> ?', ['InnoDB']); + +$sql = "SELECT COUNT(*) + FROM INFORMATION_SCHEMA.TABLES + " . $conditionBuilder; +$statement = WCF::getDB()->prepareStatement($sql); +$statement->execute($conditionBuilder->getParameters()); +$nonInnoDbSearch = $statement->fetchSingleColumn() > 0; + +if ($nonInnoDbSearch) { + if (WCF::getLanguage()->getFixedLanguageCode() === 'de') { + $message = "Es wurden noch nicht alle Tabellen auf InnoDB migriert."; + } else { + $message = "The migration to InnoDB was not yet performed for all database tables."; + } + + throw new \RuntimeException($message); +}