Browse Source

got some migrations working

master
Josh Fabean 3 years ago
parent
commit
d1b744cac4
14 changed files with 3250 additions and 466 deletions
  1. +17
    -0
      .docksal/docksal.yml
  2. +2
    -0
      composer.json
  3. +215
    -466
      composer.lock
  4. +1
    -0
      config/default/default/core.extension.yml
  5. +36
    -0
      config/default/default/migrate_plus.migration.random_databases.yml
  6. +82
    -0
      config/default/default/migrate_plus.migration.upgrade_d7_should_have_been_page.yml
  7. +5
    -0
      docroot/modules/custom/sample_migration/sample_migration.links.menu.yml
  8. +131
    -0
      docroot/modules/custom/sample_migration/sample_migration.module
  9. +7
    -0
      docroot/modules/custom/sample_migration/sample_migration.routing.yml
  10. +64
    -0
      docroot/modules/custom/sample_migration/src/Form/TitleBodyParagraphForm.php
  11. +54
    -0
      docroot/modules/custom/sample_migration/src/Plugin/migrate/source/RandomDatabases.php
  12. +0
    -0
      docroot/sites/default/.gitignore
  13. +2584
    -0
      drupal7.sql
  14. +52
    -0
      randomdb.sql

+ 17
- 0
.docksal/docksal.yml View File

@ -40,6 +40,23 @@ services:
- ${DOCKSAL_DNS1}
- ${DOCKSAL_DNS2}
olddb:
hostname: olddb
image: docksal/db:1.1-mysql-5.6
ports:
- "${MYSQL_PORT_MAPPING:-3306}"
volumes:
- project_root:/var/www:ro,nocopy # Project root volume
- ${PROJECT_ROOT}/db:/docker-entrypoint-initdb.d:ro
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}
- MYSQL_USER=${MYSQL_USER:-user}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-user}
- MYSQL_DATABASE=${MYSQL_DATABASE:-default}
dns:
- ${DOCKSAL_DNS1}
- ${DOCKSAL_DNS2}
# CLI - Used for all console commands and tools.
cli:
hostname: cli


+ 2
- 0
composer.json View File

@ -45,6 +45,8 @@
"drupal/masquerade": "^2.0@beta",
"drupal/menu_link_attributes": "^1.0",
"drupal/metatag": "^1.9",
"drupal/migrate_tools": "^5.0",
"drupal/migrate_upgrade": "^3.2",
"drupal/module_filter": "~3.0",
"drupal/paragraphs": "^1.2",
"drupal/pathauto": "~1.0",


+ 215
- 466
composer.lock View File

