checked files and taxo migration, added migrate shell script, started managing admin UI

This commit is contained in:
Bachir Soussi Chiadmi 2019-02-04 11:24:31 +01:00
parent f45a235fa6
commit 2ed361dd35
25 changed files with 238 additions and 40 deletions

View File

@ -1,9 +1,9 @@
uuid: ac0c0ef4-7fdf-4962-a9eb-498b975c939b
uuid: 6d3381ad-523b-4124-8429-532c91814471
langcode: en
status: true
dependencies: { }
_core:
default_config_hash: DXcmWNRxncWda1nce07h8YOm09s5sqq-Yd_mBSsr5aM
default_config_hash: eW9e-k2ZTYkBblJsG588q7T53MDzhLj-IGx0udg6qto
id: d7_allpublicfiles
class: null
field_plugin_method: null
@ -14,7 +14,7 @@ migration_tags:
migration_group: d7_materio
label: 'Public files'
source:
plugin: d7_file
plugin: d7_pubic_file
scheme: public
constants:
source_base_path: ../../../d7.materio.com/public_html

View File

@ -1,4 +1,4 @@
uuid: 79b6827e-1f81-4b76-9b7b-177a97e85f5a
uuid: c252747d-7f6d-476f-bcea-6599ce9347a9
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: 1632a0c5-1b3a-4272-a79b-b1d5df2b370d
uuid: 2ea310ab-d6d5-4ec1-982b-c6c66068c395
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: 9e68fe3d-4e3a-46ff-9ebf-e62c8a626d4f
uuid: e48d0c98-06d6-447c-94dc-9d5e2585fa34
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: 414393df-1694-4763-b5cb-4aa31074de32
uuid: 1fddb711-93f5-4215-8ae4-4be3f50dae9c
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: 123f32ef-68f9-4bbf-af54-4e15abd1cfbc
uuid: 9ca88832-0068-4361-b607-b4a39385af4a
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: 30fb1d6b-f35b-4d3e-a24d-0fbcbe30a624
uuid: 07f355e3-fa3d-40a3-959d-b7551af3c905
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: 5b1f7782-80f6-41a8-b79b-2ff9ad66a404
uuid: e6923479-d7fd-439a-9c1f-45d511a20c1a
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: fee04128-3766-496b-9911-dd5e68560573
uuid: 8a3ae460-11b6-4f9d-a1b1-32c86fa500ac
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: 331159f8-ab23-49e3-8998-25153b368126
uuid: abd3a273-3660-4db4-b7ac-f5562af67097
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: 8d0658e4-f12f-46a9-b7fe-bb96aae3d201
uuid: 87ae71f8-6a8e-4156-9376-3b157997a20c
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: fc175787-edf4-4d75-89d1-5fa23a21eb48
uuid: 6bc216c5-d7bb-4437-8379-698a2dee3586
langcode: en
status: true
dependencies:

View File

