Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Created from #1775842: [meta] Convert all variables to state and/or config systems.
Not 100% sure if this is config or state, creating the issue so we can work on it at the melbourne sprint tomorrow.
color_ . $theme . _files color.module
color_ . $theme . _palette color.module
color_ . $theme_key . _logo color.module
color_ . $theme_key . _stylesheets color.module
Comment | File | Size | Author |
---|---|---|---|
#75 | 1804380-color_variables_to_config_upgrade-75.patch | 12.18 KB | vijaycs85 |
#75 | 1804380-diff-68-75.txt | 1.41 KB | vijaycs85 |
#68 | 1804380-color_variables_to_config_upgrade-68.patch | 12.67 KB | vijaycs85 |
#68 | 1804380-62-68-diff.txt | 675 bytes | vijaycs85 |
#63 | 1804380-difftxt-57-62.txt | 4.57 KB | vijaycs85 |
Comments
Comment #1
8thom CreditAttribution: 8thom commentedAfter investigating this issus we've found that themes don't require a default config and a variable is only set if it is overridden in the UI.
A new config file will be required in the theme if it wants to include default config named color.[theme name].yaml
Comment #2
8thom CreditAttribution: 8thom commentedHere's the patch, includes a TODO as it would be better for all themes to define their default configuration in YAML rather than the current method but this is not in scope of this patch.
Comment #3
8thom CreditAttribution: 8thom commentedJust reviewed and realised I broke logic in color_get_palette function when trying to fix for test.
Comment #4
8thom CreditAttribution: 8thom commentedComment #5
BerdirIndendation looks wrong here, that drupal_rmdir() line shouldn't be changing?
Comment #6
Berdir#3: color_variables_to_config-1804380-3.patch queued for re-testing.
Comment #7
8thom CreditAttribution: 8thom commentedBerdir thanks for the review.
Fixed up indentation.
Comment #9
8thom CreditAttribution: 8thom commented#7: color_variables_to_config-1804380-7.patch queued for re-testing.
Comment #11
aspilicious CreditAttribution: aspilicious commented#7: color_variables_to_config-1804380-7.patch queued for re-testing.
Comment #12
aspilicious CreditAttribution: aspilicious commentedWhere is the yml file? And where is the update function?
Comment #13
gddComment #14
8thom CreditAttribution: 8thom commentedThe problem is the config is unique to each theme that implements the color module so the yml file should really be in the theme and therefore each theme would need it's own update function.
See comment #1 & #2 for more info
Comment #15
8thom CreditAttribution: 8thom commentedComment #16
miro_dietikerPassing a first try on how the upgrade path should migrate the previous settings.
Anything addigional / custom missing?
Still no .yml file(s) present.
Comment #17
8thom CreditAttribution: 8thom commentedWe could add a yml file to the color module, but wouldn't it be better placed in each of the themes that use the color module?
That way they would each have a yml file named color.[theme_name].yml inside their config.
'color/color.inc' is currently where default configuration is stored per theme.
Comment #19
miro_dietikerA different thing is upgrade test coverage.
I tried adding howto add upgrade test coverage to the example howto:
http://drupal.org/node/1667896
What's the proper location to do a upgrade test? Seems we need to write a separate color upgrade test from scratch.
Comment #20
BerdirThe config upgrade test class is currently incorrectly named "SystemUpgradePathTest".
Comment #21
miro_dietikerProviding a version that should fix the upgrade path.
Tests for upgrade path missing.
Since the theme doesn't provide anything by default, i think we don't need any default .yaml config in the themes.
Comment #23
miro_dietikerComment #25
miro_dietikerSwitching upgrade to plain $config objects. No more update_variables_to_config().
Comment #27
miro_dietikerGrr :-)
Comment #28
miro_dietikerGreat!
Note that the upgrade now doesn't do anything.
Thus, to test if upgrading really works, we need to prefill a theme with color settings and check if upgrad works.
Comment #29
miro_dietikerAdded test coverage. :-)
Indeed found a bug!
Added a real upgrade path for bartik, plus a faked for seven with optional screenshot.
Comment #31
BerdirThe last testfail there is a random one, I've seen that before, opened #1833928: Random test failure in Drupal\user\Tests\UserAccountLinksTests.
Will trigger a re-test.
Comment #32
Berdir#29: 1804380_color_variables_to_config_upgrade_29.patch queued for re-testing.
Comment #33
miro_dietiker#29: 1804380_color_variables_to_config_upgrade_29.patch queued for re-testing.
Comment #35
swentel CreditAttribution: swentel commentedReroll to apply against head.
Comment #37
miro_dietikerRerolled.
Comment #39
miro_dietikerGrrrr, merged buggy :-)
Comment #40
miro_dietikerComment #41
aspilicious CreditAttribution: aspilicious commentedshould be @todo (and a space before the @todo), yes we have coding standards for todo's. See http://drupal.org/node/1354
Trailing whitespace
Comment #42
8thom CreditAttribution: 8thom commentedFixed up todo & trailing white space
Comment #43
miro_dietiker#42: color_variables_to_config-1804380-42.patch queued for re-testing.
Comment #45
8thom CreditAttribution: 8thom commented#42: color_variables_to_config-1804380-42.patch queued for re-testing.
Comment #47
miro_dietikerReroll.
Comment #48
aspilicious CreditAttribution: aspilicious commentedGood to go!
Comment #49
catchlist_themes() isn't safe to use during updates, but it looks like this could be replaced by a LIKE query on the variables table?
Should be $palette_config
Comment #50
vijaycs85fixes for review comment #49.
Comment #52
vijaycs85Misplacement of upgrade code on patch merge conflict. here is the locally working patch
Comment #53
ACF CreditAttribution: ACF commentedLooks pretty good, a bit niggly but in
$themes = db_query('SELECT name FROM {variable} WHERE name like :name', array(':name' => 'color_%_palette'))->fetchAllAssoc('name');
like needs to be capitalized.Comment #54
8thom CreditAttribution: 8thom commentedcapitalised like - comment #53
Comment #55
8thom CreditAttribution: 8thom commentedComment #56
vijaycs85updating query to escape underscore.
Comment #57
vijaycs85Re-rolling...
Comment #59
Tor Arne Thune CreditAttribution: Tor Arne Thune commented#57: 1804380-57-color_variables_to_config_upgrade.patch queued for re-testing.
Comment #60
aspilicious CreditAttribution: aspilicious commentedCan't find any problems...
Comment #61
catchFound a few minor issues, and there's one hunk that's removed with no configuration system equivalent that I'm not sure can just go away.
Why is the update_variable_get() check necessary? It's not going to be different to the direct query that was just run. Also nitpicking but the comment should start with a capital letter.
Again the comments don't meet code style.
Should be a space after the if before the parenthesis.
This isn't replaced at all. Is that OK?
Comment #62
vijaycs85Fixed all comments in #61, except last one
Hopefully we are saving them as config.
Comment #63
vijaycs85sorry wrong ext for difftext.
Comment #65
vijaycs85#62: 1804380-color_variables_to_config_upgrade-62.patch queued for re-testing.
Comment #66
vijaycs85Seems patch in #61 (1804380-color_variables_to_config_upgrade-62.patch) was failing because of testbot. Now it is ready for review.
Comment #67
BerdirI don't quite understand this either. Yes, it's config, but we need to delete that too?
Not really visible from the patch context when this is triggered exactly and the comment doesn't tell me much either. Might require some manual testing...
Comment #68
vijaycs85Hi Berdir,
I just did a test around this and here is my findings:
1. In color.inc, we have default color scheme for all default themes has been defined
2. Whenever we save the color settings form of a theme, we create list of variable to save this changes
3. However, if we hit save without any change in color settings form, this code avoids the creation/existence of this set of variables and fetch colors from default (i.e. color.inc).
4. This has been handled in color_get_palette().
where is $palette is from $theme/color.inc. So adding this code back to remove $config.
When @todo (to move $theme/color.inc variables to config system) fixed, we will have two configs for each color scheme under a theme and after this change the above code would become:
Comment #70
vijaycs85#68: 1804380-color_variables_to_config_upgrade-68.patch queued for re-testing.
Comment #71
aspilicious CreditAttribution: aspilicious commented#68: 1804380-color_variables_to_config_upgrade-68.patch queued for re-testing.
Comment #73
vijaycs85#68: 1804380-color_variables_to_config_upgrade-68.patch queued for re-testing.
Comment #74
BerdirDid a visual review, looks good apart from the following minor issues:
Should have spaces around the .
Looks like an unrelated change?
Comment #75
vijaycs85Thank you @Berdir. Updating the patch with fix for #74.
Comment #76
BerdirI think that looks good now, @catch's review has been dealt with and the delete/default handling fixed.
Comment #77
catchLooks good to me now too. Committed/pushed to 8.x.