You are here

function pmtimetracking_migrate in Drupal PM (Project Management) 7.2

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

Helper function for migrating between pmtimetracking to drupal fields.

1 call to pmtimetracking_migrate()
pmtimetracking_update_7106 in pmtimetracking/pmtimetracking.install
Migrate PM Timetracking nodes to field_api fields.

File

pmtimetracking/includes/pmtimetracking.migrate.inc, line 12
Migration functions for the PM Timetracking module.

Code

function pmtimetracking_migrate(&$sandbox) {
  pmtimetracking_migrate_create_fields($sandbox);

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

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

  // PM Permissions default configurations.
  variable_set('pmpermission_field_parent_reference_for_pmtimetracking', 'pmtimetracking_parent');
  variable_set('pmpermission_node_pmtimetracking_enabled', TRUE);
  module_load_include('inc', 'pmpermission', 'includes/pmpermission.migrate');
  pmpermission_migrate_execute('pmtimetracking');
  $sandbox['#finished'] = 1;
  return 'PM Timetracking nodes have been migrated to field_api based fields successfully.';
}