@ -12,12 +12,17 @@ permissions:
- 'access administration pages'
- 'access any corpus_documents workflow_transion overview'
- 'access any generique workflow_transion overview'
- 'access content overview'
- 'access files overview'
- 'access kint'
- 'access site in maintenance mode'
- 'access synonyms entity autocomplete'
- 'access toolbar'
- 'administer productions menu items'
- 'administer synonyms'
- 'administer users'
- 'break content lock'
- 'change own username'
- 'create breve content'
- 'create content translations'
- 'create corpus_documents workflow_transition'
- 'create defalut workflow_transition'
@ -25,13 +30,18 @@ permissions:
- 'create enregistrement content'
- 'create evenement content'
- 'create generique workflow_transition'
- 'create materiau content'
- 'create migration workflow_transition'
- 'create page content'
- 'create terms in collectionneurs'
- 'create terms in company'
- 'create terms in entrees'
- 'create terms in genres'
- 'create terms in langues'
- 'create terms in locuteurs'
- 'create terms in showroom'
- 'create terms in tags'
- 'create terms in thesaurus'
- 'create workflow workflow_transition'
- 'delete any autre_son content'
- 'delete any enregistrement content'
@ -44,16 +54,22 @@ permissions:
- 'delete terms in langues'
- 'delete terms in locuteurs'
- 'edit any autre_son content'
- 'edit any breve content'
- 'edit any enregistrement content'
- 'edit any evenement content'
- 'edit any materiau content'
- 'edit any page content'
- 'edit any static content'
- 'edit own enregistrement content'
- 'edit terms in collectionneurs'
- 'edit terms in company'
- 'edit terms in entrees'
- 'edit terms in genres'
- 'edit terms in langues'
- 'edit terms in locuteurs'
- 'edit terms in showroom'
- 'edit terms in tags'
- 'edit terms in thesaurus'
- 'execute entity:save_action menu_link_content'
- 'execute entity:save_action node'
- 'execute entity:save_action taxonomy_term'
@ -73,25 +89,36 @@ permissions:
- 'revert any corpus_documents workflow_transition'
- 'revert any generique workflow_transition'
- 'revert autre_son revisions'
- 'revert breve revisions'
- 'revert enregistrement revisions'
- 'revert evenement revisions'
- 'revert materiau revisions'
- 'revert page revisions'
- 'revert static revisions'
- 'schedule corpus_documents workflow_transition'
- 'schedule generique workflow_transition'
- 'translate breve node'
- 'translate company taxonomy_term'
- 'translate enregistrement node'
- 'translate entrees taxonomy_term'
- 'translate evenement node'
- 'translate genres taxonomy_term'
- 'translate interface'
- 'translate langues taxonomy_term'
- 'translate materiau node'
- 'translate menu_link_content'
- 'translate page node'
- 'translate showroom taxonomy_term'
- 'translate static node'
- 'translate tags taxonomy_term'
- 'translate thesaurus taxonomy_term'
- 'update content translations'
- 'use text format wysiwyg'
- 'view autre_son revisions'
- 'view breve revisions'
- 'view enregistrement revisions'
- 'view evenement revisions'
- 'view materiau revisions'
- 'view page revisions'
- 'view static revisions'
- 'view the administration theme'

View File

@ -2016,6 +2016,15 @@ display:
depth: '1'
type: container
path: admin/content/nodes
menu:
type: tab
title: Contents
description: ''
expanded: false
parent: ''
weight: 0
context: '0'
menu_name: main
cache_metadata:
max-age: 0
contexts:

View File

@ -6,10 +6,13 @@ dependencies:
- field.storage.taxonomy_term.field_memo
- field.storage.taxonomy_term.field_migration
- field.storage.taxonomy_term.field_workflow
- user.role.admin
- user.role.root
module:
- content_lock
- content_translation
- options
- pagerer
- taxonomy
- translation_views
- user
@ -31,9 +34,11 @@ display:
position: 0
display_options:
access:
type: perm
type: role
options:
perm: 'access content'
role:
admin: admin
root: root
cache:
type: tag
options: { }
@ -56,23 +61,21 @@ 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: null
id: '0'
total_pages: ''
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
tags:
previous:
next:
style:
type: table
options:
@ -1281,7 +1284,8 @@ display:
empty: { }
relationships: { }
arguments: { }
display_extenders: { }
display_extenders:
views_ef_fieldset: { }
filter_groups:
operator: AND
groups:
@ -1293,7 +1297,7 @@ display:
- 'languages:language_interface'
- url
- url.query_args
- user.permissions
- user.roles
tags:
- 'config:field.storage.taxonomy_term.field_memo'
- 'config:field.storage.taxonomy_term.field_migration'
@ -1304,8 +1308,18 @@ display:
display_title: Page
position: 1
display_options:
display_extenders: { }
path: admin/content/taxonomy/terms
display_extenders:
views_ef_fieldset: { }
path: admin/content/taxonomy_terms
menu:
type: tab
title: Taxonomy
description: ''
expanded: false
parent: ''
weight: 0
context: '0'
menu_name: main
cache_metadata:
max-age: 0
contexts:
@ -1313,7 +1327,7 @@ display:
- 'languages:language_interface'
- url
- url.query_args
- user.permissions
- user.roles
tags:
- 'config:field.storage.taxonomy_term.field_memo'
- 'config:field.storage.taxonomy_term.field_migration'