@ -1,10 +1,10 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "d38396ede53bdc8e88f908a4ab25e133",
"content-hash": "b6143d0bd54145f44f68eabde4e4260f",
"packages": [
{
"name": "alchemy/zippy",
@ -292,16 +292,6 @@
"zend",
"zikula"
],
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2020-04-07T06:57:05+00:00"
},
{
@ -1969,20 +1959,6 @@
"orm",
"persistence"
],
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fpersistence",
"type": "tidelift"
}
],
"time": "2020-03-21T15:13:52+00:00"
},
{
@ -4238,6 +4214,218 @@
"docs": "https://www.drupal.org/docs/8/modules/metatag"
}
},
{
"name": "drupal/migrate_plus",
"version": "5.1.0",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/migrate_plus.git",
"reference": "8.x-5.1"
},
"dist": {
"type": "zip",
"url": "https://ftp.drupal.org/files/projects/migrate_plus-8.x-5.1.zip",
"reference": "8.x-5.1",
"shasum": "1257427ab0c64459c3c1e42bb2a98d3114b77163"
},
"require": {
"drupal/core": "^8.8 || ^9",
"php": ">=7.1"
},
"require-dev": {
"drupal/migrate_example_advanced_setup": "*",
"drupal/migrate_example_setup": "*"
},
"suggest": {
"ext-soap": "*",
"sainsburys/guzzle-oauth2-plugin": "3.0 required for the OAuth2 authentication plugin"
},
"type": "drupal-module",
"extra": {
"drupal": {
"version": "8.x-5.1",
"datestamp": "1588261060",
"security-coverage": {
"status": "covered",
"message": "Covered by Drupal's security advisory policy"
}
}
},
"notification-url": "https://packages.drupal.org/8/downloads",
"license": [
"GPL-2.0-or-later"
],
"authors": [
{
"name": "Mike Ryan",
"homepage": "https://www.drupal.org/u/mikeryan",
"role": "Maintainer"
},
{
"name": "Lucas Hedding",
"homepage": "https://www.drupal.org/u/heddn",
"role": "Maintainer"
}
],
"description": "Enhancements to core migration support.",
"homepage": "https://www.drupal.org/project/migrate_plus",
"support": {
"source": "https://git.drupalcode.org/project/migrate_plus",
"issues": "https://www.drupal.org/project/issues/migrate_plus",
"slack": "#migrate"
}
},
{
"name": "drupal/migrate_tools",
"version": "5.0.0",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/migrate_tools.git",
"reference": "8.x-5.0"
},
"dist": {
"type": "zip",
"url": "https://ftp.drupal.org/files/projects/migrate_tools-8.x-5.0.zip",
"reference": "8.x-5.0",
"shasum": "b7c91aa6f7de9d6d548f65f83c8736e47e5926a1"
},
"require": {
"drupal/core": "^8.8 | ^9",
"drupal/migrate_plus": "^5",
"php": ">=7.1"
},
"require-dev": {
"drupal/migrate_plus": "^5",
"drupal/migrate_source_csv": "^3",
"drush/drush": "^10"
},
"suggest": {
"drush/drush": "^9 || ^10"
},
"type": "drupal-module",
"extra": {
"drupal": {
"version": "8.x-5.0",
"datestamp": "1588260531",
"security-coverage": {
"status": "covered",
"message": "Covered by Drupal's security advisory policy"
}
},
"drush": {
"services": {
"drush.services.yml": "^9 || ^10"
}
}
},
"notification-url": "https://packages.drupal.org/8/downloads",
"license": [
"GPL-2.0-or-later"
],
"authors": [
{
"name": "Mike Ryan",
"homepage": "https://www.drupal.org/u/mikeryan",
"role": "Maintainer"
},
{
"name": "Lucas Hedding",
"homepage": "https://www.drupal.org/u/heddn",
"role": "Maintainer"
},
{
"name": "moshe weitzman",
"homepage": "https://www.drupal.org/user/23"
}
],
"description": "Tools to assist in developing and running migrations.",
"homepage": "http://drupal.org/project/migrate_tools",
"support": {
"source": "https://git.drupalcode.org/project/migrate_tools",
"issues": "https://www.drupal.org/project/issues/migrate_tools",
"slack": "#migrate"
}
},
{
"name": "drupal/migrate_upgrade",
"version": "3.2.0",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/migrate_upgrade.git",
"reference": "8.x-3.2"
},
"dist": {
"type": "zip",
"url": "https://ftp.drupal.org/files/projects/migrate_upgrade-8.x-3.2.zip",
"reference": "8.x-3.2",
"shasum": "f7be28c9fa9e2c56db24fafaf4e9cd6815582aed"
},
"require": {
"drupal/core": "^8 || ^9",
"drupal/migrate_plus": "^4 || ^5",
"drush/drush": "^8 || ^9 || ^10",
"php": ">7.1"
},
"require-dev": {
"drupal/migrate_plus": "^5",
"drush/drush": "^10"
},
"type": "drupal-module",
"extra": {
"drupal": {
"version": "8.x-3.2",
"datestamp": "1588260035",
"security-coverage": {
"status": "covered",
"message": "Covered by Drupal's security advisory policy"
}
},
"drush": {
"services": {
"drush.services.yml": "^9 || ^10"
}
}
},
"notification-url": "https://packages.drupal.org/8/downloads",
"license": [
"GPL-2.0-or-later"
],
"authors": [
{
"name": "Mike Ryan",
"homepage": "https://www.drupal.org/u/mikeryan",
"role": "Maintainer"
},
{
"name": "Lucas Hedding",
"homepage": "https://www.drupal.org/u/heddn",
"role": "Maintainer"
},
{
"name": "ksenzee",
"homepage": "https://www.drupal.org/user/139855"
},
{
"name": "mikeryan",
"homepage": "https://www.drupal.org/user/4420"
},
{
"name": "ultimike",
"homepage": "https://www.drupal.org/user/51132"
},
{
"name": "xjm",
"homepage": "https://www.drupal.org/user/65776"
}
],
"description": "Drush support for direct upgrades from older Drupal versions.",
"homepage": "https://www.drupal.org/project/migrate_upgrade",
"support": {
"source": "https://git.drupalcode.org/project/migrate_upgrade",
"issues": "https://www.drupal.org/project/issues/migrate_upgrade",
"slack": "#migrate"
}
},
{
"name": "drupal/module_filter",
"version": "3.1.0",
@ -6437,20 +6625,6 @@
],
"description": "Symfony ClassLoader Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-15T09:38:08+00:00"
},
{
@ -6515,20 +6689,6 @@
],
"description": "Symfony Config Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-04-12T14:33:46+00:00"
},
{
@ -6601,20 +6761,6 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-27T17:07:22+00:00"
},
{
@ -6668,20 +6814,6 @@
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-16T08:31:04+00:00"
},
{
@ -6738,20 +6870,6 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-23T10:22:40+00:00"
},
{
@ -6823,20 +6941,6 @@
],
"description": "Symfony DependencyInjection Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-04-13T09:33:40+00:00"
},
{
@ -6894,20 +6998,6 @@
],
"description": "Symfony DomCrawler Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-16T08:31:04+00:00"
},
{
@ -6971,20 +7061,6 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-15T09:38:08+00:00"
},
{
@ -7035,20 +7111,6 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-04-12T16:54:01+00:00"
},
{
@ -7152,20 +7214,6 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-04-18T20:23:17+00:00"
},
{
@ -7256,20 +7304,6 @@
],
"description": "Symfony HttpKernel Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-04-28T17:41:38+00:00"
},
{
@ -7328,20 +7362,6 @@
"polyfill",
"portable"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-02-27T09:26:54+00:00"
},
{
@ -7401,20 +7421,6 @@
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-09T19:04:49+00:00"
},
{
@ -7477,20 +7483,6 @@
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-09T19:04:49+00:00"
},
{
@ -7550,20 +7542,6 @@
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-09T19:04:49+00:00"
},
{
@ -7620,20 +7598,6 @@
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-09T19:04:49+00:00"
},
{
@ -7748,20 +7712,6 @@
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-02-27T09:26:54+00:00"
},
{
@ -7814,20 +7764,6 @@
"polyfill",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-02T11:55:35+00:00"
},
{
@ -7877,20 +7813,6 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-04-12T14:33:46+00:00"
},
{
@ -8032,20 +7954,6 @@
"uri",
"url"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-04-12T09:58:27+00:00"
},
{
@ -8125,20 +8033,6 @@
],
"description": "Symfony Serializer Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-04-12T14:33:46+00:00"
},
{
@ -8209,20 +8103,6 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-04-12T16:39:58+00:00"
},
{
@ -8309,20 +8189,6 @@
],
"description": "Symfony Validator Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-04-26T08:10:12+00:00"
},
{
@ -8399,20 +8265,6 @@
"debug",
"dump"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-04-12T16:14:02+00:00"
},
{
@ -8472,20 +8324,6 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-04-24T10:16:04+00:00"
},
{
@ -8664,16 +8502,6 @@
"env",
"environment"
],
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv",
"type": "tidelift"
}
],
"time": "2020-05-02T14:08:57+00:00"
},
{
@ -9363,16 +9191,6 @@
"ssl",
"tls"
],
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2020-04-08T08:27:21+00:00"
},
{
@ -9453,16 +9271,6 @@
"dependency",
"package"
],
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2020-04-10T09:44:22+00:00"
},
{
@ -9567,12 +9375,6 @@
"Xdebug",
"performance"
],
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
}
],
"time": "2020-03-01T12:26:26+00:00"
},
{
@ -11365,16 +11167,6 @@
"parser",
"validator"
],
"funding": [
{
"url": "https://github.com/Seldaek",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/seld/jsonlint",
"type": "tidelift"
}
],
"time": "2020-04-30T19:05:18+00:00"
},
{
@ -11527,20 +11319,6 @@
],
"description": "Symfony BrowserKit Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-15T09:38:08+00:00"
},
{
@ -11603,20 +11381,6 @@
"redlock",
"semaphore"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-16T15:51:59+00:00"
},
{
@ -11682,20 +11446,6 @@
],
"description": "Symfony PHPUnit Bridge",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-04-25T12:18:34+00:00"
},
{
@ -11754,6 +11504,5 @@
"platform": {
"php": ">=7.0.8"
},
"platform-dev": [],
"plugin-api-version": "1.1.0"
"platform-dev": []
}

