non security modules update
This commit is contained in:
@@ -9,6 +9,8 @@ function migrate_schema() {
|
||||
$schema = array();
|
||||
$schema['migrate_status'] = migrate_schema_status();
|
||||
$schema['migrate_log'] = migrate_schema_log();
|
||||
$schema['migrate_group'] = migrate_schema_group();
|
||||
$schema['migrate_field_mapping'] = migrate_schema_field_mapping();
|
||||
return $schema;
|
||||
}
|
||||
|
||||
@@ -28,6 +30,12 @@ function migrate_schema_status() {
|
||||
'not null' => TRUE,
|
||||
'description' => 'Name of class to instantiate for this migration',
|
||||
),
|
||||
'group_name' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'description' => 'Name of group containing migration',
|
||||
),
|
||||
'status' => array(
|
||||
'type' => 'int',
|
||||
'size' => 'tiny',
|
||||
@@ -115,6 +123,74 @@ function migrate_schema_log() {
|
||||
);
|
||||
}
|
||||
|
||||
function migrate_schema_group() {
|
||||
return array(
|
||||
'description' => 'Information on migration groups',
|
||||
'fields' => array(
|
||||
'name' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'description' => 'Unique machine name for a migration group',
|
||||
),
|
||||
'title' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'description' => 'Display name for a migration group',
|
||||
),
|
||||
'arguments' => array(
|
||||
'type' => 'blob',
|
||||
'not null' => FALSE,
|
||||
'size' => 'big',
|
||||
'serialize' => TRUE,
|
||||
'description' => 'A serialized array of arguments to the migration group',
|
||||
),
|
||||
),
|
||||
'primary key' => array('name'),
|
||||
);
|
||||
}
|
||||
|
||||
function migrate_schema_field_mapping() {
|
||||
return array(
|
||||
'description' => 'History of migration processes',
|
||||
'fields' => array(
|
||||
'fmid' => array(
|
||||
'type' => 'serial',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => TRUE,
|
||||
'description' => 'Unique ID for the field mapping row',
|
||||
),
|
||||
'machine_name' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'description' => 'Parent migration for the field mapping',
|
||||
),
|
||||
'destination_field' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'description' => 'Destination field for the field mapping',
|
||||
),
|
||||
'source_field' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'description' => 'Source field for the field mapping',
|
||||
),
|
||||
'options' => array(
|
||||
'type' => 'blob',
|
||||
'not null' => FALSE,
|
||||
'size' => 'big',
|
||||
'serialize' => TRUE,
|
||||
'description' => 'A serialized MigrateFieldMapping object holding all options',
|
||||
),
|
||||
),
|
||||
'primary key' => array('fmid'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_uninstall().
|
||||
* Drop map/message tables, in case implementing classes did not.
|
||||
@@ -137,13 +213,17 @@ function migrate_uninstall() {
|
||||
->condition('module', 'migrate')
|
||||
->execute();
|
||||
}
|
||||
|
||||
// Remove variables
|
||||
variable_del('migrate_disable_autoregistration');
|
||||
variable_del('migrate_disabled_handlers');
|
||||
variable_del('migrate_deprecation_warnings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add highwater mark
|
||||
*/
|
||||
function migrate_update_7001() {
|
||||
$ret = array();
|
||||
if (!db_field_exists('migrate_status', 'highwater')) {
|
||||
db_add_field('migrate_status', 'highwater', array(
|
||||
'type' => 'varchar',
|
||||
@@ -155,7 +235,7 @@ function migrate_update_7001() {
|
||||
);
|
||||
}
|
||||
|
||||
$ret[] = t('Added highwater column to migrate_status table');
|
||||
$ret = t('Added highwater column to migrate_status table');
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@@ -163,7 +243,6 @@ function migrate_update_7001() {
|
||||
* Add last_imported field to all map tables
|
||||
*/
|
||||
function migrate_update_7002() {
|
||||
$ret = array();
|
||||
foreach (db_find_tables('migrate_map_%') as $tablename) {
|
||||
if (!db_field_exists($tablename, 'last_imported')) {
|
||||
db_add_field($tablename, 'last_imported', array(
|
||||
@@ -175,7 +254,7 @@ function migrate_update_7002() {
|
||||
));
|
||||
}
|
||||
}
|
||||
$ret[] = t('Added last_imported column to all map tables');
|
||||
$ret = t('Added last_imported column to all map tables');
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@@ -183,7 +262,7 @@ function migrate_update_7002() {
|
||||
* Add lastthroughput column to migrate_status
|
||||
*/
|
||||
function migrate_update_7003() {
|
||||
$ret = array();
|
||||
$ret = '';
|
||||
if (!db_field_exists('migrate_status', 'lastthroughput')) {
|
||||
db_add_field('migrate_status', 'lastthroughput', array(
|
||||
'type' => 'int',
|
||||
@@ -194,7 +273,7 @@ function migrate_update_7003() {
|
||||
);
|
||||
}
|
||||
|
||||
$ret[] = t('Added lastthroughput column to migrate_status table');
|
||||
$ret = t('Added lastthroughput column to migrate_status table');
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@@ -202,7 +281,7 @@ function migrate_update_7003() {
|
||||
* Convert lastimported datetime field to lastimportedtime int field.
|
||||
*/
|
||||
function migrate_update_7004() {
|
||||
$ret = array();
|
||||
$ret = '';
|
||||
if (!db_field_exists('migrate_status', 'lastimportedtime')) {
|
||||
db_add_field('migrate_status', 'lastimportedtime', array(
|
||||
'type' => 'int',
|
||||
@@ -212,7 +291,7 @@ function migrate_update_7004() {
|
||||
)
|
||||
);
|
||||
|
||||
if (!db_field_exists('migrate_status', 'lastimported')) {
|
||||
if (db_field_exists('migrate_status', 'lastimported')) {
|
||||
$result = db_select('migrate_status', 'ms')
|
||||
->fields('ms', array('machine_name', 'lastimported'))
|
||||
->execute();
|
||||
@@ -226,7 +305,7 @@ function migrate_update_7004() {
|
||||
|
||||
db_drop_field('migrate_status', 'lastimported');
|
||||
|
||||
$ret[] = t('Converted lastimported datetime field to lastimportedtime int field');
|
||||
$ret .= "\n" . t('Converted lastimported datetime field to lastimportedtime int field');
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
@@ -236,11 +315,11 @@ function migrate_update_7004() {
|
||||
* Add support for history logging
|
||||
*/
|
||||
function migrate_update_7005() {
|
||||
$ret = array();
|
||||
$ret = '';
|
||||
if (!db_table_exists('migrate_log')) {
|
||||
$ret[] = t('Create migrate_log table');
|
||||
$ret .= "\n" . t('Create migrate_log table');
|
||||
db_create_table('migrate_log', migrate_schema_log());
|
||||
$ret[] = t('Remove historic columns from migrate_status table');
|
||||
$ret .= "\n" . t('Remove historic columns from migrate_status table');
|
||||
db_drop_field('migrate_status', 'lastthroughput');
|
||||
db_drop_field('migrate_status', 'lastimportedtime');
|
||||
}
|
||||
@@ -252,7 +331,7 @@ function migrate_update_7005() {
|
||||
* dependencies or sourceMigration() must be changed! See CHANGELOG.txt.
|
||||
*/
|
||||
function migrate_update_7006() {
|
||||
$ret = array();
|
||||
$ret = '';
|
||||
if (!db_field_exists('migrate_status', 'class_name')) {
|
||||
db_add_field('migrate_status', 'class_name', array(
|
||||
'type' => 'varchar',
|
||||
@@ -266,7 +345,7 @@ function migrate_update_7006() {
|
||||
db_query("UPDATE {migrate_status}
|
||||
SET class_name = CONCAT(machine_name, 'Migration')
|
||||
");
|
||||
$ret[] = t('Added class_name column to migrate_status table');
|
||||
$ret = t('Added class_name column to migrate_status table');
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
@@ -275,7 +354,7 @@ function migrate_update_7006() {
|
||||
* Add arguments field to migrate_status table.
|
||||
*/
|
||||
function migrate_update_7007() {
|
||||
$ret = array();
|
||||
$ret = '';
|
||||
if (!db_field_exists('migrate_status', 'arguments')) {
|
||||
db_add_field('migrate_status', 'arguments', array(
|
||||
'type' => 'blob',
|
||||
@@ -286,7 +365,7 @@ function migrate_update_7007() {
|
||||
)
|
||||
|
||||
);
|
||||
$ret[] = t('Added arguments column to migrate_status table');
|
||||
$ret = t('Added arguments column to migrate_status table');
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
@@ -298,10 +377,9 @@ function migrate_update_7008() {
|
||||
// Updates can be run when the module is disabled, which would mean the
|
||||
// call to migrate_migrations() will fail. Just bail in that case...
|
||||
if (!module_exists('migrate')) {
|
||||
throw new DrupalUpdateException(t('This update cannot be run while the Migrate ' .
|
||||
'module is disabled - you must enable Migrate to run this update.'));
|
||||
throw new DrupalUpdateException(t('This update cannot be run while the Migrate module is disabled - you must enable Migrate to run this update.'));
|
||||
}
|
||||
$ret = array();
|
||||
$ret = '';
|
||||
foreach (migrate_migrations() as $migration) {
|
||||
if (is_a($migration, 'Migration')) {
|
||||
// Since we're now tracking failed/ignored rows in the map table,
|
||||
@@ -317,7 +395,7 @@ function migrate_update_7008() {
|
||||
$field_schema['not null'] = FALSE;
|
||||
$map_connection->schema()->changeField($map_table, $field, $field,
|
||||
$field_schema);
|
||||
$ret[] = t('Changed !table.!field to be non-null',
|
||||
$ret .= "\n" . t('Changed !table.!field to be non-null',
|
||||
array('!table' => $map_table, '!field' => $field));
|
||||
}
|
||||
|
||||
@@ -343,7 +421,7 @@ function migrate_update_7008() {
|
||||
$msg_marked = TRUE;
|
||||
}
|
||||
if ($msg_marked) {
|
||||
$ret[] = t('Marked failures in !table', array('!table' => $map_table));
|
||||
$ret .= "\n" . t('Marked failures in !table', array('!table' => $map_table));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -363,10 +441,11 @@ function migrate_update_7201() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add rollback_action field to all map tables
|
||||
* Add rollback_action field to all map tables in the Drupal database.
|
||||
*/
|
||||
function migrate_update_7202() {
|
||||
$ret = array();
|
||||
// Note this won't catch any prefixed tables, or any stored in the source
|
||||
// database - ensureTables() will take care of those.
|
||||
foreach (db_find_tables('migrate_map_%') as $tablename) {
|
||||
if (!db_field_exists($tablename, 'rollback_action')) {
|
||||
db_add_field($tablename, 'rollback_action', array(
|
||||
@@ -379,6 +458,121 @@ function migrate_update_7202() {
|
||||
));
|
||||
}
|
||||
}
|
||||
$ret[] = t('Added rollback_action column to all map tables');
|
||||
$ret = t('Added rollback_action column to all map tables');
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add database tracking of per-group info.
|
||||
*/
|
||||
function migrate_update_7203() {
|
||||
$ret = '';
|
||||
if (!db_table_exists('migrate_group')) {
|
||||
$ret .= t('Create migrate_group table') . "\n";
|
||||
db_create_table('migrate_group', migrate_schema_group());
|
||||
}
|
||||
if (!db_field_exists('migrate_status', 'group_name')) {
|
||||
$ret .= t('Add group relationship to migrate_status table'). "\n";
|
||||
db_add_field('migrate_status', 'group_name', array(
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => 'default',
|
||||
'description' => 'Name of group containing migration',
|
||||
)
|
||||
);
|
||||
// Populate each migration's group_name field
|
||||
$groups = array();
|
||||
foreach (migrate_migrations() as $machine_name => $migration) {
|
||||
$group_name = $migration->getGroup()->getName();
|
||||
if (empty($group_name)) {
|
||||
$group_name = 'default';
|
||||
}
|
||||
$groups[$group_name] = $group_name;
|
||||
db_update('migrate_status')
|
||||
->fields(array('group_name' => $group_name))
|
||||
->condition('machine_name', $machine_name)
|
||||
->execute();
|
||||
}
|
||||
// Populate the migrate_group table
|
||||
foreach ($groups as $group_name) {
|
||||
$title = db_select('migrate_group', 'mg')
|
||||
->fields('mg', array('title'))
|
||||
->condition('name', $group_name)
|
||||
->execute()
|
||||
->fetchField();
|
||||
if (!$title) {
|
||||
db_insert('migrate_group')
|
||||
->fields(array(
|
||||
'name' => $group_name,
|
||||
'title' => $group_name,
|
||||
'arguments' => serialize(array()),
|
||||
))
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add database tracking of field mappings.
|
||||
*/
|
||||
function migrate_update_7204() {
|
||||
$ret = '';
|
||||
if (!db_table_exists('migrate_field_mapping')) {
|
||||
$ret = t('Create migrate_field_mapping table');
|
||||
db_create_table('migrate_field_mapping', migrate_schema_field_mapping());
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove obsolete autoregistration disablement.
|
||||
*/
|
||||
function migrate_update_7205() {
|
||||
variable_del('migrate_disable_autoregistration');
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace three-column PK with a simple serial.
|
||||
*/
|
||||
function migrate_update_7206() {
|
||||
if (!db_field_exists('migrate_field_mapping', 'fmid')) {
|
||||
db_drop_primary_key('migrate_field_mapping');
|
||||
db_add_field('migrate_field_mapping', 'fmid',
|
||||
array(
|
||||
'type' => 'serial',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => TRUE,
|
||||
'description' => 'Unique ID for the field mapping row',
|
||||
),
|
||||
array(
|
||||
'primary key' => array('fmid'),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure we remove an empty 'default' group created by the previous updates.
|
||||
*/
|
||||
function migrate_update_7207() {
|
||||
$rows = db_select('migrate_group', 'mg')
|
||||
->fields('mg', array('name'))
|
||||
->condition('name', 'default')
|
||||
->execute()
|
||||
->rowCount();
|
||||
if ($rows > 0) {
|
||||
$rows = db_select('migrate_status', 'ms')
|
||||
->fields('ms', array('machine_name'))
|
||||
->condition('group_name', 'default')
|
||||
->execute()
|
||||
->rowCount();
|
||||
if ($rows == 0) {
|
||||
db_delete('migrate_group')
|
||||
->condition('name', 'default')
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user