15
migrate-from-d7.sh Normal file
View File

@ -0,0 +1,15 @@
#! /bin/bash
drush ms --group=d7_materio
drush mim d7_allpublicfiles --feedback=1000
drush mim d7_taxonomy_term_thesaurus --update --feedback=100
drush mim d7_taxonomy_term_thesaurus_i18n --update --feedback=100
drush mim d7_taxonomy_term_tags --update --feedback=100
drush mim d7_taxonomy_term_tags_i18n --update --feedback=100
drush mim d7_taxonomy_term_company --update --feedback=100
drush mim d7_taxonomy_term_showroom --update --feedback=100

View File

@ -8,7 +8,7 @@ migration_tags:
- Drupal 7
- Content
source:
plugin: d7_file
plugin: d7_pubic_file
scheme: public
constants:
# The tool configuring this migration must set source_base_path. It
@ -19,7 +19,7 @@ source:
process:
# If you are using this file to build a custom migration consider removing
# the fid field to allow incremental migrations.
fid: fid
# fid: fid
filename: filename
source_full_path:
-

View File

@ -81,7 +81,7 @@ class D7NodeBreve extends FieldableEntity {
'log',
'timestamp',
])
->orderBy('nid');
->orderBy('changed');
$query->addField('n', 'uid', 'node_uid');
$query->addField('nr', 'uid', 'revision_uid');
@ -99,6 +99,12 @@ class D7NodeBreve extends FieldableEntity {
$query->condition('n.type', $this->configuration['node_type']);
}
$this->highwaterField = array(
'name' => 'changed',
'alias' => 'n',
'type' => 'int',
);
return $query;
}

View File

@ -36,13 +36,15 @@ class D7NodeBreveI18n extends FieldableEntity {
'type',
'promote',
'sticky',
'changed',
])
->fields('nr', [
'log',
'timestamp',
])
->condition('et.entity_type', 'node')
->condition('et.source', '', '<>');
->condition('et.source', '', '<>')
->orderBy('changed');
$query->addField('nr', 'uid', 'revision_uid');
@ -53,6 +55,12 @@ class D7NodeBreveI18n extends FieldableEntity {
$query->condition('n.type', $this->configuration['node_type']);
}
$this->highwaterField = array(
'name' => 'changed',
'alias' => 'n',
'type' => 'int',
);
return $query;
}

View File

@ -0,0 +1,119 @@
<?php
namespace Drupal\materio_migrate\Plugin\migrate\source;
use Drupal\Core\Database\Query\Condition;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
/**
* Drupal 7 file source from database.
*
* @MigrateSource(
* id = "d7_pubic_file",
* source_module = "file"
* )
*/
class D7PublicFile extends DrupalSqlBase {
/**
* The public file directory path.
*
* @var string
*/
protected $publicPath;
/**
* The private file directory path, if any.
*
* @var string
*/
protected $privatePath;
/**
* The temporary file directory path.
*
* @var string
*/
protected $temporaryPath;
/**
* {@inheritdoc}
*/
public function query() {
$query = $this->select('file_managed', 'f')
->fields('f')
->condition('uri', 'temporary://%', 'NOT LIKE')
->orderBy('f.timestamp');
// Filter by scheme(s), if configured.
if (isset($this->configuration['scheme'])) {
$schemes = [];
// Remove 'temporary' scheme.
$valid_schemes = array_diff((array) $this->configuration['scheme'], ['temporary']);
// Accept either a single scheme, or a list.
foreach ((array) $valid_schemes as $scheme) {
$schemes[] = rtrim($scheme) . '://';
}
$schemes = array_map([$this->getDatabase(), 'escapeLike'], $schemes);
// Add conditions, uri LIKE 'public://%' OR uri LIKE 'private://%'.
$conditions = new Condition('OR');
foreach ($schemes as $scheme) {
$conditions->condition('uri', $scheme . '%', 'LIKE');
}
$query->condition($conditions);
}
return $query;
}
/**
* {@inheritdoc}
*/
protected function initializeIterator() {
$this->publicPath = $this->variableGet('file_public_path', 'sites/default/files');
$this->privatePath = $this->variableGet('file_private_path', NULL);
$this->temporaryPath = $this->variableGet('file_temporary_path', '/tmp');
return parent::initializeIterator();
}
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row) {
// Compute the filepath property, which is a physical representation of
// the URI relative to the Drupal root.
$path = str_replace(['public:/', 'private:/', 'temporary:/'], [$this->publicPath, $this->privatePath, $this->temporaryPath], $row->getSourceProperty('uri'));
// At this point, $path could be an absolute path or a relative path,
// depending on how the scheme's variable was set. So we need to shear out
// the source_base_path in order to make them all relative.
$path = str_replace($this->configuration['constants']['source_base_path'], NULL, $path);
$row->setSourceProperty('filepath', $path);
return parent::prepareRow($row);
}
/**
* {@inheritdoc}
*/
public function fields() {
return [
'fid' => $this->t('File ID'),
'uid' => $this->t('The {users}.uid who added the file. If set to 0, this file was added by an anonymous user.'),
'filename' => $this->t('File name'),
'filepath' => $this->t('File path'),
'filemime' => $this->t('File MIME Type'),
'status' => $this->t('The published status of a file.'),
'timestamp' => $this->t('The time that the file was added.'),
];
}
/**
* {@inheritdoc}
*/
public function getIds() {
$ids['fid']['type'] = 'integer';
return $ids;
}
}

