src/wp_db_light.php aktualisiert

This commit is contained in:
2025-01-29 07:45:01 +01:00
parent 8e1cdaedd2
commit eaac290caa

View File

@@ -5,10 +5,15 @@ namespace WP_DB;
class WP_DB_LIGHT extends WP_DB class WP_DB_LIGHT extends WP_DB
{ {
public $dbName; public $dbName;
public $path = false;
function connect() 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"); $pdo = new \PDO("sqlite:$databaseFile");
// Set the error mode to exception // Set the error mode to exception
@@ -17,5 +22,10 @@ class WP_DB_LIGHT extends WP_DB
return $pdo; return $pdo;
} }
function createPathIfnotExists($folderPath)
{
if (!file_exists($folderPath)) {
mkdir($folderPath, 0777, true);
}
}
} }