You are here

function pmticket_migrate in Drupal PM (Project Management) 8

Same name and namespace in other branches
  1. 7.3 pmticket/includes/pmticket.migrate.inc \pmticket_migrate()
  2. 7.2 pmticket/includes/pmticket.migrate.inc \pmticket_migrate()

Helper function for migrating between pmticket to drupal fields.

1 call to pmticket_migrate()
pmticket_update_7105 in pmticket/pmticket.install
Migrate PM Ticket nodes to field_api fields.

File

pmticket/includes/pmticket.migrate.inc, line 12
Migration functions for the PM Ticket module.

Code

function pmticket_migrate(&$sandbox) {
  pmticket_migrate_create_fields($sandbox);

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

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

  // 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_pmticket', 'pmticket_parent');
  variable_set('pm_permission_node_pmticket_enabled', TRUE);
  module_load_include('inc', 'pm', 'includes/pm.permission.migrate');
  pm_permission_migrate_execute('pmticket');
  $sandbox['#finished'] = 1;
  return 'PM Ticket nodes have been migrated to field_api based fields successfully.';
}