block mysql versions where true is undefined in sanity_check
This commit is contained in:
parent
746a0d5eb3
commit
aec3ce39de
3 changed files with 22 additions and 4 deletions
10
db.php
10
db.php
|
@ -55,19 +55,23 @@ function db_escape_string_2($s, $link) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function db_query($link, $query) {
|
function db_query($link, $query, $die_on_error = true) {
|
||||||
if (DB_TYPE == "pgsql") {
|
if (DB_TYPE == "pgsql") {
|
||||||
$result = pg_query($link, $query);
|
$result = pg_query($link, $query);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$query = htmlspecialchars($query); // just in case
|
$query = htmlspecialchars($query); // just in case
|
||||||
die("Query <i>$query</i> failed: " . pg_last_error($link));
|
if ($die_on_error) {
|
||||||
|
die("Query <i>$query</i> failed: " . pg_last_error($link));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
} else if (DB_TYPE == "mysql") {
|
} else if (DB_TYPE == "mysql") {
|
||||||
$result = mysql_query($query, $link);
|
$result = mysql_query($query, $link);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$query = htmlspecialchars($query);
|
$query = htmlspecialchars($query);
|
||||||
die("Query <i>$query</i> failed: " . mysql_error($link));
|
if ($die_on_error) {
|
||||||
|
die("Query <i>$query</i> failed: " . mysql_error($link));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,4 +22,7 @@
|
||||||
$ERRORS[8] = "Denied. Your access level is insufficient to access this page.";
|
$ERRORS[8] = "Denied. Your access level is insufficient to access this page.";
|
||||||
|
|
||||||
$ERRORS[9] = "Configuration check failed";
|
$ERRORS[9] = "Configuration check failed";
|
||||||
|
|
||||||
|
$ERRORS[10] = "Your version of MySQL is not currently supported. Please see
|
||||||
|
official site for more information.";
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1217,6 +1217,8 @@
|
||||||
|
|
||||||
function sanity_check($link) {
|
function sanity_check($link) {
|
||||||
|
|
||||||
|
error_reporting(0);
|
||||||
|
|
||||||
$error_code = 0;
|
$error_code = 0;
|
||||||
$result = db_query($link, "SELECT schema_version FROM ttrss_version");
|
$result = db_query($link, "SELECT schema_version FROM ttrss_version");
|
||||||
$schema_version = db_fetch_result($result, 0, "schema_version");
|
$schema_version = db_fetch_result($result, 0, "schema_version");
|
||||||
|
@ -1225,8 +1227,17 @@
|
||||||
$error_code = 5;
|
$error_code = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DB_TYPE == "mysql") {
|
||||||
|
$result = db_query($link, "SELECT true", false);
|
||||||
|
if (db_num_rows($result) != 1) {
|
||||||
|
$error_code = 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
error_reporting (DEFAULT_ERROR_LEVEL);
|
||||||
|
|
||||||
if ($error_code != 0) {
|
if ($error_code != 0) {
|
||||||
print_error_xml(5);
|
print_error_xml($error_code);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue