현재의 html 사이트를 drupal로 마이그레이션하려고합니다. 나는 이주해야하는 80,000 페이지가 넘었으므로 나는 50 년 동안 컴퓨터의 infront에 앉아서 모듈을 만들 것이라고 생각했다. 나는 각 디렉토리에서 html을 추출하는 스크립트를 만들 수 있었고 지금은 노드를 생성해야하는 도로 블록에 도착했다. node_save()를 사용하여 새 노드를 만들려고하는데 node_save가 실행될 때 내가 시도한 모든 것과 PDOException 오류가 발생합니다. 저는 $ node를 전달할 것입니다.이 배열은 객체로 형변환됩니다.node_save를 사용하여 노드를 만드는 방법은 무엇입니까?
PDOException: in field_sql_storage_field_storage_write() (line 424 of /srv/www/htdocs/modules/field/modules/field_sql_storage/field_sql_storage.module).
이것은 우리가 현재 노드를 작성하는 방법이지만, 오류 발생 :
$node= array(
'uid' => $user->uid,
'name' => $user->name,
'type' => 'page',
'language' => LANGUAGE_NONE,
'title' => $html['title'],
'status' => 1,
'promote' => 0,
'sticky' => 0,
'created' => (int)REQUEST_TIME,
'revision' => 0,
'comment' => '1',
'menu' => array(
'enabled' => 0,
'mlid' => 0,
'module' => 'menu',
'hidden' => 0,
'has_children' => 0,
'customized' => 0,
'options' => array(),
'expanded' => 0,
'parent_depth_limit' => 8,
'link_title' => '',
'description' => '',
'parent' => 'main-menu:0',
'weight' => '0',
'plid' => '0',
'menu_name' => 'main-menu',
),
'path' => array(
'alias' => '',
'pid' => null,
'source' => null,
'language' => LANGUAGE_NONE,
'pathauto' => 1,
),
'nid' => null,
'vid' => null,
'changed' => '',
'additional_settings__active_tab' => 'edit-menu',
'log' => '',
'date' => '',
'submit' => 'Save',
'preview' => 'Preview',
'private' => 0,
'op' => 'Save',
'body' => array(LANGUAGE_NONE => array(
array(
'value' => $html['html'],
'summary' => $link,
'format' => 'full_html',
),
)),
'validated' => true,
);
node_save((object)$node);
// Small hack to link revisions to our test user.
db_update('node_revision')
->fields(array('uid' => $node->uid))
->condition('vid', $node->vid)
->execute();
이 문제를 해결했습니다. –