From b0612104ec5f11259b4c6fadd947ceb4b0589b2c Mon Sep 17 00:00:00 2001 From: David Albrecht Date: Tue, 8 Oct 2019 13:17:30 +0200 Subject: [PATCH] run VACUUM command to free disc space --- src/Model/Table/RequestsTable.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Model/Table/RequestsTable.php b/src/Model/Table/RequestsTable.php index c30c5a2d4..096f4c96f 100644 --- a/src/Model/Table/RequestsTable.php +++ b/src/Model/Table/RequestsTable.php @@ -13,6 +13,7 @@ namespace DebugKit\Model\Table; use Cake\Core\Configure; +use Cake\Database\Driver\Sqlite; use Cake\ORM\Query; use Cake\ORM\Table; use DebugKit\Model\Entity\Request; @@ -108,5 +109,10 @@ public function gc() $statement = $query->execute(); $statement->closeCursor(); + + $conn = $this->getConnection(); + if ($conn->getDriver() instanceof Sqlite) { + $conn->execute('VACUUM;'); + } } }