From 69049acef2ee593d65af7bcb62055dae6c9615b4 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Tue, 20 Oct 2020 21:53:28 +0200 Subject: Remove some unused DB functions / globals Now it begins to pay off, that (nearly) all model classes were updated to use the new Database class :) --- ratatoeskr/main.php | 1 - ratatoeskr/setup/setup.php | 1 - ratatoeskr/sys/db.php | 34 +--------------------------------- ratatoeskr/sys/models.php | 2 -- 4 files changed, 1 insertion(+), 37 deletions(-) diff --git a/ratatoeskr/main.php b/ratatoeskr/main.php index 6353050..c5f0b89 100644 --- a/ratatoeskr/main.php +++ b/ratatoeskr/main.php @@ -48,7 +48,6 @@ function _ratatoeskr() global $backend_subactions, $ste, $url_handlers, $ratatoeskr_settings, $plugin_objs, $api_compat; session_start(); - db_connect(); clean_database(); if (isset($ratatoeskr_settings["debugmode"]) and $ratatoeskr_settings["debugmode"]) { diff --git a/ratatoeskr/setup/setup.php b/ratatoeskr/setup/setup.php index c18fff0..d096afd 100644 --- a/ratatoeskr/setup/setup.php +++ b/ratatoeskr/setup/setup.php @@ -47,7 +47,6 @@ if (isset($_POST["apply_setup"])) { $config["mysql"]["prefix"] = $_POST["table_prefix"]; try { - db_connect(); create_mysql_tables(); /* Writing some demo data to database */ diff --git a/ratatoeskr/sys/db.php b/ratatoeskr/sys/db.php index a2ccc13..9272256 100644 --- a/ratatoeskr/sys/db.php +++ b/ratatoeskr/sys/db.php @@ -20,24 +20,6 @@ if (!defined("SETUP")) { require_once(dirname(__FILE__) . "/utils.php"); -// The global database connection. -// It's usage is deprecated, use the Database object supplied by Env::database() instead. -/** @var PDO|null $db_con */ -$db_con = null; - -/** - * Establish the global connection to the MySQL database. - * This sets the global {@see $db_con}. - * - * @deprecated Use the {@see Database} object supplied by {@see Env::database()} instead. - */ -function db_connect(): void -{ - global $db_con; - - $db_con = Env::getGlobal()->database()->getPdo(); -} - /** * Substitutes "PREFIX_" in the input string with the prefix from the config. * @@ -51,21 +33,7 @@ function sub_prefix($q): string } /** - * Prepares a SQL statement using the global DB connection. - * This will also replace "PREFIX_" with the prefix defined in 'config.php'. - * - * @param mixed|string $q The query / statement to prepare. - * @return PDOStatement - * - * @deprecated Use {@see Database::prepStmt()} instead. - */ -function prep_stmt($q): PDOStatement -{ - return Env::getGlobal()->database()->prepStmt((string)$q); -} - -/** - * Prepares statement (1st argument) with {@see prep_stmt()} and executes it with the remaining arguments. + * Prepares statement (1st argument) like {@see Database::prepStmt()} and executes it with the remaining arguments. * * @param mixed ...$args * @return PDOStatement diff --git a/ratatoeskr/sys/models.php b/ratatoeskr/sys/models.php index 6a90a8d..7f5cb4c 100644 --- a/ratatoeskr/sys/models.php +++ b/ratatoeskr/sys/models.php @@ -20,8 +20,6 @@ require_once(dirname(__FILE__) . "/utils.php"); require_once(dirname(__FILE__) . "/textprocessors.php"); require_once(dirname(__FILE__) . "/pluginpackage.php"); -db_connect(); - /* * Array: $imagetype_file_extensions * Array of default file extensions for most IMAGETYPE_* constants -- cgit v1.2.3-54-g00ecf