fixed migration subscribers plugin
This commit is contained in:
parent
ace8df0aee
commit
2c26e8a0ea
|
@ -1,4 +1,4 @@
|
||||||
uuid: 2344f826-c47e-4923-ad65-630295fb6719
|
uuid: 95015cbb-ff5e-4f86-98ad-69a8d7e0de49
|
||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies: { }
|
dependencies: { }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uuid: e4ed115a-f6f6-484f-a07a-5fbc7338c034
|
uuid: a8711192-2221-4bb0-886b-6a952af7948d
|
||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies: { }
|
dependencies: { }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uuid: 8c1bd1fc-a0fb-4bac-a7f8-9837c0eebdc4
|
uuid: be332db0-4ff0-45ac-86d1-ac8162c565b9
|
||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies: { }
|
dependencies: { }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uuid: e1e2cfad-0d0d-4448-8dfb-b5e53b7d1a9f
|
uuid: 47872e9f-36b0-4cd5-b273-1acdfbc7dca8
|
||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies: { }
|
dependencies: { }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uuid: 04688802-34d3-48a6-83ee-1b2b584e7ee8
|
uuid: a3ec42d1-12a0-4041-8fd6-52be46cc116f
|
||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies: { }
|
dependencies: { }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uuid: 3c3ccdd6-d1c4-41b7-bba0-aee4c6cedd92
|
uuid: 6c6e15b5-b3d3-42c8-8ccd-10043efbac7a
|
||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies: { }
|
dependencies: { }
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
uuid: e96db13c-0d24-47c0-a7e7-8c5d60803cdc
|
uuid: 59a27fe9-2874-4cf6-86ec-e757f0ef29f0
|
||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies: { }
|
dependencies: { }
|
||||||
_core:
|
_core:
|
||||||
default_config_hash: b2MXWpch207TVNeTDT9MV-JYlCyRlkj64EIzLDHuwWo
|
default_config_hash: VloCz4g4ojd5g00TY-4icqkDJXC2zOYHP3ysyqL4lUQ
|
||||||
id: d7_simplenews_subscribers
|
id: d7_simplenews_subscribers
|
||||||
class: null
|
class: null
|
||||||
field_plugin_method: null
|
field_plugin_method: null
|
||||||
|
@ -15,7 +15,7 @@ migration_tags:
|
||||||
migration_group: d7_materio
|
migration_group: d7_materio
|
||||||
label: 'Simplenews subscribers'
|
label: 'Simplenews subscribers'
|
||||||
source:
|
source:
|
||||||
plugin: simplenews_subscriber
|
plugin: d7_simplenews_subscribers
|
||||||
process:
|
process:
|
||||||
id: snid
|
id: snid
|
||||||
status: activated
|
status: activated
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uuid: bc633efe-715f-4ea0-b4f3-ea0b229249ce
|
uuid: 051d650f-571f-44f0-b752-beef9af80fc5
|
||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies: { }
|
dependencies: { }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uuid: 4af34119-1c2f-4796-87f0-8fbab165d111
|
uuid: 1dc791a4-06e7-4e79-ad8b-b2be442f5b48
|
||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies: { }
|
dependencies: { }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uuid: b1fd039c-4272-43bb-9fa6-478fdc950fc7
|
uuid: b885e080-ef2c-4732-88e6-ab6752919ee2
|
||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies: { }
|
dependencies: { }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uuid: cff5d663-2ca0-436a-9676-dd6d3bb0ca11
|
uuid: d8159460-9be8-4ab9-962b-430d03040d8d
|
||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies: { }
|
dependencies: { }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uuid: 2ba08bea-0803-4f85-8950-82ae27939d20
|
uuid: a154291b-424f-481e-af2c-6678a8738af5
|
||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies: { }
|
dependencies: { }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uuid: 0bcd4689-eeac-4ff3-8a45-b248f8cf597a
|
uuid: 63451d96-d2d2-4d0d-a6e5-da85015bbbfb
|
||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies: { }
|
dependencies: { }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uuid: 8988f760-b08e-44eb-a4f1-3b13cf5456e3
|
uuid: 8c5c8877-d9d8-44d9-ad92-c4554932cb19
|
||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uuid: 8fe4d9e7-41f3-4010-9347-6bfd2a7317dc
|
uuid: 47a37723-5919-447c-b997-6cf87af11785
|
||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies: { }
|
dependencies: { }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uuid: 1e79a6e8-ab3a-4873-bf4c-a96d82faa13e
|
uuid: 019e4841-a5c5-4664-a259-e00ebc6510d1
|
||||||
langcode: en
|
langcode: en
|
||||||
status: true
|
status: true
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -7,6 +7,8 @@ dependencies:
|
||||||
- migrate_plus
|
- migrate_plus
|
||||||
- migrate_tools
|
- migrate_tools
|
||||||
- materio_migrate
|
- materio_migrate
|
||||||
|
_core:
|
||||||
|
default_config_hash: tbcV0glxU9BqeXcSUn9ZKXnOPW-C2v8Q-shvIJ2xNG8
|
||||||
id: d7_materio
|
id: d7_materio
|
||||||
label: 'D7 Materio'
|
label: 'D7 Materio'
|
||||||
description: 'Drupal 7 materio content migration to Drupal 8.'
|
description: 'Drupal 7 materio content migration to Drupal 8.'
|
||||||
|
|
|
@ -62,5 +62,5 @@ sleep 5
|
||||||
echo " "
|
echo " "
|
||||||
echo "Migrating simplenews"
|
echo "Migrating simplenews"
|
||||||
drush mim d7_simplenews_nodes --feedback="200"
|
drush mim d7_simplenews_nodes --feedback="200"
|
||||||
drush mim d7_simplenews_subscribers --feedback="1000"
|
drush mim d7_simplenews_subscribers --update --feedback="1000"
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
|
@ -13,7 +13,10 @@ migration_tags:
|
||||||
- Materio
|
- Materio
|
||||||
|
|
||||||
source:
|
source:
|
||||||
plugin: simplenews_subscriber
|
plugin: d7_simplenews_subscribers
|
||||||
|
# high_water_property:
|
||||||
|
# name: changes
|
||||||
|
# alias: s
|
||||||
|
|
||||||
process:
|
process:
|
||||||
id: snid
|
id: snid
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\materio_migrate\Plugin\migrate\source;
|
||||||
|
|
||||||
|
use Drupal\migrate\Row;
|
||||||
|
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migration source for Subscriber entries in D7.
|
||||||
|
*
|
||||||
|
* @MigrateSource(
|
||||||
|
* id = "d7_simplenews_subscribers",
|
||||||
|
* source_module = "simplenews"
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
class D7SimplenewsSubscribers extends DrupalSqlBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function fields() {
|
||||||
|
return [
|
||||||
|
'snid' => $this->t('Subscriber ID'),
|
||||||
|
'activated' => $this->t('Activated'),
|
||||||
|
'mail' => $this->t('Subscriber\'s e-mail address'),
|
||||||
|
'uid' => $this->t('Corresponding user'),
|
||||||
|
'language' => $this->t('Language'),
|
||||||
|
'changes' => $this->t('Pending unconfirmed subscription changes'),
|
||||||
|
'created' => $this->t('Time of creation'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getIds() {
|
||||||
|
return ['snid' => ['type' => 'integer']];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function query() {
|
||||||
|
return $this->select('simplenews_subscriber', 's')
|
||||||
|
->fields('s')
|
||||||
|
->orderBy('snid');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function prepareRow(Row $row) {
|
||||||
|
$result = parent::prepareRow($row);
|
||||||
|
|
||||||
|
$version = $this->getModuleSchemaVersion('simplenews');
|
||||||
|
$newsletter_id_field = 'newsletter_id';
|
||||||
|
if ($version >= 7000 & $version < 7200) {
|
||||||
|
$newsletter_id_field = 'tid';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add associated data from the subscriptions table.
|
||||||
|
$q = $this->select('simplenews_subscription', 'sub');
|
||||||
|
$q->addField('sub', $newsletter_id_field, 'newsletter_id');
|
||||||
|
$q->fields('sub', ['status', 'timestamp', 'source']);
|
||||||
|
$q->condition('sub.snid', $row->getSourceProperty('snid'));
|
||||||
|
$subscriptions = $q->execute()->fetchAllAssoc('newsletter_id');
|
||||||
|
$row->setSourceProperty('subscriptions', $subscriptions);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function calculateDependencies() {
|
||||||
|
$this->dependencies = parent::calculateDependencies();
|
||||||
|
// Declare dependency to the provider of the base class.
|
||||||
|
$this->addDependency('module', 'migrate_drupal');
|
||||||
|
return $this->dependencies;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue