You are here

function pmorganization_migrate in Drupal PM (Project Management) 7.2

Same name and namespace in other branches
  1. 8 pmorganization/includes/pmorganization.migrate.inc \pmorganization_migrate()
  2. 7.3 pmorganization/includes/pmorganization.migrate.inc \pmorganization_migrate()

Helper function for migrating between pmorganization to drupal fields.

1 call to pmorganization_migrate()
pmorganization_update_7104 in pmorganization/pmorganization.install
Migrate PM Organization nodes to field_api fields.

File

pmorganization/includes/pmorganization.migrate.inc, line 12
Migration functions for the PM Organization module.

Code

function pmorganization_migrate(&$sandbox) {
  pmorganization_migrate_create_fields($sandbox);

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

  // We don't need pmorganization table anymore, so dropping it.
  db_drop_table('pmorganization');
  variable_del('node_options_pmorganization');
  variable_set('pmpermission_field_org_member_reference', 'pmorganization_members');
  variable_set('pmpermission_node_pmorganization_enabled', TRUE);
  module_load_include('inc', 'pmpermission', 'includes/pmpermission.migrate');
  pmpermission_migrate_execute('pmorganization');
  $sandbox['#finished'] = 1;
  return 'PM Organization nodes have been migrated to field_api based fields successfully.';
}