function pmtask_migrate in Drupal PM (Project Management) 7.2
Same name and namespace in other branches
- 8 pmtask/includes/pmtask.migrate.inc \pmtask_migrate()
- 7.3 pmtask/includes/pmtask.migrate.inc \pmtask_migrate()
Helper function for migrating between pmtask to drupal fields.
1 call to pmtask_migrate()
- pmtask_update_7105 in pmtask/
pmtask.install - Migrate PM Project nodes to field_api fields.
File
- pmtask/
includes/ pmtask.migrate.inc, line 12 - Migration functions for the PM Task module.
Code
function pmtask_migrate(&$sandbox) {
pmtask_migrate_create_fields($sandbox);
// Migrate data from pmtask node to Drupal user account.
if (empty($sandbox['pmtask_current_vid_of_field_being_migrated'])) {
$sandbox['pmtask_current_vid_of_field_being_migrated'] = 0;
}
if (pmtask_migrate_field_data($sandbox) == FALSE) {
$sandbox['#finished'] = 0.5;
return;
}
// We don't need pmtask table anymore, so dropping it.
db_drop_table('pmtask');
variable_del('node_options_pmtask');
// PM Permissions default configurations.
variable_set('pmpermission_field_assigned_reference', 'pm_assigned');
variable_set('pmpermission_field_pm_reference', 'pm_manager');
variable_set('pmpermission_field_parent_reference_for_pmtask', 'pmtask_parent');
variable_set('pmpermission_node_pmtask_enabled', TRUE);
module_load_include('inc', 'pmpermission', 'includes/pmpermission.migrate');
pmpermission_migrate_execute('pmtask');
$sandbox['#finished'] = 1;
return 'PM Task nodes have been migrated to field_api based fields successfully.';
}