From eaac290caa84f559272a2fb46fe072180951353d Mon Sep 17 00:00:00 2001 From: vorbild Date: Wed, 29 Jan 2025 07:45:01 +0100 Subject: [PATCH] src/wp_db_light.php aktualisiert --- src/wp_db_light.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/wp_db_light.php b/src/wp_db_light.php index 10fa414..ef236af 100644 --- a/src/wp_db_light.php +++ b/src/wp_db_light.php @@ -5,10 +5,15 @@ namespace WP_DB; class WP_DB_LIGHT extends WP_DB { public $dbName; + public $path = false; function connect() { - $databaseFile = '/sql/'.$this->dbName.'.db'; + $path = '/sql/'; + if ($this->path) { + $path .= $this->path . "/"; + } + $databaseFile = $path . $this->dbName . '.db'; $pdo = new \PDO("sqlite:$databaseFile"); // Set the error mode to exception @@ -17,5 +22,10 @@ class WP_DB_LIGHT extends WP_DB return $pdo; } - + function createPathIfnotExists($folderPath) + { + if (!file_exists($folderPath)) { + mkdir($folderPath, 0777, true); + } + } }