Problem/Motivation

As in Drupal 6 nodes were used for a lot of different use-cases some node types are completely replaced by new concepts and, thus, do not need to be migrated. One example would be page nodes which get replaced by proper page manager pages in Drupal 8.

Proposed resolution

Allow to limit the nodes to be migrated in the D6 Node source plugin by a specific node type.

Remaining tasks

User interface changes

API changes

Comments

tstoeckler’s picture

Status: Active » Needs review

Here's something I cooked up. It seems to work going by some limited testing.

Notes:
- If this is accepted we want to expand this to e.g. NodeRevision as well
- This will need config schema
- Due to how condition() works, this can be both a simple string and an array of node types, which is kind of neat

Thoughts?

tstoeckler’s picture

StatusFileSize
new588 bytes

Oops, here's the patch.

benjy’s picture

Yeah I like it, especially if it's that simple. +1 from me.

tstoeckler’s picture

Here we go. NodeRevision actually does not need to be updated, as it extends Node. Nice!

This patch adds some config schema and tests.

Btw, we should separate the config schema and move lots of it into migrate_drupal where it belongs, but that's not for this issue.

tstoeckler’s picture

StatusFileSize
new8.81 KB
new9.38 KB

#facepalm

Status: Needs review » Needs work

The last submitted patch, 5: 2332751-4-migrate-node-node-type.patch, failed testing.

tstoeckler’s picture

Status: Needs work » Needs review
StatusFileSize
new6 KB
new21.53 KB

Ahh, yes, that doesn't really work. Here we go.

ultimike’s picture

benjy’s picture

Had a quick look over this and it looks good. I'll try give it a proper test a the weekend.

Would be good to tidy up the serialized strings mentioned below.

  1. +++ b/core/modules/migrate_drupal/tests/src/Unit/source/d6/NodeRevisionByNodeTypeTest.php
    @@ -0,0 +1,338 @@
    +        'widget_settings' => 'a:4:{s:4:"rows";i:5;s:4:"size";s:2:"60";s:13:"default_value";a:1:{i:0;a:2:{s:5:"value";s:0:"";s:14:"_error_element";s:42:"default_value_widget][field_test][0][value";}}s:17:"default_value_php";N;}',
    +        'display_settings' => 'a:6:{s:6:"weight";s:2:"31";s:6:"parent";s:0:"";s:5:"label";a:1:{s:6:"format";s:5:"above";}s:6:"teaser";a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}s:4:"full";a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}i:4;a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}}',
    

    Can we make these arrays and then call serialize. I think we decide that was the clearest way elsewhere.

  2. +++ b/core/modules/migrate_drupal/tests/src/Unit/source/d6/NodeRevisionByNodeTypeTest.php
    @@ -0,0 +1,338 @@
    +        'global_settings' => 'a:4:{s:15:"text_processing";s:1:"0";s:10:"max_length";s:0:"";s:14:"allowed_values";s:0:"";s:18:"allowed_values_php";s:0:"";}',
    ...
    +        'db_columns' => 'a:1:{s:5:"value";a:5:{s:4:"type";s:4:"text";s:4:"size";s:3:"big";s:8:"not null";b:0;s:8:"sortable";b:1;s:5:"views";b:1;}}',
    

    Same for these.

  3. +++ b/core/modules/migrate_drupal/tests/src/Unit/source/d6/NodeRevisionByNodeTypeTest.php
    @@ -0,0 +1,338 @@
    +        'widget_settings' => 'a:4:{s:4:"rows";i:5;s:4:"size";s:2:"60";s:13:"default_value";a:1:{i:0;a:2:{s:5:"value";s:0:"";s:14:"_error_element";s:42:"default_value_widget][field_test][0][value";}}s:17:"default_value_php";N;}',
    +        'display_settings' => 'a:6:{s:6:"weight";s:2:"31";s:6:"parent";s:0:"";s:5:"label";a:1:{s:6:"format";s:5:"above";}s:6:"teaser";a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}s:4:"full";a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}i:4;a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}}',
    ...
    +        'global_settings' => 'a:4:{s:15:"text_processing";s:1:"0";s:10:"max_length";s:0:"";s:14:"allowed_values";s:0:"";s:18:"allowed_values_php";s:0:"";}',
    ...
    +        'db_columns' => 'a:1:{s:5:"value";a:5:{s:4:"type";s:4:"text";s:4:"size";s:3:"big";s:8:"not null";b:0;s:8:"sortable";b:1;s:5:"views";b:1;}}',
    

    Few more

benjy’s picture

StatusFileSize
new8.09 KB
new22.78 KB

OK, re-rolled this issue and fixed the formatting things I mentioned just before. Also fixed the NodeByNodeTypeTest.

tstoeckler’s picture

Awesome, thanks @benjy! I had sort of forgotten about this...

ultimike’s picture

+++ b/core/modules/migrate_drupal/tests/src/Unit/source/d6/NodeByNodeTypeTest.php
@@ -0,0 +1,128 @@
+    // Add another row with an article node and make sure it is not migrated.

Shouldn't this comment be above line 89? Seems out of place here.

Also - while the changes/additions to the automated tests look good, I have to admit that I'm still trying to figure out the difference between the tests in core/modules/migrate_drupal/src/Tests vs. the tests in core/modules/migrate_drupal/tests

Finally, once this gets committed, we'll need to document it - probably here, I assume: https://www.drupal.org/node/2129649

-mike

benjy’s picture

StatusFileSize
new22.78 KB
new1.07 KB

Thanks for the review.

The difference between the tests are that unit tests live under core/modules/migrate_drupal/tests where as integration tests live under core/modules/migrate_drupal/src/Tests

ultimike’s picture

Status: Needs review » Reviewed & tested by the community

Looks great!

Thanks for the explanation on unit vs. integration tests.

-mike

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 13: 2332751-13.patch, failed testing.

tstoeckler’s picture

Status: Needs work » Needs review
StatusFileSize
new1.64 KB
new21.64 KB

I have no idea what is going here, but let's see if copying the recent changes from #2333357: Migrate node_revisions.timestamp into the revision_timestamp field here helps. It doesn't hurt to keep these in sync in any case.

Status: Needs review » Needs work

The last submitted patch, 16: 2332751-16-migrate-node-node-type.patch, failed testing.

benjy’s picture

Status: Needs work » Needs review
StatusFileSize
new21.75 KB
new1.49 KB

the log field needed to be added to the revision fields.

tstoeckler’s picture

Awesome, thanks! Pretty minor stuff since #14 so I hope it's OK if I set this back to RTBC.

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

Ahem.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 807e561 and pushed to 8.0.x. Thanks!

  • alexpott committed 807e561 on 8.0.x
    Issue #2332751 by tstoeckler, benjy: Added Allow to limit the nodes to...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.