X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fdbstructure.php;h=c694014f68fae8b11b7d952bc538b1efac9b8f56;hb=8039ad0e2318c28a22f87c31dbbdb3165f1ef058;hp=3826716c54cc0c669b836a715e44179e15b65502;hpb=80efc422bf8f87370388ad8e34ea94cf7ae72616;p=friendica.git diff --git a/include/dbstructure.php b/include/dbstructure.php index 3826716c54..c694014f68 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -17,6 +17,14 @@ function update_fail($update_id, $error_message){ $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 foreach ($adminlist as $admin) { @@ -73,7 +81,7 @@ function table_structure($table) { $fielddata = array(); $indexdata = array(); - if (is_array($indexes)) + if (dbm::is_result($indexes)) foreach ($indexes AS $index) { if ($index["Index_type"] == "FULLTEXT") continue; @@ -93,7 +101,7 @@ function table_structure($table) { $indexdata[$index["Key_name"]][] = $column; } - if (is_array($structures)) { + if (dbm::is_result($structures)) { foreach($structures AS $field) { $fielddata[$field["Field"]]["type"] = $field["Type"]; if ($field["Null"] == "NO") @@ -151,6 +159,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) { foreach ($tables AS $table) { $table = current($table); + logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG); $database[$table] = table_structure($table); } @@ -179,7 +188,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) { $sql3=""; if (!isset($database[$name])) { $r = db_create_table($name, $structure["fields"], $charset, $verbose, $action, $structure['indexes']); - if(false === $r) { + if (!dbm::is_result($r)) { $errors .= t('Errors encountered creating database tables.').$name.EOL; } $is_new_table = True; @@ -256,7 +265,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) { if ($action) { $r = @$db->q($sql3); - if(false === $r) + if (dbm::is_result($r)) $errors .= t('Errors encountered performing database changes.').$sql3.EOL; } } @@ -918,7 +927,7 @@ function db_definition($charset) { "ownerid_created" => array("owner-id","created"), "wall_body" => array("wall","body(6)"), "uid_visible_moderated_created" => array("uid","visible","moderated","created"), - "uid_uri" => array("uid","uri"), + "uid_uri" => array("uid", "uri"), "uid_wall_created" => array("uid","wall","created"), "resource-id" => array("resource-id"), "uid_type" => array("uid","type"), @@ -1039,6 +1048,8 @@ function db_definition($charset) { "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""), + "name_cache" => array("type" => "tinytext"), + "msg_cache" => array("type" => "mediumtext") ), "indexes" => array( "PRIMARY" => array("id"), @@ -1278,6 +1289,7 @@ function db_definition($charset) { "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"), "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""), + "note" => array("type" => "text"), ), "indexes" => array( "PRIMARY" => array("id"),