Commit 5eaff12b authored by catch's avatar catch
Browse files

Issue #3145412 by pavnish, cburschka, amateescu: Connection::__destruct()...

Issue #3145412 by pavnish, cburschka, amateescu: Connection::__destruct() can't delete the sqlite file

(cherry picked from commit 0073e148)
parent 27ab4c6e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -184,9 +184,9 @@ public function __destruct() {

          // We can prune the database file if it doesn't have any tables.
          if ($count == 0 && $this->connectionOptions['database'] != ':memory:' && file_exists($this->connectionOptions['database'] . '-' . $prefix)) {
            // Detaching the database fails at this point, but no other queries
            // are executed after the connection is destructed so we can simply
            // remove the database file.
            // Detach the database.
            $this->query('DETACH DATABASE :schema', [':schema' => $prefix]);
            // Destroy the database file.
            unlink($this->connectionOptions['database'] . '-' . $prefix);
          }
        }