Use more dbm::is_result()
Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
parent
e171a1cd22
commit
50d168ab6b
1 changed files with 13 additions and 4 deletions
|
@ -17,6 +17,14 @@ function update_fail($update_id, $error_message){
|
||||||
$admin_mail_list
|
$admin_mail_list
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// No valid result?
|
||||||
|
if (!dbm::is_result($adminlist)) {
|
||||||
|
logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_WARNING);
|
||||||
|
|
||||||
|
// Don't continue
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// every admin could had different language
|
// every admin could had different language
|
||||||
|
|
||||||
foreach ($adminlist as $admin) {
|
foreach ($adminlist as $admin) {
|
||||||
|
@ -73,7 +81,7 @@ function table_structure($table) {
|
||||||
$fielddata = array();
|
$fielddata = array();
|
||||||
$indexdata = array();
|
$indexdata = array();
|
||||||
|
|
||||||
if (is_array($indexes))
|
if (dbm::is_result($indexes))
|
||||||
foreach ($indexes AS $index) {
|
foreach ($indexes AS $index) {
|
||||||
if ($index["Index_type"] == "FULLTEXT")
|
if ($index["Index_type"] == "FULLTEXT")
|
||||||
continue;
|
continue;
|
||||||
|
@ -85,7 +93,7 @@ function table_structure($table) {
|
||||||
$indexdata[$index["Key_name"]][] = $column;
|
$indexdata[$index["Key_name"]][] = $column;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($structures)) {
|
if (dbm::is_result($structures)) {
|
||||||
foreach($structures AS $field) {
|
foreach($structures AS $field) {
|
||||||
$fielddata[$field["Field"]]["type"] = $field["Type"];
|
$fielddata[$field["Field"]]["type"] = $field["Type"];
|
||||||
if ($field["Null"] == "NO")
|
if ($field["Null"] == "NO")
|
||||||
|
@ -135,6 +143,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
||||||
foreach ($tables AS $table) {
|
foreach ($tables AS $table) {
|
||||||
$table = current($table);
|
$table = current($table);
|
||||||
|
|
||||||
|
logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
|
||||||
$database[$table] = table_structure($table);
|
$database[$table] = table_structure($table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +158,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
||||||
$sql3="";
|
$sql3="";
|
||||||
if (!isset($database[$name])) {
|
if (!isset($database[$name])) {
|
||||||
$r = db_create_table($name, $structure["fields"], $verbose, $action, $structure['indexes']);
|
$r = db_create_table($name, $structure["fields"], $verbose, $action, $structure['indexes']);
|
||||||
if(false === $r) {
|
if(!dbm::is_result($r)) {
|
||||||
$errors .= t('Errors encountered creating database tables.').$name.EOL;
|
$errors .= t('Errors encountered creating database tables.').$name.EOL;
|
||||||
}
|
}
|
||||||
$is_new_table = True;
|
$is_new_table = True;
|
||||||
|
@ -226,7 +235,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
||||||
|
|
||||||
if ($action) {
|
if ($action) {
|
||||||
$r = @$db->q($sql3);
|
$r = @$db->q($sql3);
|
||||||
if(false === $r)
|
if(dbm::is_result($r))
|
||||||
$errors .= t('Errors encountered performing database changes.').$sql3.EOL;
|
$errors .= t('Errors encountered performing database changes.').$sql3.EOL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue