Updates to the Drupal import script

- Allow the VID and DB to be configurable by ENV vars.
- Make importing the blog optional.
This commit is contained in:
Robin Ward 2015-04-13 13:06:26 -04:00
parent db4c04d606
commit 3c189c9064

View File

@ -3,7 +3,8 @@ require File.expand_path(File.dirname(__FILE__) + "/base.rb")
class ImportScripts::Drupal < ImportScripts::Base
DRUPAL_DB = "newsite3"
DRUPAL_DB = ENV['DRUPAL_DB'] || "newsite3"
VID = ENV['DRUPAL_VID'] || 1
def initialize
super
@ -17,7 +18,7 @@ class ImportScripts::Drupal < ImportScripts::Base
end
def categories_query
@client.query("SELECT tid, name, description FROM taxonomy_term_data WHERE vid = 1")
@client.query("SELECT tid, name, description FROM taxonomy_term_data WHERE vid = #{VID}")
end
def execute
@ -37,7 +38,10 @@ class ImportScripts::Drupal < ImportScripts::Base
# "Nodes" in Drupal are divided into types. Here we import two types,
# and will later import all the comments/replies for each node.
# You will need to figure out what the type names are on your install and edit the queries to match.
create_blog_topics
if ENV['DRUPAL_IMPORT_BLOG']
create_blog_topics
end
create_forum_topics
create_replies