Skip to content

Commit

Permalink
Merge branch 'develop' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
andriyun committed Nov 29, 2021
2 parents 099e2ab + 4f54b36 commit bdc8af6
Show file tree
Hide file tree
Showing 38 changed files with 1,113 additions and 104 deletions.
4 changes: 3 additions & 1 deletion .docker/os2web/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ if [ "$2" = "--push" ]; then
if [ $? -eq 0 ]; then
echo "Pushing image to docker hub ..."
docker push dkbellcom/os2web8:$1
echo "Check your image here https://hub.docker.com/repository/docker/dkbellcom/os2web8/tag"
docker rmi dkbellcom/os2web8:$1
echo "Image dkbellcom/os2web8:$1 was remove from this machine"
echo "Check your image here https://hub.docker.com/r/dkbellcom/os2web8/tags"
else
echo "Image is not pushed to docker hub :("
fi;
Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
"drupal/stage_file_proxy": "^1.0",
"drupal/upgrade_rector": "^1.0@alpha",
"drupal/upgrade_status": "^3.5",
"drupal/webform": "^6.1",
"drupal/workbench": "^1.3",
"drush/drush": "^9.7.1 | ^10.0.0",
"mglaman/drupal-check": "^1.1",
Expand All @@ -131,6 +132,7 @@
"os2web/os2web_news": "dev-master",
"os2web/os2web_pagebuilder": "dev-master",
"os2web/os2web_person_information": "dev-master",
"os2web/os2web_postlister": "dev-master",
"os2web/os2web_rest_api": "0.*",
"os2web/os2web_search": "dev-master",
"os2web/os2web_spotbox": "dev-master",
Expand Down Expand Up @@ -206,6 +208,9 @@
"drupal/printable": {
"3214729 PDF filename is generated with it's location" : "https://git.drupalcode.org/issue/printable-3214729/-/commit/cbc98dbe864f82b4cc1da110d88097d0c4740bb9.patch",
"#3193531, Drupal 9 errors from submodule": "https://git.drupalcode.org/issue/printable-3193531/-/commit/9b4d5fa8b6a713da671ab3143c8580fce45ca6fb.diff"
},
"drupal/scheduler_content_moderation_integration" : {
"Widget error when field is overridden - undefined offset 0 in $form['publish_state']" : "https://www.drupal.org/files/issues/2020-06-30/3077147-28.patch"
}
}
}
Expand Down
294 changes: 221 additions & 73 deletions composer.lock

Large diffs are not rendered by default.

98 changes: 98 additions & 0 deletions web/modules/custom/ringsted_d7_migration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Ringsted D7 Migration module

## Module purpose

The aim of this module is to provide migration of the content from Ringsted.dk D7 version to OS2Web D8.

## Install

