When using Node export/import the not nodeblock machine name is ignored.
a reduced snippet of a node for import...
array(
(object) array(
'vid' => '11',
'uid' => '2',
'title' => 'ttttttttsssssssss',
'log' => '',
'status' => '1',
'comment' => '1',
'promote' => '0',
'sticky' => '0',
'vuuid' => ' ',
'nid' => '11',
'type' => 'uwlib_static',
'language' => 'und',
'field_static_body' => array(
'und' => array(
array(
'value' => 'sssssssssssssssssssssssssssss',
'format' => 'plain_text',
'safe_value' => "<p>sssssssssssssssssssssssssssss</p>\n",
),
),
),
'cid' => '0',
'nodeblock' => array(
'nid' => '11',
'enabled' => '1',
'machine_name' => 'a_readable_name',
'block_title' => 'ttttttttsssssssss',
'view_mode' => 'full',
'node_link' => '0',
'comment_link' => '0',
'translation_fallback' => '0',
),
),
)
Perhaps problem has something to do with including a copy of the nid in nodeblock array because that value wont be valid because node import will assign the object a new one after import.
I think this is high priority because node import is used often. Node import was the reason I created a patch some months ago for a named machine_name :)
After this issue is resolved I think the dev branch is in good shape.
Thanks
Comments
Comment #1
ronino commentedI had the same problem. The attached patch fixes this by adding the custom_machine_name field to the nodeblock section in the $node object in nodeblock_node_load(). This way nodeblock_node_update() correctly keeps the machine name.
Comment #2
ronino commentedHere is a patch that addresses one thing you mentioned:
The patch makes sure that the nodeblock record is saved for the correct nid on the target system when a node is updated from another server. Without, you can't update an existing nodeblock node with a different nid on another system.
Comment #3
steverweber commentedThanks
Both patches looks good.
Can someone else confirm, I love to see these two patches pulled into the dev branch.
Comment #4
idebr commentedPatch in #1 also fixes a fatal PDO error when an editor without 'administer nodeblock' permission saves a nodeblock with a custom machine name.
Comment #5
Johnny vd Laar commentedI've fixed the bug here:
Node export/import not compatible with Provide a machine name.
didn't use the patches.
Administer nodeblock permission does not exist anymore in the newest nodeblock so I'm not looking at any PDO errors.
Comment #6
Johnny vd Laar commentedPlease reopen when you have any problems with node imports.
Comment #8
ronino commentedJohnny vd Laar wrote:
Hmm, this is not fixed in the latest stable 7.x-1.4. How did you fix this without using the patches? After applying them, 1.4 works as expected considering the bugs described above.
This was just fixed as a side effect (mentioned in #4). The two bugs targeted with the patches #1 and #2 are described by the bug reporter. #3 confirms that the patches work so please really commit this to the current dev ;-).
Comment #9
Johnny vd Laar commentedOh sorry i should have posted a link to the commit there:
http://drupalcode.org/project/nodeblock.git/commit/87639bf
this was the commit.
Comment #10
Johnny vd Laar commentedComment #11
ronino commentedThe issue with the machine name has been resolved, thank you Johnny vd Laar!
However, when importing a nodeblock node exported via node_export, the correct nid is still not set (see #2). This only works if I export and import a node on the same system as the nid stays the same. If I export a node on one machine and import it on another machine, the nodeblock data gets lost as $node in nodeblock_node_insert() and nodeblock_node_update() already contains the new nid from the target system, but $node->nodeblock['nid'] contains the old one from the source system.
I reworked the patch for 1.6 and enhanced it to fix both nodeblock_node_insert() and nodeblock_node_update().
Comment #13
Johnny vd Laar commentedSeems to work. I've committed your fix here:
http://drupalcode.org/project/nodeblock.git/commitdiff/87960fc?hp=06f2d0...
Thank you!
Comment #14
ronino commentedGreat! Thank you, Johnny!