]> git.mxchange.org Git - friendica.git/blobdiff - include/dbstructure.php
3 slashes for Doxygen, 2 are enough for PHP ... :-(
[friendica.git] / include / dbstructure.php
index e501b4dc38d59e2e4699652cc8973b13aab88e9a..c694014f68fae8b11b7d952bc538b1efac9b8f56 100644 (file)
@@ -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;
                        }
                }
@@ -905,20 +914,20 @@ function db_definition($charset) {
                                        "uid_created" => array("uid","created"),
                                        "uid_unseen_contactid" => array("uid","unseen","contact-id"),
                                        "uid_network_received" => array("uid","network","received"),
-                                       //"uid_received" => array("uid","received"),
-                                       //"uid_network_commented" => array("uid","network","commented"),
-                                       //"uid_commented" => array("uid","commented"),
+                                       "uid_received" => array("uid","received"),
+                                       "uid_network_commented" => array("uid","network","commented"),
+                                       "uid_commented" => array("uid","commented"),
                                        "uid_title" => array("uid","title"),
                                        "uid_thrparent" => array("uid","thr-parent"),
                                        "uid_parenturi" => array("uid","parent-uri"),
                                        "uid_contactid_id" => array("uid","contact-id","id"),
-                                       //"uid_contactid_created" => array("uid","contact-id","created"),
+                                       "uid_contactid_created" => array("uid","contact-id","created"),
                                        "gcontactid_uid_created" => array("gcontact-id","uid","created"),
                                        "authorid_created" => array("author-id","created"),
                                        "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"),
+                                       "wall_body" => array("wall","body(6)"),
+                                       "uid_visible_moderated_created" => array("uid","visible","moderated","created"),
+                                       "uid_uri" => array("uid", "uri"),
                                        "uid_wall_created" => array("uid","wall","created"),
                                        "resource-id" => array("resource-id"),
                                        "uid_type" => array("uid","type"),
@@ -926,8 +935,7 @@ function db_definition($charset) {
                                        "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"),
                                        "uid_wall_parent_created" => array("uid","wall","parent","created"),
                                        "uid_type_changed" => array("uid","type","changed"),
-                                       //"contactid_verb" => array("contact-id","verb"),
-                                       "contactid" => array("contact-id"),
+                                       "contactid_verb" => array("contact-id","verb"),
                                        "deleted_changed" => array("deleted","changed"),
                                        "uid_wall_changed" => array("uid","wall","changed"),
                                        "uid_eventid" => array("uid","event-id"),