remove db_connect, db_close; CLI fixes
This commit is contained in:
parent
6322ac79a0
commit
eefaa2df38
|
@ -48,8 +48,6 @@
|
|||
|
||||
$script_started = microtime(true);
|
||||
|
||||
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
||||
|
||||
if (!init_plugins()) return;
|
||||
|
||||
header("Content-Type: text/json; charset=utf-8");
|
||||
|
@ -154,6 +152,4 @@
|
|||
header("Content-Type: text/json");
|
||||
print json_encode(array("error" => array("code" => 7)));
|
||||
|
||||
// We close the connection to database.
|
||||
db_close();
|
||||
?>
|
||||
|
|
|
@ -4,6 +4,7 @@ class Db_Mysql implements IDb {
|
|||
|
||||
function connect($host, $user, $pass, $db, $port) {
|
||||
$this->link = mysql_connect($host, $user, $pass);
|
||||
|
||||
if ($this->link) {
|
||||
$result = mysql_select_db($db, $this->link);
|
||||
if (!$result) {
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
<?php
|
||||
|
||||
function db_connect($host, $user, $pass, $db) {
|
||||
return Db::get()->connect($host, $user, $pass, $db, 0);
|
||||
}
|
||||
|
||||
function db_escape_string( $s, $strip_tags = true) {
|
||||
return Db::get()->escape_string($s, $strip_tags);
|
||||
}
|
||||
|
@ -25,10 +21,6 @@ function db_fetch_result($result, $row, $param) {
|
|||
return Db::get()->fetch_result($result, $row, $param);
|
||||
}
|
||||
|
||||
function db_close() {
|
||||
return Db::get()->close();
|
||||
}
|
||||
|
||||
function db_affected_rows( $result) {
|
||||
return Db::get()->affected_rows($result);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ require_once "classes/logger/sql.php";
|
|||
function ttrss_error_handler($errno, $errstr, $file, $line, $context) {
|
||||
global $logger;
|
||||
|
||||
if (error_reporting() == 0) return false;
|
||||
if (error_reporting() == 0 || !$errno) return false;
|
||||
|
||||
if (!$logger) $logger = new Logger_SQL();
|
||||
|
||||
|
@ -30,6 +30,8 @@ function ttrss_fatal_handler() {
|
|||
$line = $error["line"];
|
||||
$errstr = $error["message"];
|
||||
|
||||
if (!$errno) return false;
|
||||
|
||||
$context = debug_backtrace();
|
||||
|
||||
$file = substr(str_replace(dirname(dirname(__FILE__)), "", $file), 1);
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
|
||||
$mobile = new Mobile_Detect();
|
||||
|
||||
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
||||
|
||||
if (!init_plugins()) return;
|
||||
|
||||
global $pluginhost;
|
||||
|
@ -285,7 +283,5 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php db_close(); ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
4
opml.php
4
opml.php
|
@ -10,8 +10,6 @@
|
|||
require_once "db.php";
|
||||
require_once "db-prefs.php";
|
||||
|
||||
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
||||
|
||||
if (!init_plugins()) return;
|
||||
|
||||
$op = $_REQUEST['op'];
|
||||
|
@ -34,6 +32,4 @@
|
|||
}
|
||||
}
|
||||
|
||||
db_close();
|
||||
|
||||
?>
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
require_once "config.php";
|
||||
require_once "db-prefs.php";
|
||||
|
||||
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
||||
|
||||
if (!init_plugins()) return;
|
||||
|
||||
login_sequence();
|
||||
|
@ -154,7 +152,5 @@
|
|||
|
||||
</div>
|
||||
|
||||
<?php db_close(); ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
|
||||
$script_started = microtime(true);
|
||||
|
||||
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
||||
|
||||
if (!init_plugins()) return;
|
||||
|
||||
if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) {
|
||||
|
@ -61,6 +59,4 @@
|
|||
header("Content-Type: text/plain");
|
||||
print json_encode(array("error" => array("code" => 7)));
|
||||
|
||||
// We close the connection to database.
|
||||
db_close();
|
||||
?>
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
$action = $_REQUEST["action"];
|
||||
|
||||
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
||||
|
||||
if (!init_plugins()) return;
|
||||
|
||||
if ($_REQUEST["format"] == "feed") {
|
||||
|
|
|
@ -178,8 +178,6 @@
|
|||
|
||||
$schema_version = get_schema_version();
|
||||
|
||||
db_close();
|
||||
|
||||
if ($schema_version != SCHEMA_VERSION) {
|
||||
die("Schema version is wrong, please upgrade the database.\n");
|
||||
}
|
||||
|
@ -199,7 +197,6 @@
|
|||
|
||||
/* Check if schema version changed */
|
||||
|
||||
init_plugins();
|
||||
$test_schema_version = get_schema_version();
|
||||
|
||||
if ($test_schema_version != $schema_version) {
|
||||
|
@ -289,8 +286,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
db_close();
|
||||
|
||||
// We are in a fork.
|
||||
// We wait a little before exiting to avoid to be faster than our parent process.
|
||||
sleep(1);
|
||||
|
|
Loading…
Reference in New Issue