Merge branch 'master' of git://github.com/SustainableWebsites/refinerycms-wordpress-import
This commit is contained in:
commit
e367498ef0
|
@ -1,9 +1,11 @@
|
||||||
= Refinerycms-wordpress-import
|
= Refinerycms-wordpress-import
|
||||||
|
|
||||||
This project ist an importer for WordPress XML dumps into refinerycms(-blog).
|
This project is an importer for WordPress XML dumps into refinerycms(-blog).
|
||||||
|
|
||||||
So far, only blog-relevant data gets imported, I'm working on the cms pages part.
|
So far, only blog-relevant data gets imported, I'm working on the cms pages part.
|
||||||
|
|
||||||
|
Draft posts and posts with duplicate post titles are ignored (for now)
|
||||||
|
|
||||||
== Installation
|
== Installation
|
||||||
|
|
||||||
As there is no official release out yet, just add this repos to your projects Gemfile:
|
As there is no official release out yet, just add this repos to your projects Gemfile:
|
||||||
|
|
|
@ -35,10 +35,17 @@ module Refinery
|
||||||
raise "Referenced User doesn't exist! Make sure the authors are imported first." \
|
raise "Referenced User doesn't exist! Make sure the authors are imported first." \
|
||||||
unless user
|
unless user
|
||||||
|
|
||||||
post = ::BlogPost.create! :title => title, :body => content_formatted, :draft => draft?,
|
begin
|
||||||
:published_at => post_date, :created_at => post_date, :author => user,
|
is_draft = draft? ? "true" : "false"
|
||||||
|
if !draft?
|
||||||
|
p "creating post " + title + " Draft status: " + is_draft
|
||||||
|
post = ::BlogPost.create! :title => title,
|
||||||
|
:body => content_formatted,
|
||||||
|
:draft => draft?,
|
||||||
|
:published_at => post_date,
|
||||||
|
:created_at => post_date,
|
||||||
|
:author => user,
|
||||||
:tag_list => tag_list
|
:tag_list => tag_list
|
||||||
|
|
||||||
::BlogPost.transaction do
|
::BlogPost.transaction do
|
||||||
categories.each do |category|
|
categories.each do |category|
|
||||||
post.categories << category.to_refinery
|
post.categories << category.to_refinery
|
||||||
|
@ -51,6 +58,14 @@ module Refinery
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
p "Skipping draft post"
|
||||||
|
end
|
||||||
|
rescue Exception => e
|
||||||
|
# TODO if it's not an activerecord validation error about duplicate title then raise e
|
||||||
|
p e
|
||||||
|
end
|
||||||
|
|
||||||
post
|
post
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user