+ 1
- 0
config/default/default/core.extension.yml View File

@ -42,6 +42,7 @@ module:
path_alias: 0
quickedit: 0
rdf: 0
sample_migration: 0
search: 0
shortcut: 0
system: 0


+ 36
- 0
config/default/default/migrate_plus.migration.random_databases.yml View File

@ -0,0 +1,36 @@
uuid: a05842c6-cbb3-49f6-853b-f137d5f52c3d
langcode: en
status: true
dependencies:
enforced:
module:
- migrate_plus
- sample_migration
id: random_databases
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags: null
migration_group: migrate_drupal_7
label: 'Page From Random Databases'
source:
key: random
plugin: RandomDatabases
process:
type:
plugin: default_value
default_value: page
status:
plugin: default_value
default_value: 1
uid:
plugin: default_value
default_value: 1
langcode:
plugin: default_value
default_value: en
title: Title
body: Body
destination:
plugin: 'entity:node'
migration_dependencies: null

+ 82
- 0
config/default/default/migrate_plus.migration.upgrade_d7_should_have_been_page.yml View File

@ -0,0 +1,82 @@
uuid: dcff6abc-7781-4305-a144-7efad9745d7d
langcode: en
status: true
dependencies: { }
id: upgrade_d7_should_have_been_page
class: Drupal\migrate\Plugin\Migration
field_plugin_method: null
cck_plugin_method: null
migration_tags:
- 'Drupal 7'
- Content
migration_group: migrate_drupal_7
label: 'Nodes (Should Have Been page)'
source:
plugin: d7_node
node_type: should_have_been_page
process:
nid:
-
plugin: get
source: tnid
vid:
-
plugin: get
source: vid
langcode:
-
plugin: default_value
source: language
default_value: und
title:
-
plugin: get
source: title
uid:
-
plugin: get
source: node_uid
status:
-
plugin: get
source: status
created:
-
plugin: get
source: created
changed:
-
plugin: get
source: changed
promote:
-
plugin: get
source: promote
sticky:
-
plugin: get
source: sticky
revision_uid:
-
plugin: get
source: revision_uid
revision_log:
-
plugin: get
source: log
revision_timestamp:
-
plugin: get
source: timestamp
comment_node_page/0/status:
-
plugin: get
source: comment
body:
-
plugin: get
source: field_should_be_page_body
destination:
plugin: 'entity:node'
default_bundle: page
migration_dependencies: null

