} // Re-connect to database, in case previous step skipped $sql = "USE `" . $DB . "`;"; sql_execute_multiple($sql); // Check that required functions present in target db // Install them if missing // This step is obviously essential if database has been replaced include_once "check_functions.inc"; //////////////////////////////////////////////////////////// // Create/replace backup database if requested //////////////////////////////////////////////////////////// if ($use_db_backup && $delete_db_backup) { echo "Creating backup database `{$DB_BACKUP}`..."; // Drop and replace entire backup database $sql_create_db = "\n\t\tDROP DATABASE IF EXISTS `" . $DB_BACKUP . "`;\n\t\tCREATE DATABASE `" . $DB_BACKUP . "`;\n\t"; sql_execute_multiple($sql_create_db); echo "done\r\n\r\n"; } //////////////////////////////////////////////////////////// // Load taxonomic sources //////////////////////////////////////////////////////////// $src_no = 1; $src_suffix = ""; foreach ($src_array as $src) { echo "\r\n#############################################\r\n"; echo "Loading source #" . $src_no . ": '" . $src . "'\r\n\r\n"; $src_suffix .= "_" . $src; // reset the clock for this source include $timer_off; $resettime = $endtime; include_once "import_" . $src . "/import.php";
// The next three tables are used only to build the combined tables: include "insert_species.inc"; // species include "insert_infra1.inc"; // trinomials include "insert_infra2.inc"; // quadrinomials // combination tables include "genus_family_combined.inc"; // Combined family+genus table include "species_genus_combined.inc"; // Populates combined genus+species table include "infra1_species_combined.inc"; // Populates combined trinomial + species table include "infra2_infra1_combined.inc"; // Populates combined quadrinomial + trinomial table // The following scripts by Jerry Lu complete populating taxamatch tables include "update_genera.inc"; include "update_family.inc"; include "update_genus_family_combined.inc"; include "update_species.inc"; include "update_infra1.inc"; include "update_infra2.inc"; include "update_species_genus_combined.inc"; include "update_infra1_species_combined.inc"; include "update_infra2_infra1_combined.inc"; // Remove splist, infra1list, infra2list echo "Removing temporary tables..."; $sql = "\n\tDROP TABLE IF EXISTS `infra1list`;\n\tDROP TABLE IF EXISTS `infra2list`;\n\tDROP TABLE IF EXISTS `splist`;\n"; sql_execute_multiple($sql); echo $msg_success;
// name and author using the TNRS-GNI name parser. // See readme file for detailis // echo "Creating table {$names_parsed}..."; include "sql_names_parsed_drop_table.inc"; if (sql_execute_multiple($sql_drop_tables)) { } include "sql_names_parsed_create_table.inc"; if (sql_execute_multiple($sql_create_tables)) { } echo $msg_success; include "names_parsed_import.inc"; include "names_parsed_alter.inc"; // checks and restructures names_parsed table include "names_parsed_update.inc"; // populate nameMinusAuthor field in names_parsed table ////////////// Populate staging table ////////////////////// // Create staging table include "create_staging_table.inc"; // Add names & synonymy to staging table include "add_names_to_staging.inc"; // Clean up if ($remove_raw_tables) { echo "Dropping raw data tables..."; include "sql_drop_tables.inc"; if (sql_execute_multiple($sql_drop_tables)) { } echo $msg_success; } echo "\r\n"; //////////////////////////////////////////////////////////