Starting Import"; if(substr($docpath,strlen($docpath)-2,1)!='/') { $docpath = $docpath.'/'; } if (is_dir($docpath)) { $handle = opendir($docpath); while ($file = @readdir ($handle)) { $_filename=basename($file); // echo "
Working on file " . $_filename . "
"; $_parts = explode('_',$_filename); if (count($_parts)==3 && $_parts[1] == 'field' && $_parts[2] == 'comment.txt') { $_tab = $_parts[0]; //echo "" . $_line . "
"; $_inf = explode('|',$_line); if(!empty($_inf[1]) && strlen(trim($_inf[1]))>0){ $qry = 'INSERT INTO ' . PMA_backquote($cfgRelation['column_comments']) . ' (db_name, table_name, column_name, comment) ' . ' VALUES(' . '\'' . PMA_sqlAddslashes($db) . '\',' . '\'' . PMA_sqlAddslashes(trim($_tab)) . '\',' . '\'' . PMA_sqlAddslashes(trim($_inf[0])) . '\',' . '\'' . PMA_sqlAddslashes(trim($_inf[1])) . '\')'; if(PMA_query_as_cu($qry)) { echo "added Comment for Column " . $_tab . '.' . $_inf[0] . "
"; } else { echo "writing of Comment not possible
"; } } if (!empty($_inf[2]) && strlen(trim($_inf[2]))>0) { $_for = explode('->',$_inf[2]); $qry = 'INSERT INTO ' . PMA_backquote($cfgRelation['relation']) . '(master_db, master_table, master_field, foreign_db, foreign_table, foreign_field)' . ' values(' . '\'' . PMA_sqlAddslashes($db) . '\', ' . '\'' . PMA_sqlAddslashes(trim($_tab)) . '\', ' . '\'' . PMA_sqlAddslashes(trim($_inf[0])) . '\', ' . '\'' . PMA_sqlAddslashes($db) . '\', ' . '\'' . PMA_sqlAddslashes(trim($_for[0])) . '\',' . '\'' . PMA_sqlAddslashes(trim($_for[1])) . '\')'; if(PMA_query_as_cu($qry)) { echo "added Relation for Column " . $_tab . '.' . $_inf[0] . " to " . $_for . "
"; } else { echo "writing of Relation not possible
"; } } } echo 'Import finished
'; } else { echo "File could not be read
"; } }else { echo "Ignoring File $file
"; } } } else { echo "This was not a Directory"; } } ?>