Skip to content

Commit

Permalink
Added blog code from old webiva
Browse files Browse the repository at this point in the history
  • Loading branch information
cykod committed May 21, 2010
1 parent 81e330f commit 2eeb792
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib/tasks/website_export.rake
Expand Up @@ -16,12 +16,27 @@ task :website_export => [:environment] do |t|
backup_dir = Time.now.strftime('%Y%m%d%H%M%S') + "_export_" + dmn.database
dir = "#{RAILS_ROOT}/backup/#{backup_dir}"
FileUtils.mkpath(dir)


lang = Configuration.languages[0]

SiteNode.find(:all,:conditions => 'node_type = "P"').each do |path|
FileUtils.mkpath(dir + path.node_path)
print("Exporting: #{path.node_path}...")
`wget -O #{dir}#{path.node_path}/index.html #{dmn.name}#{path.node_path}`
print("Done\n")

rev = path.active_revision(lang)
if rev
rev.page_paragraphs.find(:all,:conditions => {:display_type => 'entry_detail', :display_module => '/blog/page' }).each do |para|
print("Exporting Blog Detail: #{path.node_path}\n")
Blog::BlogPost.find(:all,:conditions => ['status = "published" AND blog_blog_id=?',para.data[:blog_id]]).each do |post|
FileUtils.mkpath("#{dir}#{path.node_path}/#{post.permalink}")
`wget -O "#{dir}#{path.node_path}/#{post.permalink}/index.html" "#{dmn.name}#{path.node_path}/#{post.permalink}"`
print("#{post.permalink}...")
end
print("..Done\n")
end
end
end

FileUtils.mkpath(dir + "/system/storage/#{dmn.file_store}")
Expand Down

0 comments on commit 2eeb792

Please sign in to comment.