Moving content to another eZ publish installation

Author Message

Vjeran Vlahovic

Friday 26 January 2007 7:37:45 pm

Last week I was migrating content from one to another eZ publish installation through standard import/export package functionality. Here are some of my conclusions I want to share:

Import/export script heavily relies on remote_id. If you have previously imported content with the extensions which do not take care about uniqueness of remote_id, you should regenerate this values before exporting content to the package with something like this:

update ezcontentobject set remote_id=md5(concat(now(),id, rand()));
update ezcontentobject_tree set remote_id=md5(concat(now(),node_id, rand()));

Import of the package is not a transactional operation - make a backup before importing content package.

Current stable 3.8.6 release has problems with the import of ezdatetime attribute, which is fixed in 3.8.7, so replace the /kernel/classes/datatypes/ezdatetime/ezdatetimetype.php with the version from SVN.

I also had problems with custom sections, so I applied standard section to whole content before exporting it ( http://issues.ez.no/IssueView.php?Id=9840&activeItem=1 )

Packages do not preserve the real owner of the object or published/modified values. This is really nasty if you copy forum topics/replies, for example. So I had to write some simple php scripts which use remote_id to set the real owner_id in the new database and to sync publish/modified values.

Largest package I have successfully imported had 5000 content objects. (don't forget to raise timeouts like max_execution_time to at least 2 hours for large packages like this).

I hope some will find this useful :)

http://www.netgen.hr/eng

Xavier Dutoit

Saturday 27 January 2007 1:18:15 am

Hi,

Thanks for your feed-back, very valuable.

Did you package content with images/files ? Did it work ok ?

X+

http://www.sydesy.com

Vjeran Vlahovic

Saturday 27 January 2007 4:12:07 am

Hi Xavier,
fortunately all media objects and embedded images were copied without problems (less than 200 objects). Although, some articles lost intro value (ezxml) but it was too fuzzy behavior to report that as a bug.

http://www.netgen.hr/eng

Alexandre Cunha

Monday 03 September 2007 7:03:04 pm

Hello Vjeran

Thanks for this information. Im using the export/ import function to copy content from a site to another.

<quote>
Packages do not preserve the real owner of the object or published/modified values
</quote>

Can you please tell more about what you do you fix this?
Im only interest to preserver the published/modified date values for "folder" and "article" classes.

thank you

http://AlexandreCunha.com

Andy Caiger

Tuesday 15 July 2008 6:10:45 am

It seems this isn't fixed in eZ Publish 4.0 either.

I'm trying to import forums from version 3.9.2 into version 4.0.

Can you explain how to preserve owner ID and published/modified date values when importing content packages?

Thanks!

EAB - Integrated Internet Success
Offices in England, France & China.
http://www.eab.co.uk http://www.eab-china.com http://www.eab-france.com

Vjeran Vlahovic

Wednesday 16 July 2008 10:13:33 am

Hi Andy,
I just uploaded two simple php scripts as a contribution which can help you to synchronize owner_id, modified and published in ezcontentobject table and creator_id, created and modified in ezcontentobject_version table. Before runing them, import all your users and posts into your new instalation.

http://ez.no/developer/contribs/hacks/owner_id_creator_id_modified_and_published_synchronizer

http://www.netgen.hr/eng

Andy Caiger

Wednesday 03 September 2008 9:32:59 am

Thanks Vjeran! This is great.

These scripts worked well.

It's worth pointing out that they depend on the <b>ADOdb Database Abstraction Library</b> which is available at http://adodb.sourceforge.net/

Andy

EAB - Integrated Internet Success
Offices in England, France & China.
http://www.eab.co.uk http://www.eab-china.com http://www.eab-france.com

James Stevens

Thursday 04 September 2008 4:32:52 am

Thanks Vjeren, this is useful info.

I've been doing quite a lot of package importing/exporting recently, not with quite as many objects as you however (~700) but it's re-assuring you've done 5000!

I encountered quite a few issues with importing packages, i think primarily because we're using Oracle, and some queries in the kernel are still only MySQL compatible.

Other than that i've seen the usual php config issues like timeouts and exhaustion of RAM.

I've also seen a few issues with image objects losing the actual image.

James Stevens

Thursday 04 September 2008 4:41:08 am

If you're running eZ Publish 4.0.1 there's an update script you can run to fix remote-ids, so the direct SQL update statements may not be needed if you have an up to date base.

Here's the page:-

http://ez.no/doc/ez_publish/upgrading/upgrading_to_4_0/from_4_0_x_to_4_0_y

Here's some vitals from the webpage:-

<i>The following example shows how to run the script:

1.
Navigate into the eZ Publish 4.0.1 directory.
2.

Run the script (replace "example" with the actual name of your siteaccess):

php update/common/scripts/4.0/fixobjectremoteid.php -s example

The script will search for objects with non-unique remote IDs. Every time such an object is found, the script will suggest to either display more detailed information or fix the problem automatically. If you choose the first option, the script will display the list of objects that have the same remote ID and let you decide which one should remain unchanged; all other objects in the list will get new remote IDs. Otherwise, the script will fix the problem automatically based on the objects' creation dates. This means that the script will generate new remote IDs for all objects in the list except the one that was created first.</i>

Vjeran Vlahovic

Wednesday 10 September 2008 3:46:07 pm

@andy: I'm glad these scripts worked well for you!
@james: thanks for the feedback, didn't know about fixobjectremoteid.php - much more elegant than my solution ;)

http://www.netgen.hr/eng

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.