data) || $response->status != 'ok') { drupal_set_message('Failed to pull content from D6 API endpoint. Please check settings and internet connection and try again.', 'error'); return $form; } $form['remote_nodes_count'] = [ '#markup' => format_string('
Total remote nodes: @count
', [ '@count' => (int)$response->data->total_nodes, ]), ]; $form['imported_nodes_count'] = [ '#markup' => format_string('Total already imported nodes: @count
', [ '@count' => (int)db_query("SELECT map.id FROM {mkbh_migration_imported_map} map")->rowCount(), ]), ]; $remoteChangedNodes = _mkbh_migration_get_changed_nodes($response->data->nodes, 'remote'); if (!empty($remoteChangedNodes)) { $form['remote_changed_nodes_count'] = [ '#markup' => format_string('Remote nodes that were changed after last import: @count
', [ '@count' => (int)count($remoteChangedNodes), ]), ]; $remoteChangedNodesTableRows = []; foreach ($remoteChangedNodes as $remoteChangedNode) { $remoteChangedNodesTableRows[] = [ 'remote_node_id' => $remoteChangedNode->nid, 'remote_node_title' => $remoteChangedNode->title, 'remote_node_changed' => date('r', $remoteChangedNode->changed), 'remote_node_operations' => l('view remotely', MKBH_D6_MIGRATION_FRONTEND_ENDPOINT . '/node/' . $remoteChangedNode->nid, ['attributes' => ['target' => '_blank']]), ]; } $form['remote_changed_nodes_table'] = [ '#theme' => 'table', '#header' => [ 'Remote NodeID', 'Remote Title', 'Remote Last Changed', 'Operations', ], '#rows' => $remoteChangedNodesTableRows, ]; } $localChangedNodes = _mkbh_migration_get_changed_nodes($response->data->nodes, 'local'); if (!empty($localChangedNodes)) { $form['imported_changed_nodes_count'] = [ '#markup' => format_string('Local nodes that were changed after initially imported: @count
', [ '@count' => (int)count($localChangedNodes), ]), ]; $localChangedNodesTableRows = []; foreach ($localChangedNodes as $localChangedNode) { $localChangedNodesTableRows[] = [ 'local_node_id' => $localChangedNode->nid, 'local_node_title' => $localChangedNode->title, 'local_node_changed' => date('r', $localChangedNode->changed), 'local_node_operations' => l('view locally', 'node/' . $localChangedNode->nid, ['attributes' => ['target' => '_blank']]), ]; } $form['imported_changed_nodes_table'] = [ '#theme' => 'table', '#header' => [ 'Local NodeID', 'Local Title', 'Local Last Changed', 'Operations', ], '#rows' => $localChangedNodesTableRows, ]; } $form['actions'] = [ '#type' => 'actions', ]; $form['actions']['perform_import'] = [ '#type' => 'submit', '#value' => 'Perform Import Job', '#prefix' => 'This action can not be undone and will import all remote content into local system.
Already imported nodes will be updated and local changes will be lost.