Browse Source

migrate all files; node materiau field_materiau_images; view files

Bachir Soussi Chiadmi 5 years ago
parent
commit
b2dbacb786
18 changed files with 314 additions and 44 deletions
  1. 48 0
      modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_allpublicfiles.yml
  2. 8 7
      modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_node_breve.yml
  3. 36 8
      modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_node_materiau.yml
  4. 5 1
      modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_company.yml
  5. 0 3
      sites/default/config/sync/language/fr/views.view.files.yml
  6. 45 0
      sites/default/config/sync/migrate_plus.migration.d7_allpublicfiles.yml
  7. 4 2
      sites/default/config/sync/migrate_plus.migration.d7_node_breve.yml
  8. 20 2
      sites/default/config/sync/migrate_plus.migration.d7_node_materiau.yml
  9. 5 3
      sites/default/config/sync/migrate_plus.migration.d7_taxonomy_term_company.yml
  10. 1 1
      sites/default/config/sync/migrate_plus.migration.d7_taxonomy_term_showroom.yml
  11. 1 1
      sites/default/config/sync/migrate_plus.migration.d7_taxonomy_term_tags.yml
  12. 1 1
      sites/default/config/sync/migrate_plus.migration.d7_taxonomy_term_tags_i18n.yml
  13. 1 1
      sites/default/config/sync/migrate_plus.migration.d7_taxonomy_term_thesaurus.yml
  14. 1 1
      sites/default/config/sync/migrate_plus.migration.d7_taxonomy_term_thesaurus_i18n.yml
  15. 1 1
      sites/default/config/sync/migrate_plus.migration_group.d7_materio.yml
  16. 69 0
      sites/default/config/sync/views.view.admin_nodes.yml
  17. 1 1
      sites/default/config/sync/views.view.admin_taxo.yml
  18. 67 11
      sites/default/config/sync/views.view.files.yml

+ 48 - 0
modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_allpublicfiles.yml

@@ -0,0 +1,48 @@
+# Every migration that references a file by Drupal 7 fid should specify this
+# migration as an optional dependency.
+id: d7_allpublicfiles
+label: Public files
+migration_group: d7_materio
+audit: true
+migration_tags:
+  - Drupal 7
+  - Content
+source:
+  plugin: d7_file
+  scheme: public
+  constants:
+    # The tool configuring this migration must set source_base_path. It
+    # represents the fully qualified path relative to which URIs in the files
+    # table are specified, and must end with a /. See source_full_path
+    # configuration in this migration's process pipeline as an example.
+    source_base_path: '../../d7.materio.com/public_html'
+process:
+  # If you are using this file to build a custom migration consider removing
+  # the fid field to allow incremental migrations.
+  fid: fid
+  filename: filename
+  source_full_path:
+    -
+      plugin: concat
+      delimiter: /
+      source:
+        - constants/source_base_path
+        - filepath
+    -
+      plugin: urlencode
+  uri:
+    plugin: file_copy
+    source:
+      - '@source_full_path'
+      - uri
+  filemime: filemime
+  # No need to migrate filesize, it is computed when file entities are saved.
+  # filesize: filesize
+  status: status
+  # Drupal 7 didn't keep track of the file's creation or update time -- all it
+  # had was the vague "timestamp" column. So we'll use it for both.
+  created: timestamp
+  changed: timestamp
+  uid: uid
+destination:
+  plugin: entity:file

+ 8 - 7
modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_node_breve.yml

@@ -76,10 +76,11 @@ process:
 
 
 migration_dependencies:
-    required:
-      - d7_taxonomy_term_thesaurus
-      - d7_taxonomy_term_tags
-      - d7_taxonomy_term_company
-      - d7_taxonomy_term_showroom
-    optional:
-      - d7_node_materiau
+  required:
+    - d7_allpublicfiles
+    - d7_taxonomy_term_thesaurus
+    - d7_taxonomy_term_tags
+    - d7_taxonomy_term_company
+    - d7_taxonomy_term_showroom
+  optional:
+    - d7_node_materiau

