function searchindex_wipe_truncate_table in Search Index Wipe 8
Same name and namespace in other branches
- 7 searchindex_wipe.module \searchindex_wipe_truncate_table()
Helper function to truncate search related tables.
3 calls to searchindex_wipe_truncate_table()
- drush_searchindex_wipe in ./
searchindex_wipe.drush.inc - Ask for confirmation and drops indexes.
- SearchIndexWipeCommands::wipe in src/
Commands/ SearchIndexWipeCommands.php - Wipes Search module generated index.
- SearchIndexWipeConfirm::submitForm in src/
Form/ SearchIndexWipeConfirm.php - Form submission handler.
File
- ./
searchindex_wipe.module, line 37 - Enables wipe of search index.
Code
function searchindex_wipe_truncate_table() {
// Taken code from drupal_uninstall_schema.
$schema = drupal_get_module_schema('search');
foreach ($schema as $table_name => $table) {
// Truncate search related tables.
\Drupal::database()
->truncate($table_name)
->execute();
}
\Drupal::messenger()
->addMessage(t('Search Index Cleared, Please rebuilt the index by running cron.'));
}