Closed (fixed)
Project:
Drupal core
Version:
8.5.x-dev
Component:
migration system
Priority:
Minor
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
4 Jun 2015 at 15:08 UTC
Updated:
24 Apr 2018 at 12:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
quietone commentedComment #2
quietone commentedThis patch does migrate the D7 color data but there are two problems that I know of. One is a schema error for the variable 'screenshot' and the other is there is no test for the destination plugin.
For the first problem, the error is 'color.theme.garland:screenshot missing scheme'. It seems the solution is to add the screenshot variable to the schema. If that is true, then that needs to be done use the update process?
For the destination plugin, I'll work on that again tomorrow. In the meantime, I'd like to see how testing goes.
Look Ma, no hash!!!
Comment #5
quietone commentedAs expected, fail on 'color.theme.garland:screenshot missing schema'.
Comment #6
quietone commentedComment #7
quietone commentedTalked to phenaproxima on IRC and got this sorted. Thx!
Comment #8
phenaproximaShould be color_%_screenshot.
There's no need for this assertion -- trying to create a screenshot property in the config entity would throw a schema exception, so we'd catch this anyway :)
Should this be here? :)
Comment #9
quietone commented1. Absolutely
2. Yes, of course.
3. Oh my, I need more sleep. Fixed.
Kudos to phenaproxima!
Comment #10
quietone commentedComment #11
mikeryanFor those of us not already conversant with the color variables, could the comment show by example what's happening? I take it we're taking something like variable color_bartik_palette with value array(stuff), and turning it into array('color.theme.bartik', 'palette', array(stuff))...
Apart from that, looks good, but I'd leave the RTBC to someone who can test this manually and see that they get the desired color settings.
Actually, just had a second thought - should we be checking to be sure the referenced theme exists in D8? If we were to blindly migrate the color settings for a theme that isn't there, and the theme were installed later, would it pick up the migrated values? I'm guessing it'll install its defaults...
Comment #12
phenaproximaLooks perfectly good to me, except for some nits. The most pressing issue, I feel, is the need for comments. Because color configuration is handled so strangely in D7, it can easily be very difficult to follow the migration logic at work here. So comment the hell out of it, I say! :)
Nit: There's an extra space between "Contains" and "\Drupal".
This shouldn't be in the @file comment.
I agree with @mikeryan that a comment here would be nice, explaining what is expected from $row->getRawDestination() and how it is used.
Also, the config factory should be injected in the constructor (ContainerFactoryPluginInterface).
This needs to be filled in.
Can the comment be a little more extensive? It should explain what the value looks like on the way in, and what we're separating it out into.
Should be @inheritdoc.
Nit: This can all be a single line (return $this->select(...)). No need for a separate return.
These descriptions might be a bit confusing in a UI situation but I think that can slide for now.
Needs @inheritdoc.
Nit: Needs a blank line before $expectedResults.
For readability, there's no need to index this array with 0. Just
'value' => ['public://...']is fine.Same here.
...and here.
Unless it causes exceptions and site breakage, I don't feel strongly about it one way or the other. We can do it if it's easy, but if it's tricky then it seems to me like a lot of work for little gain.
Comment #13
quietone commented@mikeryan and @phenaproxima, thx for the review. I appreciate it, esp as this is a low priority item.
I've addressed all your concerns, and will do some testing in the next few days paying attention to what happens when a theme is installed after a migration.
Comment #14
quietone commentedThis and another theme 'variable to config' issue both need and an explode process plugin. And since there was an existing issue just for that, #2575101: Add an explode/separator process plugin I posted a patch there. I rewrote this to use that plugin and I think it is easier to follow now.
Still needs testing as suggested in #11.
And blocked by #2575101: Add an explode/separator process plugin
Comment #15
quietone commented#2575101: Add an explode/separator process plugin is in so no longer postponed.
Need to follow up this question from mikeryan's query in #11.
Comment #16
quietone commentedLet's see what the testbot finds.
Comment #18
quietone commentedPostponed on #2675164: Pipeline using explode and concat fails and #2675156: Pipeline using explode and extract fails.
Comment #19
quietone commentedComment #21
heddnToo much time has passed. Removing the novice flag because someone new isn't going to be able to work on any actionable tasks on this issue.
Comment #22
chx commented> core/modules/color/src/Plugin/migrate/destination/d7/Color.php
This shouldn't exist. Destinations are not per D7 they are per D8. So: core/modules/color/src/Plugin/migrate/destination/Color.php .
Comment #25
damienmckennaNow that #2575101 has been committed, this can be worked on again.
Comment #26
quietone commentedRerolled.
Comment #27
quietone commentedFix namespace error.
Comment #30
jofitzCorrect test fails.
Comment #31
phenaproximaSelf-assigning for review.
Comment #32
phenaproximaAll I could find was nitpicky stuff. Everything here looks straightforward and in order. First-class work. Once all this feedback is addressed, this is RTBC. Excellent work, @quietone and @Jo Fitzgerald.
Nit: Should start with a capital letter.
The values should be enclosed by single quotes, since they are example values.
Um, why is the second source value empty?
"Definition" is misspelled :)
These calls can be chained for readability:
$this->configFactory->getEditable()->set()->save();Why bother to set $imported at all? We could just return TRUE here, and return FALSE by default at the end of the method.
Ermm...this should probably return something? An array, at least?
This is never used and should be removed.
Should use [], not array().
Should use [] syntax.
Comment #33
quietone commented@phenaproxima, thanks. Fixed all the nits.
About #3, the second item in the array, which appears empty. is the value piped in from the previous plugin. However, it is odd and to avoid further questions about it I have changed the yml to be more explicit. The pipeline is now split into two step, the first getting the 'theme_name' and in the second step '@theme_name' is an input value. That should make it clearer.
Comment #34
phenaproximaI think you may have posted the wrong interdiff...?
Comment #35
quietone commentedFudge. Here is the correct one.
Comment #36
phenaproximaLookin' damn fine.
Comment #37
alexpottIs there anything that tests this is not migrated?
There's also an array syntax error...
Comment #38
quietone commentedFixed the short array syntax error.
No. Why is one needed here? What is the use case?
Comment #39
alexpott@quietone because we need to ensure that we don't migrate color settings for themes that don't exist - right?
Comment #40
phenaproximaI see no great harm in migrating color information for non-existent themes. I am not versed in the internals of how Color works, but should the theme(s) in question suddenly spring into existence (i.e., ported to D8 by some themer), won't migrating the data ensure that the color information is preserved, much to the developer's delight?
Comment #41
phenaproximaDiscussed on IRC with @alexpott and it was decided that we should not be migrating the configuration for themes that don't exist on the destination side. So let's add that filtering and appropriate test coverage. Sorry!
Comment #43
jofitzPatch in #38 no longer applies. Re-rolled.
Comment #45
jofitzCorrect test failures.
I'm not sure the best way to filter this migration - are we talking a custom process or is there some way to do this in the yaml?
Comment #46
maxocub commentedAssigning for review.
Comment #47
maxocub commentedThis looks good, but still needs work for two things:
Comment #48
quietone commentedThis should address all the points in #47.
Comment #50
maxocub commentedThanks @quietone! I think that the issue with active themes is on the destination site, not the source.
One way to do that would be to inject the theme_handler service in the source plugin and use listInfo() method.
We'll also need to test that garland theme settings are not migrated as suggested in #37.
Comment #51
quietone commented@maxocub, thx. Must still be in holiday mode.
This injects the theme_handler in the source plugin to get the themes installed on the destination. The test now installs 5 themes and a test has been added to confirm that garland was not migrated.
There is still a problem with the source plugin test, it fails on
$this->assertCount($expected_count, $plugin);in MigrateSourceTestBase. I don't know how to fix the query so that that will work. The query could be changed and a prepareRow added to remove the unwanted rows but doesn't seem the right way to go.Comment #53
quietone commentedTried simplifying the query in the source plugin but the source plugin test still fails.
Comment #56
quietone commentedAdding to my todo list!
Comment #57
quietone commentedLet's try this. Reworked the source plugin query again and updated the tests. This required changes to the migration as well for checking if the theme is installed on the destination and to exclude the screenshot variables.
Comment #59
quietone commentedAdd Configuration tag to the migration and updated the UI tests.
Comment #61
quietone commentedAh, I see the new destination needs to be added to getConfigurationClasses in the test.
Comment #62
quietone commentedFixed a few comments.
Comment #63
maxocub commentedThis patch looks quite good, I just found a few points that could be improved.
I find this code unintuitive. Since we have access to the exploded name in the yml file, we could use a combinaison of static_map & skip_on_empty. I think it might be cleaner and more intuitive :
Also, we don't test that screenshots are not migrated. In the fixtures, there's a screenshot variable for garland, but those variables are skipped because garland is not installed on the destination. I think we should add a screenshot for bartik in the fixtures and add an assert that it is in fact not migrated.
Do we need to install all those themes since we only test bartik?
Comment #64
quietone commented1. OK. implemented your suggestion.
2. True, we probably don't need to install all the themes for the test.
Comment #65
maxocub commentedThanks @quietone!
Could you add a
$this->assertNull($config->get('screenshot'));inMigrateColorTest.phpthough, to make sure they are not migrated and don't cause schema errors?This is a nit, but since this variable is supposed to be a stylesheet, it should be a CSS file.
Comment #66
maxocub commentedBack to NW to address #65.
Comment #67
quietone commentedSorry, I had intended to add the test that screenshot was not migrated.
Both fixed.
Comment #68
quietone commentedOdd. the patch isn't showing in the comment.
Comment #69
quietone commentedWell, the fixes for #65 are complete and the patch has passed tests. It, 2500495-67.patch, just isn't showing up in the comment.
Comment #70
maxocub commentedWeird that the files don't show up in comment #67, but they do show up in the IS.
I thinks this is ready, RTBCed.
Comment #71
alexpottI think this should be just color since destinations shouldn't be for a specific source. This is a similar comment to #22. Guess this is just a missed legacy of the earlier patches.
Comment #72
quietone commentedYes, that got missed. Fixed now.
Comment #73
maxocub commentedTests are green, back to RTBC.
Comment #74
alexpottCommitted and pushed d25a77e0ec to 8.6.x and 1cc630399e to 8.5.x. Thanks!
Backported to 8.5.x since migrate_drupal is still in beta.