diff --git a/phpBB/phpbb/db/tools/doctrine.php b/phpBB/phpbb/db/tools/doctrine.php index 1196ac08be..3f6a11ba60 100644 --- a/phpBB/phpbb/db/tools/doctrine.php +++ b/phpBB/phpbb/db/tools/doctrine.php @@ -15,6 +15,7 @@ namespace phpbb\db\tools; use Doctrine\DBAL\Connection; use Doctrine\DBAL\Exception; +use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Schema\AbstractAsset; use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\Index; @@ -363,6 +364,24 @@ class doctrine implements tools_interface ); } + /** + * Truncate the table + * + * @param string $table_name + * @return void + */ + public function sql_truncate_table(string $table_name) + { + try + { + $this->connection->executeQuery($this->get_schema_manager()->getDatabasePlatform()->getTruncateTableSQL($table_name)); + } + catch (Exception $e) + { + return; + } + } + /** * Returns an array of indices for either unique and primary keys, or simple indices. *