Commit 313fc8ca0b2b77bf92ea1313ad054e04b85b1273
1 parent
a05ec074
Exists in
staging
and in
42 other branches
ActionItem862: more upgrade testing
Showing
1 changed file
with
15 additions
and
5 deletions
Show diff stats
script/apply-template
| @@ -8,14 +8,22 @@ env = Environment.default | @@ -8,14 +8,22 @@ env = Environment.default | ||
| 8 | 8 | ||
| 9 | def move_articles_to_blog(profile) | 9 | def move_articles_to_blog(profile) |
| 10 | profile.articles.each { |article| | 10 | profile.articles.each { |article| |
| 11 | - puts 'including ' + article.path + ' in the blog' | ||
| 12 | - if !article.blog? && !article.is_a?(RssFeed) | ||
| 13 | - article.parent_id = profile.blog.id | 11 | + if !article.blog? && !article.is_a?(RssFeed) && article.public_article |
| 12 | + puts 'including ' + article.path + ' in the blog' | ||
| 13 | + article.parent = profile.blog | ||
| 14 | article.save! | 14 | article.save! |
| 15 | end | 15 | end |
| 16 | } | 16 | } |
| 17 | end | 17 | end |
| 18 | 18 | ||
| 19 | +def report_doing(n, text) | ||
| 20 | + puts "#{n} - #{text} ..." | ||
| 21 | +end | ||
| 22 | + | ||
| 23 | +def report_done | ||
| 24 | + puts "[done]" | ||
| 25 | +end | ||
| 26 | + | ||
| 19 | case $ARGV[0] | 27 | case $ARGV[0] |
| 20 | when 'inactive-enterprise' | 28 | when 'inactive-enterprise' |
| 21 | offset = 0 | 29 | offset = 0 |
| @@ -47,9 +55,10 @@ when 'community' | @@ -47,9 +55,10 @@ when 'community' | ||
| 47 | offset = 0 | 55 | offset = 0 |
| 48 | while community = Community.find(:first, :order => :id, :offset => offset) | 56 | while community = Community.find(:first, :order => :id, :offset => offset) |
| 49 | if community != template && !excluded.include?(community.identifier) | 57 | if community != template && !excluded.include?(community.identifier) |
| 58 | + report_doing offset, profile.name | ||
| 50 | community.apply_template(template) | 59 | community.apply_template(template) |
| 51 | move_articles_to_blog(community) | 60 | move_articles_to_blog(community) |
| 52 | - puts "#{offset} - #{community.identifier}" | 61 | + report_done |
| 53 | end | 62 | end |
| 54 | offset = offset + 1 | 63 | offset = offset + 1 |
| 55 | end | 64 | end |
| @@ -58,9 +67,10 @@ when 'person' | @@ -58,9 +67,10 @@ when 'person' | ||
| 58 | offset = 0 | 67 | offset = 0 |
| 59 | while person = Person.find(:first, :order => :id, :offset => offset) | 68 | while person = Person.find(:first, :order => :id, :offset => offset) |
| 60 | if person != template | 69 | if person != template |
| 70 | + report_doing offset, person.identifier | ||
| 61 | person.apply_template(template) | 71 | person.apply_template(template) |
| 62 | move_articles_to_blog(person) | 72 | move_articles_to_blog(person) |
| 63 | - puts "#{offset} - #{person.identifier}" | 73 | + report_done |
| 64 | end | 74 | end |
| 65 | offset = offset + 1 | 75 | offset = offset + 1 |
| 66 | end | 76 | end |