getTableList() as $table) { $connection = $this->connectionPool->getConnectionForTable($table['name']); if ($connection->createSchemaManager()->tablesExist([$table['name']])) { $table['rowCount'] = $connection->count( '*', $table['name'], [] ); $tableStatistics[] = $table; } } return $tableStatistics; } /** * Truncate a table from $this->tableList */ public function clearSelectedTable(string $tableName): void { $tableFound = false; foreach ($this->getTableList() as $table) { if ($table['name'] === $tableName) { $tableFound = true; break; } } if (!$tableFound) { throw new \RuntimeException( 'Selected table ' . $tableName . ' can not be cleared', 1501942151 ); } $this->connectionPool->getConnectionForTable($tableName)->truncate($tableName); } /** * List of tables and their description */ private function getTableList(): array { $tableList = [ [ 'name' => 'be_sessions', 'description' => 'Backend user sessions', ], [ 'name' => 'fe_sessions', 'description' => 'Frontend user sessions', ], [ 'name' => 'sys_lockedrecords', 'description' => 'Record locking of backend user editing', ], [ 'name' => 'sys_http_report', 'description' => 'Requests with Content-Security-Policy Reports', ], [ 'name' => 'sys_log', 'description' => 'General log table', ], ]; if ($this->packageManager->isPackageActive('workspaces')) { $tableList[] = [ 'name' => 'sys_preview', 'description' => 'Workspace preview links', ]; } if ($this->packageManager->isPackageActive('extensionmanager')) { $tableList[] = [ 'name' => 'tx_extensionmanager_domain_model_extension', 'description' => 'List of TER extensions', ]; } return $tableList; } }