mercator_legacy_importer 0.0.1 → 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.rdoc +22 -1
- data/app/models/mercator_legacy_importer/asset.rb +6 -3
- data/app/models/mercator_legacy_importer/attachable.rb +7 -4
- data/app/models/mercator_legacy_importer/category.rb +10 -7
- data/app/models/mercator_legacy_importer/category_translation.rb +9 -6
- data/app/models/mercator_legacy_importer/cms_node.rb +8 -5
- data/app/models/mercator_legacy_importer/cms_node_translation.rb +9 -6
- data/app/models/mercator_legacy_importer/connector.rb +8 -5
- data/app/models/mercator_legacy_importer/content.rb +7 -4
- data/app/models/mercator_legacy_importer/content_item.rb +7 -4
- data/app/models/mercator_legacy_importer/country.rb +6 -3
- data/app/models/mercator_legacy_importer/page_template.rb +9 -6
- data/app/models/mercator_legacy_importer/product.rb +12 -9
- data/app/models/mercator_legacy_importer/product_overview_property.rb +6 -3
- data/app/models/mercator_legacy_importer/product_property.rb +8 -5
- data/app/models/mercator_legacy_importer/product_relation.rb +6 -3
- data/app/models/mercator_legacy_importer/product_supply.rb +6 -3
- data/app/models/mercator_legacy_importer/product_translation.rb +10 -7
- data/app/models/mercator_legacy_importer/property.rb +12 -9
- data/app/models/mercator_legacy_importer/property_translation.rb +9 -6
- data/app/models/mercator_legacy_importer/recommendation.rb +9 -7
- data/app/models/mercator_legacy_importer/recommendation_translation.rb +10 -7
- data/app/models/mercator_legacy_importer/user.rb +6 -3
- data/app/views/layouts/mercator_legacy_importer/application.html.erb +10 -11
- data/db/migrate/20131202162757_add_legacy_ids.rb +10 -6
- data/lib/mercator_legacy_importer/version.rb +2 -2
- data/lib/tasks/categories.rake +43 -0
- data/lib/tasks/categorizations.rake +43 -0
- data/lib/tasks/category_images.rake +42 -34
- data/lib/tasks/cms_node_images.rake +91 -81
- data/lib/tasks/content_elements.rake +66 -44
- data/lib/tasks/countries.rake +16 -10
- data/lib/tasks/features.rake +25 -17
- data/lib/tasks/page_template.rake +16 -9
- data/lib/tasks/product_images.rake +25 -8
- data/lib/tasks/product_relations.rake +21 -13
- data/lib/tasks/products.rake +52 -39
- data/lib/tasks/properties.rake +45 -36
- data/lib/tasks/recommendations.rake +30 -19
- data/lib/tasks/remaining_assets.rake +34 -26
- data/lib/tasks/remaining_images.rake +34 -26
- data/lib/tasks/supply_relations.rake +23 -13
- data/lib/tasks/unlinked_content_items.rake +24 -18
- data/lib/tasks/users.rake +43 -10
- data/lib/tasks/webpages.rake +34 -0
- metadata +30 -39
- data/app/helpers/mercator_legacy_importer/application_helper.rb +0 -4
- data/config/database.yml +0 -13
- data/db/migrate/20131202164442_products_add_legacy_id.rb +0 -9
- data/db/migrate/20140103154252_add_legacy_id_to_page.rb +0 -9
- data/db/migrate/20140103161205_add_legacy_id_to_page_template.rb +0 -9
- data/db/migrate/20140104094617_add_legacy_id_to_feature.rb +0 -9
- data/db/migrate/20140107090420_add_legacy_id_to_content_elements.rb +0 -9
- data/lib/tasks/categories.rb +0 -32
- data/lib/tasks/categorizations.rb +0 -35
- data/lib/tasks/mercator_legacy_importer_tasks.rake +0 -34
- data/lib/tasks/pages.rake +0 -27
- data/lib/tasks/unlinked_content_elements.rake +0 -60
@@ -1,21 +1,25 @@
|
|
1
1
|
class AddLegacyIds < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
3
|
add_column :users, :legacy_id, :integer
|
4
|
-
|
5
4
|
add_column :properties, :legacy_id, :integer
|
6
|
-
|
7
5
|
add_column :countries, :legacy_id, :integer
|
8
|
-
|
9
6
|
add_column :categories, :legacy_id, :integer
|
7
|
+
add_column :webpages, :legacy_id, :integer
|
8
|
+
add_column :products, :legacy_id, :integer
|
9
|
+
add_column :page_templates, :legacy_id, :integer
|
10
|
+
add_column :features, :legacy_id, :integer
|
11
|
+
add_column :content_elements, :legacy_id, :integer
|
10
12
|
end
|
11
13
|
|
12
14
|
def self.down
|
13
15
|
remove_column :users, :legacy_id
|
14
|
-
|
15
16
|
remove_column :properties, :legacy_id
|
16
|
-
|
17
17
|
remove_column :countries, :legacy_id
|
18
|
-
|
19
18
|
remove_column :categories, :legacy_id
|
19
|
+
remove_column :webpages, :legacy_id
|
20
|
+
remove_column :products, :legacy_id
|
21
|
+
remove_column :page_templates, :legacy_id
|
22
|
+
remove_column :features, :legacy_id
|
23
|
+
remove_column :content_elements, :legacy_id
|
20
24
|
end
|
21
25
|
end
|
@@ -1,3 +1,3 @@
|
|
1
1
|
module MercatorLegacyImporter
|
2
|
-
VERSION = "0.
|
3
|
-
end
|
2
|
+
VERSION = "0.1"
|
3
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
namespace :legacy_import do
|
4
|
+
# starten als: 'bundle exec rake legacy_import:categories
|
5
|
+
# in Produktivumgebungen: 'bundle exec rake legacy_import:categories RAILS_ENV=production'
|
6
|
+
desc "Import categories from legacy webshop"
|
7
|
+
task :categories => :environment do
|
8
|
+
|
9
|
+
puts "\n\nCategories:"
|
10
|
+
Category.all.each do |category|
|
11
|
+
category.delete
|
12
|
+
end
|
13
|
+
print "Categories deleted."
|
14
|
+
|
15
|
+
MercatorLegacyImporter::Category.all.each do |legacy_category|
|
16
|
+
legacy_category_de = legacy_category.category_translations.german.first
|
17
|
+
legacy_category_en = legacy_category.category_translations.english.first
|
18
|
+
|
19
|
+
category = Category.create(name_de: legacy_category_de.title && legacy_category.name)
|
20
|
+
parent = Category.find_by_legacy_id(legacy_category.parent_id)
|
21
|
+
|
22
|
+
name_en = legacy_category_en.title.present? ? legacy_category_en.title : "missing_name"
|
23
|
+
|
24
|
+
if category.update_attributes(name_en: name_en,
|
25
|
+
description_de: legacy_category_de.short_description,
|
26
|
+
description_en: legacy_category_en.short_description,
|
27
|
+
long_description_de: legacy_category_de.long_description,
|
28
|
+
long_description_en: legacy_category_en.long_description,
|
29
|
+
position: legacy_category.position,
|
30
|
+
parent: ( parent if parent ) ,
|
31
|
+
legacy_id: legacy_category.id)
|
32
|
+
category.state = "active" if legacy_category.active == true
|
33
|
+
if category.save
|
34
|
+
print "C"
|
35
|
+
else
|
36
|
+
puts "\nFAILURE: Category " + category.errors.first.to_s
|
37
|
+
end
|
38
|
+
else
|
39
|
+
puts "\nFAILURE: Category " + category.errors.first.to_s
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
namespace :legacy_import do
|
4
|
+
# starten als: 'bundle exec rake legacy_import:categorizations
|
5
|
+
# in Produktivumgebungen: 'bundle exec rake legacy_import:categorizations RAILS_ENV=production'
|
6
|
+
desc "Import categorizations from legacy webshop"
|
7
|
+
task :categorizations => :environment do
|
8
|
+
|
9
|
+
puts "\n\nCategorizations:"
|
10
|
+
MercatorLegacyImporter::Product.all.each do |legacy_product|
|
11
|
+
|
12
|
+
unless product = Product.find_by_legacy_id(legacy_product.id) then
|
13
|
+
puts "\nFAILURE: Product " + legacy_product.id.to_s + " not found."
|
14
|
+
next
|
15
|
+
end
|
16
|
+
|
17
|
+
if legacy_product.article_group && legacy_product.article_group.length == 11
|
18
|
+
legacy_product.article_group = "00" + legacy_product.article_group[0..3] +
|
19
|
+
"00" + legacy_product.article_group[4..7] +
|
20
|
+
"00" + legacy_product.article_group[8..10] +
|
21
|
+
"-00000-00000"
|
22
|
+
end
|
23
|
+
|
24
|
+
unless legacy_category = MercatorLegacyImporter::Category.find_by_category_product_group(legacy_product.article_group) then
|
25
|
+
puts "\nFAILURE: Legacy Category " + legacy_product.article_group.to_s + " not found."
|
26
|
+
next
|
27
|
+
end
|
28
|
+
|
29
|
+
unless category = Category.find_by_legacy_id(legacy_category.id) then
|
30
|
+
puts "\nFAILURE: Category " + legacy_category.id.to_s + " not found."
|
31
|
+
next
|
32
|
+
end
|
33
|
+
|
34
|
+
categorization = Categorization.find_or_initialize_by_product_id_and_category_id(product.id, category.id)
|
35
|
+
unless categorization.update_attributes(position: 1) then
|
36
|
+
puts "\nFAILURE: Categorization " + categorization.errors.first.to_s
|
37
|
+
next
|
38
|
+
end
|
39
|
+
|
40
|
+
print "…"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,49 +1,57 @@
|
|
1
|
-
|
2
|
-
require 'net/http'
|
3
|
-
puts "\n\nCategory Images:"
|
1
|
+
# encoding: utf-8
|
4
2
|
|
5
|
-
|
3
|
+
namespace :legacy_import do
|
4
|
+
# starten als: 'bundle exec rake legacy_import:category_images
|
5
|
+
# in Produktivumgebungen: 'bundle exec rake legacy_import:category_images RAILS_ENV=production'
|
6
|
+
desc "Import category images from legacy webshop"
|
7
|
+
task :category_images => :environment do
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
+
require 'net/http'
|
10
|
+
puts "\n\nCategory Images:"
|
9
11
|
|
10
|
-
|
12
|
+
assets = []
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
next
|
15
|
-
end
|
14
|
+
Net::HTTP.start("www.iv-shop.at") do |http|
|
15
|
+
MercatorLegacyImporter::Attachable.where(attachable_type: "Category").each do |legacy_attachable|
|
16
16
|
|
17
|
-
|
18
|
-
puts "\nFAILURE: Asset not found: " + legacy_attachable.asset_id.to_s
|
19
|
-
next
|
20
|
-
end
|
17
|
+
category = Category.where(legacy_id: legacy_attachable.attachable_id).first
|
21
18
|
|
22
|
-
|
23
|
-
|
19
|
+
unless category
|
20
|
+
puts "\nFAILURE: Category not found: " + legacy_attachable.attachable_id.to_s
|
21
|
+
next
|
22
|
+
end
|
24
23
|
|
25
|
-
|
24
|
+
unless legacy_attachable.asset
|
25
|
+
puts "\nFAILURE: Asset not found: " + legacy_attachable.asset_id.to_s
|
26
|
+
next
|
27
|
+
end
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
filename = "/system/datas/" + legacy_attachable.asset.id.to_s +
|
30
|
+
"/original/" + legacy_attachable.asset.data_file_name
|
31
|
+
|
32
|
+
data = StringIO.new(http.get(filename).body)
|
31
33
|
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
unless data
|
35
|
+
puts "\nFAILURE: Image not found " + filename
|
36
|
+
next
|
37
|
+
end
|
35
38
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
data.class.class_eval { attr_accessor :original_filename }
|
40
|
+
data.original_filename = legacy_attachable.asset.data_file_name
|
41
|
+
category.photo = data
|
42
|
+
|
43
|
+
if category.save
|
44
|
+
print "C"
|
45
|
+
assets << legacy_attachable.asset
|
46
|
+
legacy_attachable.delete()
|
47
|
+
else
|
48
|
+
puts "\nFAILURE: Category: " + category.errors.first.to_s
|
49
|
+
end
|
42
50
|
end
|
43
51
|
end
|
44
|
-
end
|
45
52
|
|
46
|
-
|
47
|
-
|
53
|
+
assets.each do |asset|
|
54
|
+
asset.delete()
|
55
|
+
end
|
48
56
|
end
|
49
57
|
end
|
@@ -1,91 +1,101 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
namespace :legacy_import do
|
4
|
+
# starten als: 'bundle exec rake legacy_import:cms_node_images
|
5
|
+
# in Produktivumgebungen: 'bundle exec rake legacy_import:cms_node_images RAILS_ENV=production'
|
6
|
+
desc "Import cms node images from legacy webshop"
|
7
|
+
task :cms_node_images => :environment do
|
8
|
+
|
9
|
+
require 'net/http'
|
10
|
+
puts "\n\nCMS Node Images:"
|
11
|
+
|
12
|
+
@legacy_contents = []
|
13
|
+
@legacy_attachables = []
|
14
|
+
|
15
|
+
Net::HTTP.start("www.iv-shop.at") do |http|
|
16
|
+
MercatorLegacyImporter::CmsNode.where(name: "images").each do |legacy_cms_node|
|
17
|
+
# MercatorLegacyImporter::CmsNode.all.each do |legacy_cms_node|
|
18
|
+
|
19
|
+
webpage = Webpage.where(legacy_id: legacy_cms_node.parent_id).first
|
20
|
+
|
21
|
+
legacy_cms_node.connectors.each do |legacy_connector|
|
22
|
+
if legacy_connector.position != 1
|
23
|
+
@used_as = legacy_cms_node.name + legacy_connector.position.to_s
|
24
|
+
else
|
25
|
+
@used_as = legacy_cms_node.name
|
26
|
+
end
|
27
|
+
|
28
|
+
@locale = legacy_connector.locale
|
29
|
+
legacy_content = legacy_connector.content
|
30
|
+
legacy_id = legacy_cms_node.id
|
31
|
+
|
32
|
+
content_element = ContentElement.find_or_initialize_by(legacy_id: legacy_id)
|
33
|
+
content_element.markup = "html"
|
34
|
+
content_element.name_de = legacy_content.name if @locale == "de"
|
35
|
+
content_element.name_en = legacy_content.name if @locale == "en"
|
36
|
+
|
37
|
+
content_element.name_de ||= content_element.name_en
|
38
|
+
content_element.name_de ||= "Name fehlt (" + legacy_id.to_s + ")"
|
39
|
+
|
40
|
+
legacy_attachable = MercatorLegacyImporter::Attachable.where(attachable_type: "Content", attachable_id: legacy_content.id).first
|
41
|
+
unless legacy_attachable
|
42
|
+
puts "\nFAILURE: Attachable not found " + legacy_content.id.to_s
|
43
|
+
next
|
44
|
+
end
|
45
|
+
|
46
|
+
filename = "/system/datas/" + legacy_attachable.asset_id.to_s +
|
47
|
+
"/original/" + legacy_content.name
|
48
|
+
|
49
|
+
data = StringIO.new(http.get(filename).body)
|
50
|
+
|
51
|
+
unless data
|
52
|
+
puts "\nFAILURE: Image not found " + filename
|
53
|
+
next
|
54
|
+
end
|
55
|
+
|
56
|
+
data.class.class_eval { attr_accessor :original_filename }
|
57
|
+
data.original_filename = legacy_attachable.asset.data_file_name
|
58
|
+
content_element.photo = data
|
59
|
+
|
60
|
+
MercatorLegacyImporter::ContentItem.where(content_id: legacy_content.id).each do |legacy_content_item|
|
61
|
+
content_element.content_de = legacy_content_item.value if @locale == "de"
|
62
|
+
content_element.content_en = legacy_content_item.value if @locale == "en"
|
63
|
+
legacy_content_item.delete()
|
64
|
+
end
|
65
|
+
|
66
|
+
unless content_element.save
|
67
|
+
# Trying to rescue duplicate names
|
68
|
+
content_element.name_de = content_element.name_de + " - Duplikat (" + legacy_id.to_s + ")"
|
69
|
+
unless content_element.save
|
70
|
+
puts "\nFAILURE: ContentElement: " + content_element.errors.first.to_s
|
71
|
+
next
|
72
|
+
end
|
73
|
+
end
|
62
74
|
print "C"
|
63
|
-
else
|
64
|
-
puts "\nFAILURE: ContentElement: " + content_element.errors.first.to_s
|
65
|
-
end
|
66
75
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
76
|
+
pcea = PageContentElementAssignment.find_or_initialize_by(used_as: @used_as,
|
77
|
+
webpage_id: webpage.id,
|
78
|
+
content_element_id: content_element.id)
|
79
|
+
unless pcea.save
|
80
|
+
puts "\nFAILURE: PageContentElementAssignment: " + pcea.errors.first.to_s
|
81
|
+
next
|
82
|
+
end
|
71
83
|
print "A"
|
72
|
-
else
|
73
|
-
puts "\nFAILURE: PageContentElementAssignment: " + pcea.errors.first.to_s
|
74
|
-
end
|
75
84
|
|
76
|
-
|
77
|
-
|
85
|
+
@legacy_contents << legacy_content
|
86
|
+
@legacy_attachables << legacy_attachable
|
78
87
|
|
79
|
-
|
88
|
+
legacy_connector.delete()
|
89
|
+
end
|
90
|
+
legacy_cms_node.delete()
|
80
91
|
end
|
81
|
-
legacy_cms_node.delete()
|
82
|
-
end
|
83
92
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
93
|
+
@legacy_contents.each do |legacy_content|
|
94
|
+
legacy_content.delete()
|
95
|
+
end
|
96
|
+
@legacy_attachables.each do |legacy_attachable|
|
97
|
+
legacy_attachable.delete()
|
98
|
+
end
|
89
99
|
end
|
90
100
|
end
|
91
101
|
end
|
@@ -1,64 +1,86 @@
|
|
1
|
-
|
2
|
-
puts "\n\nContent Elements:"
|
1
|
+
# encoding: utf-8
|
3
2
|
|
4
|
-
|
3
|
+
namespace :legacy_import do
|
4
|
+
# starten als: 'bundle exec rake legacy_import:content_elements
|
5
|
+
# in Produktivumgebungen: 'bundle exec rake legacy_import:content_elements RAILS_ENV=production'
|
6
|
+
desc "Import content_elements from legacy webshop"
|
7
|
+
task :content_elements => :environment do
|
8
|
+
puts "\n\nContent Elements:"
|
5
9
|
|
6
|
-
|
7
|
-
|
8
|
-
|
10
|
+
ContentElement.all.each do |ce|
|
11
|
+
ce.delete
|
12
|
+
end
|
13
|
+
puts "Content Elements deleted."
|
9
14
|
|
10
|
-
|
15
|
+
PageContentElementAssignment.all.each do |pcea|
|
16
|
+
pcea.delete
|
17
|
+
end
|
18
|
+
puts "Page Content Element Assignments deleted."
|
11
19
|
|
12
|
-
|
13
|
-
if legacy_connector.position != 1
|
14
|
-
@used_as = legacy_cms_node.name + legacy_connector.position.to_s
|
15
|
-
else
|
16
|
-
@used_as = legacy_cms_node.name
|
17
|
-
end
|
20
|
+
@legacy_contents = []
|
18
21
|
|
19
|
-
|
22
|
+
MercatorLegacyImporter::CmsNode.where(name: ["main", "overview", "slogan"]).each do |legacy_cms_node|
|
20
23
|
|
21
|
-
|
24
|
+
webpage = Webpage.where(legacy_id: legacy_cms_node.parent_id).first
|
22
25
|
|
23
|
-
|
26
|
+
legacy_cms_node.connectors.each do |legacy_connector|
|
27
|
+
if legacy_connector.position != 1
|
28
|
+
@used_as = legacy_cms_node.name + legacy_connector.position.to_s
|
29
|
+
else
|
30
|
+
@used_as = legacy_cms_node.name
|
31
|
+
end
|
24
32
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
content_element.name_en = legacy_content.name if @locale == "en"
|
33
|
+
@locale = legacy_connector.locale
|
34
|
+
legacy_content = legacy_connector.content
|
35
|
+
legacy_id = legacy_cms_node.id
|
29
36
|
|
30
|
-
|
37
|
+
content_element = ContentElement.find_or_initialize_by(legacy_id: legacy_id)
|
38
|
+
content_element.markup = "html"
|
39
|
+
content_element.name_de = legacy_content.name if @locale == "de"
|
40
|
+
content_element.name_en = legacy_content.name if @locale == "en"
|
31
41
|
|
32
|
-
|
42
|
+
content_element.name_de ||= content_element.name_en
|
43
|
+
content_element.name_de ||= "Name fehlt (" + legacy_id.to_s + ")"
|
33
44
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
45
|
+
MercatorLegacyImporter::ContentItem.where(content_id: legacy_content.id).each do |legacy_content_item|
|
46
|
+
content_element.content_de = legacy_content_item.value if @locale == "de"
|
47
|
+
content_element.content_en = legacy_content_item.value if @locale == "en"
|
48
|
+
legacy_content_item.delete()
|
49
|
+
end
|
50
|
+
|
51
|
+
unless content_element.content_de.present?
|
52
|
+
content_element.content_de = "Inhalt fehlt (" + legacy_id.to_s + ")"
|
53
|
+
end
|
54
|
+
|
55
|
+
unless content_element.save
|
56
|
+
# Trying to rescue duplicate names
|
57
|
+
content_element.name_de = content_element.name_de + " - Duplikat (" + legacy_id.to_s + ")"
|
58
|
+
|
59
|
+
unless content_element.save
|
60
|
+
puts "\nFAILURE: ContentElement: " + content_element.errors.first.to_s
|
61
|
+
puts content_element.to_s
|
62
|
+
next
|
63
|
+
end
|
64
|
+
end
|
38
65
|
|
39
|
-
if content_element.save
|
40
66
|
print "C"
|
41
|
-
|
42
|
-
|
43
|
-
|
67
|
+
pcea = PageContentElementAssignment.find_or_initialize_by(used_as: @used_as,
|
68
|
+
webpage_id: webpage.id,
|
69
|
+
content_element_id: content_element.id)
|
70
|
+
unless pcea.save
|
71
|
+
puts "\nFAILURE: PageContentElementAssignment: " + pcea.errors.first.to_s
|
72
|
+
next
|
73
|
+
end
|
44
74
|
|
45
|
-
pcea = PageContentElementAssignment.find_or_initialize_by(used_as: @used_as,
|
46
|
-
page_id: page.id,
|
47
|
-
content_element_id: content_element.id)
|
48
|
-
if pcea.save
|
49
75
|
print "A"
|
50
|
-
|
51
|
-
|
76
|
+
@legacy_contents << legacy_content
|
77
|
+
legacy_connector.delete()
|
52
78
|
end
|
53
|
-
|
54
|
-
@legacy_contents << legacy_content
|
55
|
-
legacy_connector.delete()
|
79
|
+
legacy_cms_node.delete()
|
56
80
|
end
|
57
|
-
legacy_cms_node.delete()
|
58
|
-
end
|
59
81
|
|
60
|
-
|
61
|
-
|
82
|
+
@legacy_contents.each do |legacy_content|
|
83
|
+
legacy_content.delete()
|
84
|
+
end
|
62
85
|
end
|
63
|
-
|
64
86
|
end
|