Added PgSQL support in all automation scripts

This commit is contained in:
Pinga 2023-08-15 11:55:31 +03:00
parent 2ebeed2500
commit ba05bd618c
7 changed files with 93 additions and 47 deletions

View file

@ -1,10 +1,17 @@
<?php
// Connect to the MySQL database using PDO
$c = require 'config.php';
$dsn = "mysql:host={$c['mysql_host']};dbname={$c['mysql_database']};port={$c['mysql_port']}";
$dbh = new PDO($dsn, $c['mysql_username'], $c['mysql_password']);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$c = require_once 'config.php';
require_once 'helpers.php';
// Connect to the database
$dsn = "{$c['db_type']}:host={$c['db_host']};dbname={$c['db_database']};port={$c['db_port']}";
try {
$dbh = new PDO($dsn, $c['db_username'], $c['db_password']);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
die("Connection failed: " . $e->getMessage());
}
// Auto-Renew Grace Period
$auto_renew = 0;