+ 5
- 0
docroot/modules/custom/sample_migration/sample_migration.links.menu.yml View File

@ -0,0 +1,5 @@
sample_migration.title_body_paragraph_form:
title: 'Migrate Title Body Field Collections to Paragraphs'
description: 'Get all Title Body Field collections and bring them to new site'
parent: system.admin_config_development
route_name: sample_migration.title_body_paragraph_form

+ 131
- 0
docroot/modules/custom/sample_migration/sample_migration.module View File

@ -22,3 +22,134 @@ function sample_migration_help($route_name, RouteMatchInterface $route_match) {
default:
}
}
function sample_migration_title_body_paragraphs(&$context) {
$entity_type_manager = \Drupal::service('entity_type.manager');
/* @var NodeStorage $node_storage */
$node_storage = $entity_type_manager->getStorage('node');
$media_storage = $entity_type_manager->getStorage('media');
$file_storage = $entity_type_manager->getStorage('file');
if (empty($context['sandbox'])) {
$context['sandbox'] = [];
}
if (!isset($context['sandbox']['progress'])) {
$context['sandbox']['progress'] = 0;
$context['sandbox']['current_index'] = 0;
$all_arm_pages = $node_storage->loadByProperties([
'type' => 'arm_page'
]);
$context['sandbox']['arm_content'] = array_values($all_arm_pages);
$context['sandbox']['arm_map'] = _get_arm_map();
$context['sandbox']['file_map'] = _get_file_map();
$context['sandbox']['d7_files'] = _get_d7_arm_files();
$context['sandbox']['index'] = array_values($context['sandbox']['arm_content']);
$context['sandbox']['max'] = count($context['sandbox']['arm_content']);
}
$limit = 10;
$indexes = range($context['sandbox']['current_index'], $context['sandbox']['current_index'] + $limit);
foreach ($indexes as $index) {
$node = $context['sandbox']['arm_content'][$index];
if (!is_null($node)) {
$context['results'][] = $node->title->value;
$d7nid = $context['sandbox']['arm_map'][$node->id()];
$d7file = $context['sandbox']['d7_files'][$d7nid->sourceid1];
if ($d7file) {
$d8file = $context['sandbox']['file_map'][$d7file->field_armpage_pdf_fid];
$current_file = $file_storage->load($d8file->destid1);
if ($d8file) {
$node->set('field_armpage_pdf', $current_file->id());
$node->save();
}
}
}
$context['sandbox']['progress']++;
$context['sandbox']['current_index'] = $index;
$context['message'] = t('Now processing Reviews');
}
// Update batch on our progress.
if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
$context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
}
else {
$context['sandbox']['finished'] = 1;
}
}
function sample_migration_title_body_paragraphs_finished() {
$messenger = \Drupal::messenger();
if ($success) {
$message = t('@count Reviews were added to Groups', ['@count' => count($results)]);
$messenger->addMessage($message);
}
else {
// Something went wrong
$error_operation = reset($operations);
$messenger->addMessage(
t('An error occurred while processing @operation with arguments : @args',
[
'@operation' => $error_operation[0],
'@args' => print_r($error_operation[0], TRUE)
]
)
);
}
}
function sample_migration_get_title_body_field_collections() {
Database::setActiveConnection('drupal7');
$drupal7db = Database::getConnection();
$query = $drupal7db->select('field_collection_item', 'fci')
->fields('fci', [
'item_id',
'field_name',
'revision_id'
]);
$query->innerJoin('field_data_' . $field_name, 'fd', 'fd.' . $field_name . '_value = fci.item_id');
$query->fields('fd', [
'entity_type',
'bundle',
'entity_id',
$field_name . '_revision_id'
]);
$query->condition('fci.field_name', $field_name);
$query->leftJoin('field_data_field_usingpage_block_image', 'fdfubi', 'fdfubi.entity_id = fci.item_id');
$query->fields('fdfubi', [
'entity_id',
'revision_id',
'field_usingpage_block_image_fid'
]);
$results = $query->execute()->fetchAll();
Database::setActiveConnection('default');
if (count($results)) {
$drupal8db = Database::getConnection();
$query = $drupal8db->select('migrate_map_upgrade_d7_node_using_library_page', 'mm');
$query->fields('mm', [
'sourceid1',
'destid1'
]);
$map_results = $query->execute()->fetchAllAssoc('sourceid1');
}
}
function sample_migration_get_test_paragraph_content_map() {
$drupal8db = Database::getConnection();
$query = $drupal8db->select('migrate_map_upgrade_d7_node_using_library_page', 'mm');
$query->fields('mm', [
'sourceid1',
'destid1'
]);
$map_results = $query->execute()->fetchAllAssoc('sourceid1');
}

