Jump to:
| Project: | Node import |
| Version: | 6.x-1.0-rc4 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
MySQL 5.0.75
PHP 5.2.6-3ubuntu4.2
Apache 2.2.11
Pressflow/Drupal 6.14
Nature of error: image attach on imported "story" node type.
This is going to be a woefully thin bug report, because the actual error took place over a month ago, and we moved on, abandoning the idea of importing hundreds of old news items. I only realized the bug when I discovered that cron was failing with an error attributed to line 343 of image_attach.module. Using version 6.x-1.0-beta3 of the Image module, it looks like image_attach expected the "- None -" option to be set for every node, and when cron ran, it was looping through the nodes I didn't know had been created and trying to unset the image attachment's blank default using this code:
unset($node->iids[0])
I know that checking to see if $node->iids[0] exists might be a good patch to suggest to the Image module maintainers, but I thought I'd share it here, because it might shed some light on why the original import failed: the attached image for the imports might have to be explicitly set to 0.
Comments
#1
Thanks for the direction. I just added the conditional to test if that exists. Works great now. No more error.
I changed the following in /sites/all/modules/image/contrib/image_attach.module
(Image Module version 6.x-1.0-beta5)
Starting Line 396
/*** Extra submit handler for node forms.
*/
function image_attach_node_form_submit(&$form, &$form_state) {
// Clear the 0 key in the iids array that arises from selecting the 'None'
// option. We do this here so image_attach_nodeapi() gets clean data.
unset($form_state['values']['iids'][0]);
}
To
/*** Extra submit handler for node forms.
*/
function image_attach_node_form_submit(&$form, &$form_state) {
// Clear the 0 key in the iids array that arises from selecting the 'None'
// option. We do this here so image_attach_nodeapi() gets clean data.
if ($form_state['values']['iids'][0]) {
unset($form_state['values']['iids'][0]);
}
}
#2
That seems to have done it for me, but then I got:
But my Wiki content imported.