3

I am having troubles exporting and importing a large numbers of CCK fields using Content copy (I need to have a file download/upload option).

Is there a SQL (or drush) command that can export and import CCK fields? I am interested in anything that bypasses the PHP memory limitations, 504 gateway time-outs, and what not.

Maybe I could still use HTTP from the webserver's CLI, something like wget <export from content copy> >data.txt and wget --post-data data.txt <import via content copy>.

3
  • 3
    Please specify your Drupal version. Have you looked at Migrate module (drupal.org/project/migrate)? Commented May 12, 2011 at 7:56
  • I added the tag for Drupal 6; if that it is not the Drupal version for which you are asking this question, please change the tag to the right one.
    – avpaderno
    Commented May 12, 2011 at 9:34
  • Yes, D6, thanks for the tag kiamluluno. Ive been looking at the database tables - where is the content type's structures defined? I will look to migrate...
    – Tom
    Commented May 12, 2011 at 15:16

1 Answer 1

0

There's two ways to solve this...

  1. Easy/tedious way, export only a few fields at a time using content copy and try to find out what's the max number of field you can select before running into php errors. This could be pretty cumbersome as you have a lot of field but this is the recommended/safe way.
  2. Hard/dangerous way is messing up directly with MySQL. You need to be a little SQL savy to do this and rigorous to not forget anything.

So a little explanation for the n°2, the information your looking for is in these tables:

  • content_type_CONTENT_TYPE_NAME, this table store all non multi-valued fields of your CT (CT = Content Type).
  • content_field_FIELD_NAME, there's one of these tables for each of your field that is set to be multi-valued.

Internals CCK tables:

  • content_node_field_instance, stores definitions of each of your fields (label, weight, widget, name of CT...)
  • content_node_field additionals settings (required, multivalue, db storage...)
  • content_group_fields and content_group informations regarding the grouping feature.

So now you have the table, now comes the tricky part.

If your CT and fields doesn't exists on the destination, it's quite easy, just export the tables of your CT and fields in SQL, export the content of the internal CCK tables using your CT and fields names.

If your CT or any of your fields (remember that fields can be shared between CT) exists on the destination you have to evaluate the changes and update the table structure to apply these changes, I think this easy pretty difficult to deal with so I wouldn't recommend you to do so.

Good Luck.

1
  • I ended up moving to a dedicated sever so I could max the time outs and mem and had did the job via #1 ... very tedious. And pointless. the end product leaves much to be desired. Anyone else embarking on a big form... just create a custom module and use CT Wizard and FAPI or something... anything but CCK. Even though I didn't get the #2 answer in time, that is what I was after. Thanks.
    – Tom
    Commented May 20, 2011 at 4:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.