As a follow up to #786990: Get rid of the usage of eval() I've made a drush command to run the import of a big set of terms (~8000 items in a hierarchy of three levels) from command line.

It's just the minimum drush code to allow running a import. The import is done with code from install_profile_api. It's just a start that solves my problem. A better integration is possible :)

Trace:

$ drush --debug te-import profiles/prop/fixtures/taxonomy_regiones.export 
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.22 sec, 3.78 MB]                                         [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.29 sec, 4.5 MB]                                          [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.33 sec, 4.5 MB]                                 [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.38 sec, 4.5 MB]                                      [bootstrap]
Successfully connected to the Drupal database. [0.38 sec, 4.5 MB]                                                  [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.43 sec, 4.79 MB]                                         [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_login() [0.76 sec, 17.38 MB]                                       [bootstrap]
Found command: taxonomy-export-import (commandfile=taxonomy_export) [0.81 sec, 17.37 MB]                           [bootstrap]
Vocabulary 'Regiones' imported successfully. [1065.58 sec, 44.16 MB]                                                  [status]
8189 terms imported successfully. [1065.58 sec, 44.16 MB]                                                             [status]
Command dispatch complete [1065.58 sec, 44.14 MB]                                                                     [notice]
 Timer  Cum (sec)  Count  Avg (msec) 
 page   1065.249   1      1065248.97 
Peak memory usage was 60.26 MB [1065.59 sec, 44.14 MB]                                                                [memory]

A better integration is possible :)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pflame’s picture

jonhattan,

The above patch is working fine if I give the export file as full path. It is giving error when I give relative path from where I am running the command. I think it would be good if you support relative path.

jonhattan’s picture

Here is for relative paths. It still needs more love.

jaydub’s picture

Version: 6.x-1.1 » 6.x-2.x-dev
FileSize
2.41 KB

I took a stab at updating this Drush integration patch. I've added comments and some command help text as well as some logging. Let me know if this is helpful. Tested off of the 2.x branch.

jaydub’s picture

Reattached patch as a true patch to add the file rather than just the contents of the file. Now I can pull it in via drush make ;)

James Andres’s picture

Status: Needs review » Fixed

Patch committed to CVS, plus I added support for exporting via Drush.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.