-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Add check if MySQL indexes are enabled
Show an error in the backend module if MySQL indexes are disabled together with note why this can happen and what to do.
- Loading branch information
1 parent
06ac0a8
commit 57b638e
Showing
4 changed files
with
50 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Tpwd\KeSearch\Utility; | ||
|
||
use TYPO3\CMS\Core\Database\ConnectionPool; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
||
class SanityCheckUtility | ||
{ | ||
public static function IsIndexTableIndexesEnabled(): bool | ||
{ | ||
$indexEnabled = true; | ||
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); | ||
$connection = $connectionPool->getConnectionForTable('tx_kesearch_index'); | ||
$statement = $connection->prepare('SHOW INDEX FROM tx_kesearch_index'); | ||
$resultRows = $statement->executeQuery()->fetchAllAssociative(); | ||
if (!empty($resultRows)) { | ||
foreach ($resultRows as $resultRow) { | ||
if ($resultRow['Comment'] == 'disabled') { | ||
$indexEnabled = false; | ||
} | ||
} | ||
} | ||
return $indexEnabled; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters