Commit d82fbdfc authored by Thomas Löffler's avatar Thomas Löffler
Browse files

Simplify check for available extension key by using special SQL query instead of

checking all extensions with foreach
parent adabe559
Pipeline #9071 passed with stages
in 7 minutes and 47 seconds
......@@ -228,18 +228,14 @@ class tx_ter_helper
{
$cleanedExtensionKey = str_replace('_', '', $extensionKey);
$allExtensions = GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable('tx_ter_extensionkeys')
->select(['extensionkey'], 'tx_ter_extensionkeys')
->fetchAll();
foreach ($allExtensions as $extension) {
if ($cleanedExtensionKey === str_replace('_', '', $extension['extensionkey'])) {
return false;
}
}
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_ter_extensionkeys');
$result = $queryBuilder->select('extensionkey')
->from('tx_ter_extensionkeys')
->add('where', 'REPLACE(extensionkey, "_", "") = ' . $queryBuilder->createNamedParameter($cleanedExtensionKey))
->execute()
->rowCount();
return true;
return $result === 0;
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment