diff --git a/lib/jekyll/migrators/wordpress.rb b/lib/jekyll/migrators/wordpress.rb index abeb68f6..3704d3cb 100644 --- a/lib/jekyll/migrators/wordpress.rb +++ b/lib/jekyll/migrators/wordpress.rb @@ -11,19 +11,17 @@ require 'yaml' module Jekyll module WordPress - - TABLE_PREFIX = 'wp_' - # Reads a MySQL database via Sequel and creates a post file for each - # post in wp_posts that has post_status = 'publish'. - # This restriction is made because 'draft' posts are not guaranteed to - # have valid dates. - QUERY = "select post_title, post_name, post_date, post_content, post_excerpt, ID, guid from #{TABLE_PREFIX}posts where post_status = 'publish' and post_type = 'post'" - - def self.process(dbname, user, pass, host = 'localhost') + def self.process(dbname, user, pass, host = 'localhost', table_prefix = 'wp_') db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host, :encoding => 'utf8') FileUtils.mkdir_p "_posts" + + # Reads a MySQL database via Sequel and creates a post file for each + # post in wp_posts that has post_status = 'publish'. + # This restriction is made because 'draft' posts are not guaranteed to + # have valid dates. + QUERY = "select post_title, post_name, post_date, post_content, post_excerpt, ID, guid from #{table_prefix}posts where post_status = 'publish' and post_type = 'post'" db[QUERY].each do |post| # Get required fields and construct Jekyll compatible name