+ 36 - 8
modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_node_materiau.yml

@@ -55,18 +55,22 @@ process:
     plugin: migration_lookup
     migration: d7_taxonomy_term_thesaurus
     source: field_onthologie
+    no_stub: true
   field_tags:
     plugin: migration_lookup
     migration: d7_taxonomy_term_tags
     source: field_tags_libres
+    no_stub: true
   field_manufacturer:
     plugin: migration_lookup
     migration: d7_taxonomy_term_company
     source: field_company_fab
+    no_stub: true
   field_distributor:
     plugin: migration_lookup
     migration: d7_taxonomy_term_company
     source: field_company_distrib
+    no_stub: true
   field_video:
     plugin: iterator
     source: field_video_filter
@@ -91,7 +95,30 @@ process:
       migration: d7_node_breve
       no_stub: true
 
-  # field_materiau_images: field_materiau_image
+  # field_materiau_images:
+  #   -
+  #     plugin: skip_on_empty
+  #     method: process
+  #     source: field_materiau_image
+  #   -
+  #     plugin: migration_lookup
+  #     migration: d7_allpublicfiles
+  #     no_stub: true
+
+  field_materiau_images:
+      plugin: iterator
+      source: field_materiau_image
+      process:
+        target_id:
+          plugin: migration_lookup
+          migration: d7_allpublicfiles
+          source: fid
+          no_stub: true
+        alt: alt
+        title: title
+        height: height
+        width: width
+
   # field_attachments: field_attachments
 
   # field_famille: field_famille
@@ -104,10 +131,11 @@ process:
   # : field_location
 
 migration_dependencies:
-    required:
-      - d7_taxonomy_term_thesaurus
-      - d7_taxonomy_term_tags
-      - d7_taxonomy_term_company
-      - d7_taxonomy_term_showroom
-    optional:
-      - d7_node_breve
+  required:
+    - d7_allpublicfiles
+    - d7_taxonomy_term_thesaurus
+    - d7_taxonomy_term_tags
+    - d7_taxonomy_term_company
+    - d7_taxonomy_term_showroom
+  optional:
+    - d7_node_breve

+ 5 - 1
modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_company.yml

@@ -44,7 +44,7 @@ process:
   field_migration:
     plugin: default_value
     default_value: 'migration_imported'
-    
+
   # FROM TODE (linked tode node)
   field_website:
     plugin: iterator
@@ -118,3 +118,7 @@ process:
 
   # not ready
   # field_attachments: field_attachments
+
+migration_dependencies:
+  required:
+    - d7_allpublicfiles

+ 0 - 3
sites/default/config/sync/language/fr/views.view.files.yml

@@ -11,9 +11,6 @@ display:
           sort_desc_label: Desc
       pager:
         options:
-          tags:
-            previous: '‹ Précédent'
-            next: 'Suivant ›'
           expose:
             items_per_page_label: 'Éléments par page'
             items_per_page_options_all_label: '- Tout -'

+ 45 - 0
sites/default/config/sync/migrate_plus.migration.d7_allpublicfiles.yml

@@ -0,0 +1,45 @@
+uuid: e9e634ba-e831-4c89-8b64-5997702fbff5
+langcode: en
+status: true
+dependencies: {  }
+_core:
+  default_config_hash: IYawoGUko6BsA-SMRxVgInlCEULcmcNYwJB6p0MECRs
+id: d7_allpublicfiles
+class: null
+field_plugin_method: null
+cck_plugin_method: null
+migration_tags:
+  - 'Drupal 7'
+  - Content
+migration_group: d7_materio
+label: 'Public files'
+source:
+  plugin: d7_file
+  scheme: public
+  constants:
+    source_base_path: ../../d7.materio.com/public_html
+process:
+  fid: fid
+  filename: filename
+  source_full_path:
+    -
+      plugin: concat
+      delimiter: /
+      source:
+        - constants/source_base_path
+        - filepath
+    -
+      plugin: urlencode
+  uri:
+    plugin: file_copy
+    source:
+      - '@source_full_path'
+      - uri
+  filemime: filemime
+  status: status
+  created: timestamp
+  changed: timestamp
+  uid: uid
+destination:
+  plugin: 'entity:file'
+migration_dependencies: null