View File

@ -104,7 +104,7 @@ class D7TaxonomyTermShowroom extends FieldableEntity {
public function prepareRow(Row $row) {
$language = $row->getSourceProperty('language');
$tid = $row->getSourceProperty('tid');
drush_print('-- '.$language."\t".$tid."\t".$row->getSourceProperty('name'));
// drush_print('-- '.$language."\t".$tid."\t".$row->getSourceProperty('name'));
// vocabulary machine name
$machine_name = $row->getSourceProperty('machine_name');

View File

@ -66,7 +66,7 @@ class D7TaxonomyTermTags extends FieldableEntity {
*/
public function prepareRow(Row $row) {
$language = $row->getSourceProperty('language');
drush_print('-- '.$language."\t".$row->getSourceProperty('tid')."\t".$row->getSourceProperty('name'));
// drush_print('-- '.$language."\t".$row->getSourceProperty('tid')."\t".$row->getSourceProperty('name'));
$tid = $row->getSourceProperty('tid');
// vocabulary machine name

View File

@ -64,7 +64,7 @@ class D7TaxonomyTermTagsI18n extends FieldableEntity {
$language = $row->getSourceProperty('language');
$tid = $row->getSourceProperty('tid');
drush_print('-- '. $language ."\t".$tid."\t".$row->getSourceProperty('name'));
// drush_print('-- '. $language ."\t".$tid."\t".$row->getSourceProperty('name'));
// vocabulary machine name
$machine_name = $row->getSourceProperty('machine_name');

View File

@ -66,7 +66,7 @@ class D7TaxonomyTermThesaurus extends FieldableEntity {
*/
public function prepareRow(Row $row) {
$language = $row->getSourceProperty('language');
drush_print('-- '.$language."\t".$row->getSourceProperty('tid')."\t".$row->getSourceProperty('name'));
// drush_print('-- '.$language."\t".$row->getSourceProperty('tid')."\t".$row->getSourceProperty('name'));
$tid = $row->getSourceProperty('tid');
// vocabulary machine name

View File

@ -64,7 +64,7 @@ class D7TaxonomyTermThesaurusI18n extends FieldableEntity {
$language = $row->getSourceProperty('language');
$tid = $row->getSourceProperty('tid');
drush_print('-- '. $language ."\t".$tid."\t".$row->getSourceProperty('name'));
// drush_print('-- '. $language ."\t".$tid."\t".$row->getSourceProperty('name'));
// vocabulary machine name
$machine_name = $row->getSourceProperty('machine_name');