1. Module is part of the repository, and can be installed:
```
drush en ringsted_d7_migration
```
2. Create separate Database and import D7 version of the site there. Database must be defined in **settings.php** file (next to the default one):
```
$databases['default']['default'] = array (
...
);

// Describe migration database.
$databases['migrate']['default'] = array (
'database' => '[db_name]',
'username' => '[db_user]',
'password' => '[db_password]',
'prefix' => '',
'host' => '[db_host]',
'port' => '',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);
```
## Migrate quick run
Run the entire migration process with single command:
```
cd web
sh ./modules/custom/ringsted_d7_migration/scripts/migrate.sh
```
## Migrate process details for manual run
The recommended usage migrate process is via Drush:
Read more about the Drush commands for Migrate API on [Migrate tools](https://www.drupal.org/project/migrate_tool).
* Migrate section terms:
```
drush migrate:import ringsted_d7_taxonomy_section
```
* Migrate News:
```
drush migrate:import ringsted_d7_node_news
```
* Migrate Postlister:
```
drush migrate:import ringsted_d7_node_postlister
```
## Useful hints
When changing migration definition in **.yml** files, import the changes with:
```
drush cim --partial --source=modules/custom/ringsted_d7_migration/config/install -y
```
If migration stopped with an error, it might need to be reset, e.g.:
```
drush migrate:reset [migation_name]
```
Instead of migrating/importing all entities, it is faster to do development with importing only few entities. Use **limit** flag:
```
drush migrate:import [migation_name] --limit=5
```
By default each migration run will import only new entities, but sometimes you want to overwrite what you already have instead of importing new ones. That can be done with **update** flag:
```
drush migrate:import [migation_name] --update
```
Use it with **limit** flag to force update previously imported entities:
```
drush migrate:import [migation_name] --limit=5 --update
```
## Contribution
Project is opened for new features and os course bugfixes.
If you have any suggestion or you found a bug in project, you are very welcome
to create an issue in github repository issue tracker.
For issue description there is expected that you will provide clear and
sufficient information about your feature request or bug report.
### Code review policy
See [OS2Web code review policy](https://github.com/OS2Web/docs#code-review)
### Git name convention
See [OS2Web git name convention](https://github.com/OS2Web/docs#git-guideline)
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
id: ringsted_d7_node_news
label: Ringsted D7 Node News
migration_group: ringsted_d7
migration_tags:
- Drupal 7
- Content
deriver: Drupal\node\Plugin\migrate\D7NodeDeriver
source:
plugin: d7_node
node_type: news
track_changes: true
process:
# If you are using this file to build a custom migration consider removing
# the nid and vid fields to allow incremental migrations.
# In D7, nodes always have a tnid, but it's zero for untranslated nodes.
# We normalize it to equal the nid in that case.
# @see \Drupal\node\Plugin\migrate\source\d7\Node::prepareRow().
type:
plugin: default_value
default_value: os2web_news
langcode:
plugin: default_value
source: language
default_value: 'und'
title: title
field_os2web_news_heading: title
status: status
created: created
changed: changed
#promote: promote
sticky: sticky
field_os2web_news_article_author: field_author
field_os2web_news_article_date:
- plugin: skip_row_if_old_news
index: 0
source: field_date
- plugin: sub_process
source: field_date
process:
value:
plugin: format_date
from_format: 'Y-m-d H:i:s'
to_format: 'Y-m-d\TH:i:s'
from_timezone: 'Europe/Copenhagen'
source: value
field_os2web_news_description:
- plugin: sub_process
source: body
process:
value: value
format:
plugin: default_value
default_value: 'wysiwyg_tekst'
field_os2web_news_section:
- plugin: sub_process
source: field_taxonomy_subject_area
process:
target_id:
plugin: migration_lookup
migration: ringsted_d7_taxonomy_section
source: tid
field_os2web_news_intro: field_teaser
migrate_file_url_source:
- plugin: extract
source: field_image_thumbnail
default: ''
index:
- 0
- plugin: callback
callable:
- 'Drupal\ringsted_d7_migration\Utility\MigrationHelper'
- getFileDownloadUrl
migrate_file_url_destination:
- plugin: extract
source: field_image_thumbnail
default: ''
index:
- 0
- plugin: callback
callable:
- 'Drupal\ringsted_d7_migration\Utility\MigrationHelper'
- generateFileDestinationPath
migrate_file_fid:
- plugin: skip_on_empty
method: process
source: '@migrate_file_url_source'
message: 'Image is missing'
- plugin: file_copy
source:
- '@migrate_file_url_source'
- '@migrate_file_url_destination'
- plugin: callback
callable:
- 'Drupal\ringsted_d7_migration\Utility\MigrationHelper'
- createFileManaged
field_os2web_news_primaryimage/target_id: '@migrate_file_fid'
field_os2web_news_primaryimage/alt: field_image_description/0/value
destination:
plugin: entity:node
migration_dependencies:
required:
- ringsted_d7_taxonomy_section
optional: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
id: ringsted_d7_node_postlister
label: Ringsted D7 Node Postlister
migration_group: ringsted_d7
migration_tags:
- Drupal 7
- Content
deriver: Drupal\node\Plugin\migrate\D7NodeDeriver
source:
plugin: d7_node
node_type: postliste
track_changes: true
process:
# If you are using this file to build a custom migration consider removing
# the nid and vid fields to allow incremental migrations.
# In D7, nodes always have a tnid, but it's zero for untranslated nodes.
# We normalize it to equal the nid in that case.
# @see \Drupal\node\Plugin\migrate\source\d7\Node::prepareRow().
type:
plugin: default_value
default_value: os2web_postlister
langcode:
plugin: default_value
source: language
default_value: 'und'
title: title
field_os2web_postlister_heading: field_teaser
status: status
created:
plugin: skip_row_if_old
skipOlderThanDate: "2021-01-01"
source: created
message: "Skipped old content"
changed: changed
#promote: promote
sticky: sticky
field_os2web_postlister_descript:
- plugin: sub_process
source: body
process:
value: value
format:
plugin: default_value
default_value: 'wysiwyg_tekst'
field_os2web_postlister_kle/target_id:
- plugin: callback
callable:
- 'Drupal\ringsted_d7_migration\Utility\MigrationHelper'
- findPostlisterKleTerm
source: nid
field_os2web_postlister_section:
- plugin: sub_process
source: field_taxonomy_subject_area
process:
target_id:
plugin: migration_lookup
migration: ringsted_d7_taxonomy_section
source: tid
destination:
plugin: entity:node
migration_dependencies:
required:
- ringsted_d7_taxonomy_section
optional: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
id: ringsted_d7_taxonomy_section
label: Ballerup D7 Taxonomy section
migration_group: ringsted_d7
migration_tags:
- Drupal 7
deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver
source:
plugin: d7_taxonomy_term
bundle: subject_area
track_changes: true
process:
vid:
plugin: default_value
default_value: os2web_sektion
name: name
weight: weight
# Only attempt to stub real (non-zero) parents.
parent_id:
-
plugin: skip_on_empty
method: process
source: parent
-
plugin: migration_lookup
migration: ringsted_d7_taxonomy_section
parent:
plugin: default_value
default_value: 0
source: '@parent_id'
changed: timestamp
langcode: language
destination:
plugin: entity:taxonomy_term
migration_dependencies:
required: {}
optional: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
langcode: da
status: true
dependencies:
enforced:
module:
- ringsted_d7_migration
id: ringsted_d7
label: 'Ringsted D7 Content'
description: 'Ringsted.dk D7 content import'
source_type: 'Ringsted.dk Database'
module: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Ringsted.dk D7 Migration
description: Custom migration module for migrating data from Ringsted.dk Drupal 7 site.
package: 'Bellcom'
type: module
core: 8.x
core_version_requirement: ^8 || ^9
dependencies:
- migrate
- migrate_drupal
- migrate_plus
- os2web_news
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php
21 changes: 21 additions & 0 deletions web/modules/custom/ringsted_d7_migration/scripts/migrate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

echo "Migration started"

echo "Importing new import configuration"
drush cim --partial --source=modules/custom/ringsted_d7_migration/config/install -y
echo "Configuration imported"

echo "Migration ringsted_d7_taxonomy_section - START"
drush migrate:import ringsted_d7_taxonomy_section
echo "Migration ringsted_d7_taxonomy_section - END"

echo "Migration ringsted_d7_node_news - START"
drush migrate:import ringsted_d7_node_news
echo "Migration ringsted_d7_node_news - END"

echo "Migration ringsted_d7_node_postlister - START"
drush migrate:import ringsted_d7_node_postlister
echo "Migration ringsted_d7_node_postlister - END"

echo "Migration finished"
Loading

0 comments on commit bdc8af6

Please sign in to comment.