+ 4 - 2
sites/default/config/sync/migrate_plus.migration.d7_node_breve.yml

@@ -1,9 +1,9 @@
-uuid: 7e452f78-a8e4-4c12-ad45-a07390ba1d6b
+uuid: c777e844-a495-40da-8402-036f21e452e7
 langcode: en
 status: true
 dependencies: {  }
 _core:
-  default_config_hash: mNckIt8NkX9wGgZbHCl1Rc7bMRxFBND-3C2uWaTYbLM
+  default_config_hash: gPxxnSd49zf1QfNvGH3ViddhP7nm_RL6VAjAbHTcPs8
 id: d7_node_breve
 class: null
 field_plugin_method: null
@@ -42,6 +42,7 @@ process:
       default_value: 2
     -
       plugin: static_map
+      default_value: 2
       map:
         1: workflow_creation
         2: workflow_hidden
@@ -74,6 +75,7 @@ destination:
   plugin: 'entity:node'
 migration_dependencies:
   required:
+    - d7_allpublicfiles
     - d7_taxonomy_term_thesaurus
     - d7_taxonomy_term_tags
     - d7_taxonomy_term_company

+ 20 - 2
sites/default/config/sync/migrate_plus.migration.d7_node_materiau.yml

@@ -1,9 +1,9 @@
-uuid: 9df6ad17-bffc-42bc-988f-78f464b529d4
+uuid: 26142c74-11b6-46a0-b5c3-1b9a336fdddc
 langcode: en
 status: true
 dependencies: {  }
 _core:
-  default_config_hash: t6tESeD5gSyUOUHmIcKqhmhWjysEil-5oeNeK1cFuSU
+  default_config_hash: Qh2aI8a_A0jio8zsJ4X_BCwZaEXx_yUBr79LFBIyfBM
 id: d7_node_materiau
 class: null
 field_plugin_method: null
@@ -54,18 +54,22 @@ process:
     plugin: migration_lookup
     migration: d7_taxonomy_term_thesaurus
     source: field_onthologie
+    no_stub: true
   field_tags:
     plugin: migration_lookup
     migration: d7_taxonomy_term_tags
     source: field_tags_libres
+    no_stub: true
   field_manufacturer:
     plugin: migration_lookup
     migration: d7_taxonomy_term_company
     source: field_company_fab
+    no_stub: true
   field_distributor:
     plugin: migration_lookup
     migration: d7_taxonomy_term_company
     source: field_company_distrib
+    no_stub: true
   field_video:
     plugin: iterator
     source: field_video_filter
@@ -89,10 +93,24 @@ process:
       plugin: migration_lookup
       migration: d7_node_breve
       no_stub: true
+  field_materiau_images:
+    plugin: iterator
+    source: field_materiau_image
+    process:
+      target_id:
+        plugin: migration_lookup
+        migration: d7_allpublicfiles
+        source: fid
+        no_stub: true
+      alt: alt
+      title: title
+      height: height
+      width: width
 destination:
   plugin: 'entity:node'
 migration_dependencies:
   required:
+    - d7_allpublicfiles
     - d7_taxonomy_term_thesaurus
     - d7_taxonomy_term_tags
     - d7_taxonomy_term_company

+ 5 - 3
sites/default/config/sync/migrate_plus.migration.d7_taxonomy_term_company.yml

@@ -1,9 +1,9 @@
-uuid: 269d655a-5cf6-4e99-9e81-38dd5451a0fb
+uuid: caa7cb3d-f928-4fa2-880e-afd5d2b0ac22
 langcode: en
 status: true
 dependencies: {  }
 _core:
-  default_config_hash: Hnyr1-4SVfUg4peHnLmgVj6KC79ZcsyZxScUaKdABp4
+  default_config_hash: Oqay_eEJOv9kUDIZVDJCvbpeQnyz_Y0HX_RSjI_T-Qw
 id: d7_taxonomy_term_company
 class: null
 field_plugin_method: null
@@ -98,4 +98,6 @@ process:
       5: workflow_edited
 destination:
   plugin: 'entity:taxonomy_term'
-migration_dependencies: null
+migration_dependencies:
+  required:
+    - d7_allpublicfiles

+ 1 - 1
sites/default/config/sync/migrate_plus.migration.d7_taxonomy_term_showroom.yml

@@ -1,4 +1,4 @@
-uuid: f27298b9-abee-4f9b-97bc-0db2f1271739
+uuid: a81f9dd6-176e-4347-a077-1f782690216f
 langcode: en
 status: true
 dependencies: {  }

+ 1 - 1
sites/default/config/sync/migrate_plus.migration.d7_taxonomy_term_tags.yml

@@ -1,4 +1,4 @@
-uuid: 74e19686-8107-40e5-9bfb-3e1d203bc61f
+uuid: f420ec37-3b07-40b3-a4f8-f65c852191e6
 langcode: en
 status: true
 dependencies: {  }

+ 1 - 1
sites/default/config/sync/migrate_plus.migration.d7_taxonomy_term_tags_i18n.yml

@@ -1,4 +1,4 @@
-uuid: ae4c8a4c-c907-474b-860c-dc7db05c8676
+uuid: c0989c5b-2600-40d8-83cd-93816d581dc9
 langcode: en
 status: true
 dependencies: {  }

+ 1 - 1
sites/default/config/sync/migrate_plus.migration.d7_taxonomy_term_thesaurus.yml

@@ -1,4 +1,4 @@
-uuid: 54c975f0-e057-4ec3-8f82-78f5760eac5b
+uuid: 244db603-ebbf-43c1-ade5-a4ef0bd99d3f
 langcode: en
 status: true
 dependencies: {  }

+ 1 - 1
sites/default/config/sync/migrate_plus.migration.d7_taxonomy_term_thesaurus_i18n.yml

@@ -1,4 +1,4 @@
-uuid: 03b814c1-99b9-4a0d-bccf-586a3f185bdf
+uuid: 05dcb560-2034-4245-bc17-790e74761dc5
 langcode: en
 status: true
 dependencies: {  }

+ 1 - 1
sites/default/config/sync/migrate_plus.migration_group.d7_materio.yml

@@ -1,4 +1,4 @@
-uuid: 7e44f672-e02e-42c9-bd0b-12056a0325d5
+uuid: d4bdbea8-1cd9-4eef-84b7-943522da4ff9
 langcode: en
 status: true
 dependencies:

+ 69 - 0
sites/default/config/sync/views.view.admin_nodes.yml

@@ -7,17 +7,20 @@ dependencies:
     - field.storage.node.field_linked_breves
     - field.storage.node.field_linked_materials
     - field.storage.node.field_manufacturer
+    - field.storage.node.field_materiau_images
     - field.storage.node.field_memo
     - field.storage.node.field_migration
     - field.storage.node.field_tags
     - field.storage.node.field_thesaurus
     - field.storage.node.field_workflow
+    - image.style.medium
     - taxonomy.vocabulary.company
     - user.role.admin
     - user.role.root
   module:
     - content_lock
     - content_translation
+    - image
     - node
     - options
     - pagerer
@@ -295,6 +298,70 @@ display:
             pathauto_update_alias:
               label_override: ''
           plugin_id: views_bulk_operations_bulk_form
+        field_materiau_images:
+          id: field_materiau_images
+          table: node__field_materiau_images
+          field: field_materiau_images
+          relationship: none
+          group_type: group
+          admin_label: ''
+          label: Images
+          exclude: false
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: true
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: title
+          type: image
+          settings:
+            image_style: medium
+            image_link: ''
+          group_column: ''
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 1
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          plugin_id: field
         nid:
           id: nid
           table: node_field_data
