You are hereOther / Importing data

Importing data


Extracing tar files (without and with gzip or bzip) on Linux

When importing data you will probably be extracting or unpacking a tarball File
To unpack or extract a tar file, type:

tar -xvf file.tar

To save disk space and bandwidth files are saved using compression program such as gzip or bzip2. To extract / unpack a .tar.gz (gzip) file, enter (note -z option):

tar -xzvf file.tar.gz

To extract / unpack a .tar.bz2 (bzip2) file, enter (note -j option):

tar -xjvf file.tar.bz2

to extract gzip file

tar xvzf file.tar.gz

Archiving your files for migration /with folder exclussion

If you need to archive your files and you want to exclude some folders, for example "files" folder or some subfolders of files. You can use gzip for it

tar --exclude=sites/default/files/* --exclude=cache/* -cf file.tar . && gzip file.tar

And you will have a nice zip archive without folders you maybe don't want to transfer.

Create drupal node programmaticly

Everything you need for this is here http://www.unleashed-technologies.com/blog/2010/07/16/drupal-6-inserting...

Take a note that you can also use node_object_prepare($node); to automaticly prepend node with some defaults and one glitch is that if you have node type with a name like

mm-evid when you put it in node type it has to be downscore

$node->type = 'mm_evid';

Profil to Content Profile

There is a content profile module that basicly uses standard nodes for user profile data. When will you want to use it? When normal profile resources run out. This is usually when you want to have a more complex fields for user or have some backreferences.

User Import patched with Date import working

Importing dates like date of birth dosen't work with User import module. There is a clever patch with UI options for setting it up under user import configuration that can be found here but for users that want that patched already applied we provide it down below for download. It is current stable 6.2 version of module that is patched, with also additions of this two http://www.drupaldump.com/user-import-delimiter and http://www.drupaldump.com/user-imports-and-duplicat-emails customizations.

User import/Node Import, UTF characters and Excel

Many have encountered this unicode/utf encoding problems in their programming life. It is just a drag to make it right and without knowing all the stuff around it and understanding it you will have bugs and problems. You will usually import data to drupal with CSV files. It's fine until you start using non english alphabet. You will usually export your database as CSV from phpmyadmin which should do it fine and preserve unicode chars and save your csv file as UTF-8 file. So here is everything fine and if you import data like that it should import nicely.

User import Delimiter

If using user import module for drupal you could run into problems of delimiters. By default it uses comma and not much better solution which is semicolon, here is a patched filed that has constant on top if you want to change it manually

define ('DELIMITER',';');

there are also patches for this to be used automaticly or choosen from admin interface but until this is used in dev or current version, quickest way is to grab file below which is current DEV version edited.

 

Files: 

User imports and Duplicat Emails

When you are importing user with Drupal, you probably do it with user import module, but you'll probably have a list of uses without any email or with duplicate emails, in this module its hardcoded that one email is used per person. However if you install shared emails module and do some hacking on current DEV version (2.x) you will be able to do that.  In modules "supported" folder there is user.inc and go to line 235, there is a code that says