migrate-from-d7.sh 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #! /bin/bash
  2. export PATH=$Path:/bin:/usr/bin:/usr/local/bin
  3. DATE=`date +%d-%m-%y/%H:%M:%S`
  4. # https://www.mediacurrent.com/blog/memory-management-migrations-drupal-8/
  5. # migration_loop(){
  6. # # Better readability with separation.
  7. # echo "========================";
  8. # # Get the output of the drush status.
  9. # drush_output=$(drush ms | grep $1);
  10. #
  11. # # Split output string into an array.
  12. # output=( $drush_output );
  13. #
  14. # # Output the status items.
  15. # for index in "${!output[@]}"
  16. # do
  17. # if [ $index == "0" ]
  18. # then
  19. # echo "Migration: ${output[index]}";
  20. # fi
  21. # if [ $index == "1" ]
  22. # then
  23. # echo "Status: ${output[index]}";
  24. # fi
  25. # if [ $index == "2" ]
  26. # then
  27. # echo "Total: ${output[index]}";
  28. # fi
  29. # if [ $index == "3" ]
  30. # then
  31. # echo "Imported: ${output[index]}";
  32. # fi
  33. # if [ $index == "4" ]
  34. # then
  35. # echo "Remaining: ${output[index]}";
  36. # fi
  37. # done
  38. #
  39. # # Check if all items were imported.
  40. #
  41. # if [ "${output[4]}" == "0" ]
  42. # then
  43. # echo "No items left to import.";
  44. # else
  45. # echo "There are ${output[4]} remaining ${output[0]} items to be imported.";
  46. # echo "Running command: drush mim $1";
  47. # echo "...";
  48. # # Run the migration until it stops.
  49. # drush mim $1;
  50. # # Run the check on this migration again.
  51. # migration_loop $1;
  52. # fi
  53. # }
  54. echo -e "* * * * * * * * * * * * * * * *"
  55. echo -e "* *"
  56. echo -e "* Migration *"
  57. echo -e "* *"
  58. echo -e "* $DATE *"
  59. echo -e "* *"
  60. echo -e "* * * * * * * * * * * * * * * *"
  61. echo " "
  62. echo "Migrating Files"
  63. drush mim d7_allpublicfiles --feedback="1000"
  64. # migration_loop d7_allpublicfiles;
  65. sleep 5
  66. echo " "
  67. echo "Migrating Taxonomy"
  68. echo "Migrating thesaurus"
  69. drush mim d7_taxonomy_term_thesaurus --update --feedback="100"
  70. # migration_loop d7_taxonomy_term_thesaurus;
  71. echo " "
  72. drush mim d7_taxonomy_term_thesaurus_i18n --update --feedback="100"
  73. # migration_loop d7_taxonomy_term_thesaurus_i18n;
  74. sleep 5
  75. echo " "
  76. echo "Migrating tags"
  77. drush mim d7_taxonomy_term_tags --update --feedback="100"
  78. # migration_loop d7_taxonomy_term_tags;
  79. echo " "
  80. drush mim d7_taxonomy_term_tags_i18n --update --feedback="100"
  81. # migration_loop d7_taxonomy_term_tags_i18n;
  82. sleep 5
  83. echo " "
  84. echo "Migrating companies"
  85. drush mim d7_taxonomy_term_company --update --feedback="100"
  86. # migration_loop d7_taxonomy_term_company;
  87. sleep 5
  88. echo " "
  89. echo "Migrating showroom"
  90. drush mim d7_taxonomy_term_showroom --update --feedback="100"
  91. # migration_loop d7_taxonomy_term_showroom;
  92. sleep 5
  93. echo " "
  94. echo "Migrating Users"
  95. drush mim d7_users --update --feedback="1000"
  96. # migration_loop d7_users;
  97. echo " "
  98. drush mim d7_user_profile --feedback="1000"
  99. # migration_loop d7_user_profile;
  100. echo " "
  101. drush mim d7_uc_roles_license --update --feedback="200"
  102. # migration_loop d7_uc_roles_license;
  103. sleep 5
  104. echo " "
  105. echo "Migrating Nodes"
  106. echo "Migrating Materials"
  107. drush mim d7_node_materiau --feedback="1000"
  108. # migration_loop d7_node_materiau;
  109. echo " "
  110. drush mim d7_node_materiau_i18n --feedback="1000"
  111. # migration_loop d7_node_materiau_i18n;
  112. sleep 5
  113. echo " "
  114. echo "Migrating breves"
  115. drush mim d7_node_article --feedback="100"
  116. # migration_loop d7_node_article;
  117. echo " "
  118. drush mim d7_node_article_i18n --feedback="100"
  119. # migration_loop d7_node_article_i18n;
  120. sleep 5
  121. echo " "
  122. echo "Migrating simplenews"
  123. drush mim d7_simplenews_nodes --feedback="200"
  124. # migration_loop d7_simplenews_nodes;
  125. drush mim d7_simplenews_subscribers --update --feedback="1000"
  126. # migration_loop d7_simplenews_subscribers;
  127. sleep 5
  128. echo " "
  129. echo "Regenerating url aliases for nodes and terms"
  130. drush pag all canonical_entities:taxonomy_term
  131. drush pag all canonical_entities:node
  132. sleep 5