@@ -1601,6 +1668,7 @@ display:
         - 'config:field.storage.node.field_linked_breves'
         - 'config:field.storage.node.field_linked_materials'
         - 'config:field.storage.node.field_manufacturer'
+        - 'config:field.storage.node.field_materiau_images'
         - 'config:field.storage.node.field_memo'
         - 'config:field.storage.node.field_migration'
         - 'config:field.storage.node.field_tags'
@@ -1804,6 +1872,7 @@ display:
         - 'config:field.storage.node.field_linked_breves'
         - 'config:field.storage.node.field_linked_materials'
         - 'config:field.storage.node.field_manufacturer'
+        - 'config:field.storage.node.field_materiau_images'
         - 'config:field.storage.node.field_memo'
         - 'config:field.storage.node.field_migration'
         - 'config:field.storage.node.field_tags'

+ 1 - 1
sites/default/config/sync/views.view.admin_taxo.yml

@@ -16,7 +16,7 @@ dependencies:
     - views_bulk_operations
     - workflow
 id: admin_taxo
-label: 'admin taxo'
+label: 'Admin Taxo'
 module: views
 description: ''
 tag: ''

+ 67 - 11
sites/default/config/sync/views.view.files.yml

@@ -4,6 +4,7 @@ status: true
 dependencies:
   module:
     - file
+    - pagerer
     - user
 _core:
   default_config_hash: rRWxAX-IQkJ5viACQRovRkC784EyCl9493GU_G23n2Q
@@ -48,22 +49,20 @@ display:
           sort_asc_label: Asc
           sort_desc_label: Desc
       pager:
-        type: mini
+        type: pagerer
         options:
+          preset: default
           items_per_page: 50
           offset: 0
-          id: 0
-          total_pages: 0
-          tags:
-            previous: '‹ Previous'
-            next: 'Next ›'
+          id: '0'
+          total_pages: '0'
           expose:
-            items_per_page: false
+            items_per_page: 0
             items_per_page_label: 'Items per page'
             items_per_page_options: '5, 10, 25, 50'
-            items_per_page_options_all: false
+            items_per_page_options_all: 0
             items_per_page_options_all_label: '- All -'
-            offset: false
+            offset: 0
             offset_label: Offset
       style:
         type: table
@@ -694,9 +693,65 @@ display:
           plugin_id: file_status
           entity_type: file
           entity_field: status
+        count:
+          id: count
+          table: file_usage
+          field: count
+          relationship: fid
+          group_type: count
+          admin_label: ''
+          operator: '='
+          value:
+            min: ''
+            max: ''
+            value: ''
+          group: 1
+          exposed: true
+          expose:
+            operator_id: count_op
+            label: 'Use count'
+            description: ''
+            use_operator: false
+            operator: count_op
+            identifier: count
+            required: false
+            remember: false
+            multiple: false
+            remember_roles:
+              authenticated: authenticated
+              anonymous: '0'
+              admin: '0'
+              root: '0'
+              user: '0'
+            placeholder: ''
+            min_placeholder: ''
+            max_placeholder: ''
+          is_grouped: false
+          group_info:
+            label: ''
+            description: ''
+            identifier: ''
+            optional: true
+            widget: select
+            multiple: false
+            remember: false
+            default_group: All
+            default_group_multiple: {  }
+            group_items: {  }
+          plugin_id: numeric
       sorts: {  }
       title: Files
-      header: {  }
+      header:
+        result:
+          id: result
+          table: views
+          field: result
+          relationship: none
+          group_type: group
+          admin_label: ''
+          empty: false
+          content: 'Displaying @start - @end of @total'
+          plugin_id: result
       footer: {  }
       empty:
         area_text_custom:
@@ -755,7 +810,8 @@ display:
           group_type: group
           admin_label: 'File usage'
           required: false
-      display_extenders: {  }
+      display_extenders:
+        views_ef_fieldset: {  }
     cache_metadata:
       contexts:
         - 'languages:language_content'