How can I add taxonomy terms programatically into Drupal via an CSV file?
Posted on 2011-03-10
Let me start off by saying I'm a total noob when it comes to PHP and Drupal. I'm being tasked with the migration of legacy content off a proprietary CMS and into Drupal 6, but the powers that be do not want to install any of the helper modules that exist for migrating content into drupal (e.g. Migrate module, Features module ,Node_Import module, etc..). I suspect that they're trying to keep the Drupal system as lean as possible.
We have a three tier development environment where the drupal installation is moved from development to staging and finally to production, I only have read access to the database so it's not like and can just go and manipulate the drupal file system or database directly. According to my colleagues I should perform the migrations programtically by using a combination of CSV files and HOOK_UPDATE_N functions but they didn't provide me with any further instructions. As I understood it, once the hook_updates are added to the ".install" file, they can run the "update.php" file and everything will be added precisely the same in all of the three development environments.
My project involves:
- adding the taxonomy terms programatically
- adding the new content type programatically
- migrating the legacy content into the new content type programatically
For the moment I would be very happy if I could just add the taxonomy terms programatically. I would think that once I do that I can extrapolate that experience to accomplish the other two tasks. If anyone can point me to an example or provide suggestions it would be greatly appreciated.
Thanks in advance.