mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 15:25:35 +08:00
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:
parent
db4c04d606
commit
3c189c9064
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user