You are here

function pmproject_migrate in Drupal PM (Project Management) 7.3

Same name and namespace in other branches
  1. 8 pmproject/includes/pmproject.migrate.inc \pmproject_migrate()
  2. 7.2 pmproject/includes/pmproject.migrate.inc \pmproject_migrate()

Helper function for migrating between pmproject to drupal fields.

1 call to pmproject_migrate()
pmproject_update_7105 in pmproject/pmproject.install
Migrate PM Project nodes to field_api fields.

File

pmproject/includes/pmproject.migrate.inc, line 12
Migration functions for the PM Project module.

Code

function pmproject_migrate(&$sandbox) {
  pmproject_migrate_create_fields($sandbox);

  // Migrate data from pmproject node to Drupal user account.
  if (empty($sandbox['pmproject_current_vid_of_field_being_migrated'])) {
    $sandbox['pmproject_current_vid_of_field_being_migrated'] = 0;
  }
  if (pmproject_migrate_field_data($sandbox) == FALSE) {
    $sandbox['#finished'] = 0.5;
    return;
  }

  // We don't need pmproject table anymore, so dropping it.
  db_drop_table('pmproject');
  variable_del('node_options_pmproject');

  // PM Permissions default configurations.
  variable_set('pm_permission_field_assigned_reference', 'pm_assigned');
  variable_set('pm_permission_field_pm_reference', 'pm_manager');
  variable_set('pm_permission_field_parent_reference_for_pmproject', 'pmproject_parent');
  variable_set('pm_permission_node_pmproject_enabled', TRUE);
  module_load_include('inc', 'pm', 'includes/pm.permission.migrate');
  pm_permission_migrate_execute('pmproject');
  $sandbox['#finished'] = 1;
  return 'PM Project nodes have been migrated to field_api based fields successfully.';
}