From 5d42ce553faa3a3eb2a12d66c9b0870ad778c163 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 15 Feb 2021 16:55:55 +0300 Subject: drop legacy DB interface and related sanity checks --- classes/db.php | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) (limited to 'classes/db.php') diff --git a/classes/db.php b/classes/db.php index 6199c82bb..490cecd57 100755 --- a/classes/db.php +++ b/classes/db.php @@ -1,13 +1,9 @@ adapter = new Db_Mysqli(); - break; - case "pgsql": - $this->adapter = new Db_Pgsql(); - break; - default: - die("Unknown DB_TYPE: " . DB_TYPE); - } - - if (!$this->adapter) { - print("Error initializing database adapter for " . DB_TYPE); - exit(100); - } - - $this->link = $this->adapter->connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, defined('DB_PORT') ? DB_PORT : ""); - - if (!$this->link) { - print("Error connecting through adapter: " . $this->adapter->last_error()); - exit(101); - } - - error_reporting($er); - } - // this really shouldn't be used unless a separate PDO connection is needed // normal usage is Db::pdo()->prepare(...) etc public function pdo_connect() { @@ -92,17 +56,6 @@ class Db return self::$instance; } - public static function get() : Db { - if (self::$instance == null) - self::$instance = new self(); - - if (!self::$instance->adapter) { - self::$instance->legacy_connect(); - } - - return self::$instance->adapter; - } - public static function pdo() : PDO { if (self::$instance == null) self::$instance = new self(); -- cgit v1.2.3