From 3244154fc679012e2bdc58b086029cb295108e59 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 27 Aug 2021 11:32:50 +0200 Subject: [PATCH] Add update_com.woltlab.wcf_5.5_ensureInnoDbSearch.php --- ...com.woltlab.wcf_5.5_ensureInnoDbSearch.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 wcfsetup/install/files/acp/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); +} -- 2.20.1