+ 7
- 0
docroot/modules/custom/sample_migration/sample_migration.routing.yml View File

@ -0,0 +1,7 @@
sample_migration.title_body_paragraph_form:
path: '/admin/config/development/title-body-paragraph-import'
defaults:
_form: '\Drupal\sample_migration\Form\TitleBodyParagraphForm'
_title: 'TitleBodyParagraphForm'
requirements:
_access: 'TRUE'

+ 64
- 0
docroot/modules/custom/sample_migration/src/Form/TitleBodyParagraphForm.php View File

@ -0,0 +1,64 @@
<?php
namespace Drupal\sample_migration\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Class TitleBodyParagraphForm.
*/
class TitleBodyParagraphForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'title_body_paragraph_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Submit'),
];
return $form;
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
foreach ($form_state->getValues() as $key => $value) {
// @TODO: Validate fields.
}
parent::validateForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$batch = [
'title' => $this->t('Bringing over Title Body Field Collections...'),
'operations' => [
[
'sample_migration_title_body_paragraphs',
[
]
]
],
'init_message' => $this->t('Loading nodes...'),
'progress_message' => $this->t('Processed @current out of @total'),
'finished' => $this->t('sample_migration_title_body_paragraphs_finished')
];
batch_set($batch);
}
}

+ 54
- 0
docroot/modules/custom/sample_migration/src/Plugin/migrate/source/RandomDatabases.php View File

