You are here

function pmnote_migrate in Drupal PM (Project Management) 8

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

Helper function for migrating between pmnote to drupal fields.

1 call to pmnote_migrate()
pmnote_update_7104 in pmnote/pmnote.install
Migrate PM Note nodes to field_api fields.

File

pmnote/includes/pmnote.migrate.inc, line 12
Migration functions for the PM Note module.

Code

function pmnote_migrate(&$sandbox) {
  pmnote_migrate_create_fields($sandbox);

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

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

  // PM Permissions default configurations.
  variable_set('pm_permission_field_parent_reference_for_pmnote', 'pmnote_parent');
  variable_set('pm_permission_node_pmnote_enabled', TRUE);
  module_load_include('inc', 'pm', 'includes/pm.permission.migrate');
  pm_permission_migrate_execute('pmnote');
  $sandbox['#finished'] = 1;
  return 'PM Note nodes have been migrated to field_api based fields successfully.';
}