summaryrefslogtreecommitdiffstats
path: root/migrate.module
diff options
context:
space:
mode:
authorMike Ryan2009-08-24 01:33:48 +0000
committerMike Ryan2009-08-24 01:33:48 +0000
commit4180aa5da7ee7509f87ed48d06e76fc3adcca072 (patch)
tree5f8df1e084044db4a43d0da333f4eb76e6eca504 /migrate.module
parent8b5dd9e44816870bd45208a37b856337f2271354 (diff)
#557436 by mikeryan - Refactored map and message table names
Diffstat (limited to 'migrate.module')
-rwxr-xr-xmigrate.module36
1 files changed, 16 insertions, 20 deletions
diff --git a/migrate.module b/migrate.module
index b8c793a..68bce9e 100755
--- a/migrate.module
+++ b/migrate.module
@@ -80,8 +80,8 @@ function migrate_save_content_set(&$content_set, $options = array()) {
}
// Create or modify map and message tables
- $maptablename = _migrate_map_table_name($content_set->view_name);
- $msgtablename = _migrate_message_table_name($content_set->view_name);
+ $maptablename = _migrate_map_table_name($content_set->mcsid);
+ $msgtablename = _migrate_message_table_name($content_set->mcsid);
// TODO: For now, PK must be in base_table
@@ -194,10 +194,8 @@ function migrate_save_content_mapping(&$mapping) {
function migrate_delete_content_set($mcsid) {
// First, remove the map and message tables from the Table Wizard, and drop them
$ret = array();
- $sql = "SELECT view_name FROM {migrate_content_sets} WHERE mcsid=%d";
- $view_name = db_result(db_query($sql, $mcsid));
- $maptable = _migrate_map_table_name($view_name);
- $msgtable = _migrate_message_table_name($view_name);
+ $maptable = _migrate_map_table_name($mcsid);
+ $msgtable = _migrate_message_table_name($mcsid);
if (db_table_exists($maptable)) {
tw_remove_tables(array($maptable, $msgtable));
db_drop_table($ret, $maptable);
@@ -247,9 +245,7 @@ function migrate_message($message, $type = MIGRATE_MESSAGE_ERROR) {
function migrate_add_mapping($mcsid, $sourceid, $destid) {
static $maptables = array();
if (!isset($maptables[$mcsid])) {
- $sql = "SELECT view_name FROM {migrate_content_sets} WHERE mcsid=%d";
- $view_name = db_result(db_query($sql, $mcsid));
- $maptables[$mcsid] = _migrate_map_table_name($view_name);
+ $maptables[$mcsid] = _migrate_map_table_name($mcsid);
}
$mapping = new stdClass;
$mapping->sourceid = $sourceid;
@@ -299,8 +295,8 @@ function migrate_content_process_clear($mcsid, &$messages = array(), &$options =
$contenttype = $tblinfo->contenttype;
$sourcekey = $tblinfo->sourcekey;
- $maptable = _migrate_map_table_name($view_name);
- $msgtablename = _migrate_message_table_name($view_name);
+ $maptable = _migrate_map_table_name($mcsid);
+ $msgtablename = _migrate_message_table_name($mcsid);
$processstart = microtime(TRUE);
$status = MIGRATE_STATUS_IN_PROGRESS;
@@ -427,8 +423,8 @@ function migrate_content_process_import($mcsid, &$messages = array(), &$options
$contenttype = $tblinfo->contenttype;
$sourcekey = $tblinfo->sourcekey;
- $maptable = _migrate_map_table_name($view_name);
- $msgtablename = _migrate_message_table_name($view_name);
+ $maptable = _migrate_map_table_name($mcsid);
+ $msgtablename = _migrate_message_table_name($mcsid);
$processstart = microtime(TRUE);
$status = MIGRATE_STATUS_IN_PROGRESS;
@@ -1009,8 +1005,8 @@ function migrate_schema_alter(&$schema) {
if (db_table_exists('migrate_content_sets')) {
$result = db_query("SELECT * FROM {migrate_content_sets}");
while ($content_set = db_fetch_object($result)) {
- $maptablename = _migrate_map_table_name($content_set->view_name);
- $msgtablename = _migrate_message_table_name($content_set->view_name);
+ $maptablename = _migrate_map_table_name($content_set->mcsid);
+ $msgtablename = _migrate_message_table_name($content_set->mcsid);
// Get the proper field definition for the sourcekey
$view = views_get_view($content_set->view_name);
@@ -1084,7 +1080,7 @@ function _migrate_xlat_get_new_id($contenttype, $oldid) {
WHERE mcs.contenttype='%s'",
$contenttype);
while ($row = db_fetch_object($result)) {
- $table = _migrate_map_table_name($row->importtable);
+ $table = _migrate_map_table_name($row->mcsid);
$pkcol = $row->colname;
$id = db_result(db_query("SELECT destid
FROM {$table} WHERE sourceid=%d", $oldid));
@@ -1122,12 +1118,12 @@ function migrate_theme() {
);
}
-function _migrate_map_table_name($view_name) {
- return $view_name . '_map';
+function _migrate_map_table_name($mcsid) {
+ return "migrate_map_$mcsid";
}
-function _migrate_message_table_name($view_name) {
- return $view_name . '_msgs';
+function _migrate_message_table_name($mcsid) {
+ return "migrate_msgs_$mcsid";
}
function _migrate_map_table_schema($sourcefield) {