public function CleanerTablesClearEventSubscriber::clearTables in Cleaner 8.2
Cleaner tables clearing.
File
- src/
EventSubscriber/ CleanerTablesClearEventSubscriber.php, line 82
Class
- CleanerTablesClearEventSubscriber
- Class CleanerTablesClearEventSubscriber.
Namespace
Drupal\cleaner\EventSubscriberCode
public function clearTables() {
if ($this->config
->get('cleaner_additional_tables') != '') {
$cleared = 0;
$tables = $this
->getAdditionalTables();
foreach ($tables as $table) {
if (!$this->database
->schema()
->tableExists($table)) {
continue;
}
if ($this->database
->query("TRUNCATE {$table}")
->execute()) {
$cleared++;
}
}
$this->loggerChannel
->info('Cleaner cleared @count additional tables', [
'@count' => $cleared,
]);
}
}