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 ' . htmlspecialchars($tab) . '.' . htmlspecialchars($inf[0]) . '
'; } else { echo 'Writing of comment not possible
'; } echo "\n"; } // end inf[1] exists 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 ' . htmlspecialchars($tab) . '.' . htmlspecialchars($inf[0]) . ' to ' . htmlspecialchars($for) . '
'; } else { echo "writing of Relation not possible
"; } echo "\n"; } // end inf[2] exists } echo 'Import finished
' . "\n"; } else { echo 'File could not be read
' . "\n"; } } else { echo 'Ignoring file ' . $file . '
' . "\n"; } // end working on table } // end while } else { echo 'This was not a Directory' . "\n"; } } ?>