summaryrefslogtreecommitdiff
path: root/classes/db.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-15 16:55:55 +0300
committerAndrew Dolgov <[email protected]>2021-02-15 16:55:55 +0300
commit5d42ce553faa3a3eb2a12d66c9b0870ad778c163 (patch)
treed28535636fa52926d93f18b161a85f2bfe0a8586 /classes/db.php
parent9f55454f63b11ad8d2b2e0a8264a0f0dae919f6b (diff)
drop legacy DB interface and related sanity checks
Diffstat (limited to 'classes/db.php')
-rwxr-xr-xclasses/db.php47
1 files changed, 0 insertions, 47 deletions
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 @@
<?php
class Db
{
-
/* @var Db $instance */
private static $instance;
- /* @var IDb $adapter */
- private $adapter;
-
private $link;
/* @var PDO $pdo */
@@ -17,38 +13,6 @@ class Db
//
}
- private function legacy_connect() {
-
- user_error("Legacy connect requested to " . DB_TYPE, E_USER_NOTICE);
-
- $er = error_reporting(E_ALL);
-
- switch (DB_TYPE) {
- case "mysql":
- $this->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();