@ -0,0 +1,54 @@
<?php
namespace Drupal\sample_migration\Plugin\migrate\source;
use Drupal\migrate\Plugin\migrate\source\SqlBase;
use Drupal\migrate\Row;
/**
* Provides a 'Random Database' migrate source.
*
* @MigrateSource(
* id = "RandomDatabases"
* )
*/
class RandomDatabases extends SqlBase {
/**
* {@inheritdoc}
*/
public function query() {
$query = $this->select('Content', 'c');
$query->fields('c', [
'ID',
'Title',
'Body',
]);
return $query;
}
/**
* {@inheritdoc}
*/
public function fields() {
$fields = [
'ID' => $this->t('Source ID'),
'Title' => $this->t('Title'),
'Body' => $this->t('Body'),
];
return $fields;
}
/**
* {@inheritdoc}
*/
public function getIds() {
return [
'ID' => [
'type' => 'integer',
'alias'=> 'ID'
]
];
}
}

+ 0
- 0
docroot/sites/default/.gitignore View File


+ 2584
- 0
drupal7.sql
File diff suppressed because it is too large
View File


+ 52
- 0
randomdb.sql View File

@ -0,0 +1,52 @@
-- MySQL dump 10.13 Distrib 5.6.37, for Linux (x86_64)
--
-- Host: localhost Database: randomdb
-- ------------------------------------------------------
-- Server version 5.6.37
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `Content`
--
DROP TABLE IF EXISTS `Content`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Content` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Title` varchar(50) DEFAULT NULL,
`Body` varchar(255) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Content`
--
LOCK TABLES `Content` WRITE;
/*!40000 ALTER TABLE `Content` DISABLE KEYS */;
INSERT INTO `Content` VALUES (1,'Tempore rerum ut voluptatem','Hic aut aspernatur eum sint. Voluptatem dignissimos repudiandae veritatis. Veniam eveniet odit similique praesentium. Eveniet unde eaque aliquid. Quos iste perspiciatis non optio. Et ipsam debitis voluptatem praesentium est perspiciatis.'),(2,'Incidunt nam ut maxime','Non eveniet asperiores qui dolore dolorem architecto eligendi aut. Dolor consectetur enim autem nulla molestiae quam id ipsam. Voluptate et consectetur dolores rerum omnis quo voluptas. Dolore libero aperiam modi itaque. Qui quia aliquid deserunt tempore ');
/*!40000 ALTER TABLE `Content` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2020-05-06 4:22:53

Loading…
Cancel
Save