You are here

function lingotek_handle_advanced_xml_upgrade in Lingotek Translation 7.2

Same name and namespace in other branches
  1. 7.7 lingotek.admin.inc \lingotek_handle_advanced_xml_upgrade()
  2. 7.3 lingotek.admin.inc \lingotek_handle_advanced_xml_upgrade()
  3. 7.4 lingotek.admin.inc \lingotek_handle_advanced_xml_upgrade()
  4. 7.5 lingotek.admin.inc \lingotek_handle_advanced_xml_upgrade()
  5. 7.6 lingotek.admin.inc \lingotek_handle_advanced_xml_upgrade()

Custom form handler for upgrading a site from using Lingotek's simple to advanced XML parsing of content.

1 string reference to 'lingotek_handle_advanced_xml_upgrade'
lingotek_admin_form in ./lingotek.admin.inc
Form constructor for the administration form.

File

./lingotek.admin.inc, line 501

Code

function lingotek_handle_advanced_xml_upgrade($form, $form_state) {
  if ($form_state['values']['lingotek_advanced_parsing']) {
    $results = db_select('lingotek', 'l')
      ->fields('l', array(
      'nid',
    ))
      ->distinct()
      ->execute();
    $operations = array();
    foreach ($results as $result) {
      $node = node_load($result->nid, NULL, TRUE);
      if (!empty($node->nid)) {
        $operations[] = array(
          'lingotek_advanced_parsing_update_node',
          array(
            $node->nid,
          ),
        );
      }
    }
    $batch = array(
      'title' => t('Lingotek Advanced Parsing Updater'),
      'operations' => $operations,
      'file' => 'lingotek.admin.inc',
      'finished' => 'lingotek_advanced_parsing_update_finished',
    );

    // The admin form might not have finished processing yet, but if we're here, we're moving to advanced processing.
    // Ensure the appropriate variable is already set.
    variable_set('lingotek_advanced_parsing', TRUE);
    batch_set($batch);
  }
}