Many drupal users will probably create the same or similar flexinode content types. While not being very difficult, I might be nice if users can exchange their content types through import and export.

Comments

javanaut’s picture

Yes, I could see a use for this. The current mechanism for such a task (for MySQL at least) would be something like the following:

Exporting:
Use mysqldump to dump the records in flexinode_type and flexinode_field. You'll need to identify the appropriate ctype_id by looking at the flexinode_type.name column.

SELECT ctype_id FROM flexinode_type WHERE name = '<name of content type>';

This will give you the ctype_id. Assume for example that ctype_id was the number 2.

Then dump just the data into a file:

mysqldump --no-create-info --complete-insert --where='ctype_id=2' your_drupal_database flexinode_type flexinode_field  > exported_type.sql

Importing:
You'll then need to edit the ctype_id in the exported_type.sql file to be a value that does not currently exist in your database. This is because the flexinode_type.ctype_id field is not auto_incremented, and it can't be for flexinode_field.ctype_id. New ids are generated programatically using db_next_id(). Therefore, this is a manual process of editing to match the database you're importing to so that you don't overwrite anything and the INSERTs succeed.

It shouldn't be too difficult to automate this, I wouldn't think.

Note: I've only been playing with flexinode for a few hours now, so I might have missed something here. From what I can see, this appears to be accurate.

Uwe Hermann’s picture

The Plone people are using an XML format to save their equivalent of flexinode types (they call them archetypes, IIRC). Maybe we should create some XML export/import for types, too. Possibly even compatible with the Plone stuff for simple migration etc.?

Bèr Kessels’s picture

Status: Active » Closed (works as designed)

There was another module that could export flexinodes.