I didn't want to hijack baseman's post, so I started my own.
If someone could elaborate on a few things, that would be great.
[quote][quote]I now need to import about 100 standard pages via the import_from_xml.php, however looking at the export file it would seem that the exported asset id is used in a lot of the xml action_id tags! Is this just to make the action_id tag unique?[/quote]
Yes, this is just to ensure action IDs are unique as we use the same export script in our testing framework and it needs unique names in order to record time/memory/queries for each import action.[/quote]
So, if I have 1000 user assets that I am wanting to create, does each action_id for the user asset need to be unique? The export_to_xml.php script gave me <action_id>create_User_39435</action_id>, should I increment the number each time so that within my .xml document I am importing these are unique? And then for child assets <action_id>create_Inbox_39436</action_id> those need to be incremented as well?
Also, in the xml that the script exported, for the value of some fields like username, firstname, etc is looks like this:
Is the CDATA part even needed?
Will it be problematic to import over 1000 assets? Obviously I will test it on our test install....
Each <action_id> specified in the import must be unique, so it's fine to have create_User_39435 and create_Inbox_39435.
[quote]Also, in the xml that the script exported, for the value of some fields like username, firstname, etc is looks like this:
Is the CDATA part even needed?[/quote]
It is advised to retain the CDATA declaration as the XML will not parse if attempting to set a field with reserved XML characters if this is not included (eg; "O'Loughlin"). The other reserved characters are & < > "
[quote]Will it be problematic to import over 1000 assets? Obviously I will test it on our test install....[/quote]
It is all relative to the amount of memory reserved for Matrix and the complexity of the import actions. In this case I can't see any problem with either of these points.
I am happy to say that I just imported over 1900 user assets into Matrix and it worked perfectly! Now, building the script to write the XML, that took a little longer!
There was a few problems (very minor), which I am not sure if it is a bug in the script, or there is really no way around it.
First, my first 5 users I realized I had tested importing before, so I script gave me errors the second time I ran it, saying that the username needs to be unique. Problem with this, is that they assets are still created, but were basically orphan assets that are really hard to delete.
Second, since the script creates the user assets, they are owned by the system, so trying to delete any of those user assets will give errors when emptying the trash saying that I don't have permissions. The solution to this was to again set the data directory to have the apache users permissions.
So, those two are minor, and not sure if they can even be fixed.
The script is completely raw and sets the internal run level to OPEN, which means there is absolutely no validation of anything except that enforced by the DB (like unique usernames). That is why you get the errors you do. You'd need to do additional work before or after to solve those problems.
[quote]There was a few problems (very minor), which I am not sure if it is a bug in the script, or there is really no way around it.
First, my first 5 users I realized I had tested importing before, so I script gave me errors the second time I ran it, saying that the username needs to be unique. Problem with this, is that they assets are still created, but were basically orphan assets that are really hard to delete.
Second, since the script creates the user assets, they are owned by the system, so trying to delete any of those user assets will give errors when emptying the trash saying that I don't have permissions. The solution to this was to again set the data directory to have the apache users permissions.
So, those two are minor, and not sure if they can even be fixed.[/quote]
You should su to a user in the apache group when you run the import script - that should solve the filesystem permission errors.