Problem/Motivation
A new top-level global for settings.php was added which moved a few things out of $conf.
None of the settings got an upgrade path. Not all of them need one, but a few do. This upgrade path needs to be added.
Proposed resolution
These values would need to be pulled from variables and written out to settings.php, so the best way to accomplish this is with #1921818: Modify drupal_rewrite_settings() to allow writing $settings values
Remaining tasks
#1921822-17: Take account of drupal_hash_salt during migration path from 7.x recommends
- Edit UPGRADE.TXT to instruct people to rename their
settings.phptosettings.d7.php - Add code to upgrade process to pull
drupal_hash_saltand$databasesvalues and write them to new settings file. - Detect if your
conf_path()is writable and do it automagically for you if so.
User interface changes
None
API changes
None
Related Issues
#1833516: Add a new top-level global for settings.php - move things out of $conf
#1921818: Modify drupal_rewrite_settings() to allow writing $settings values
Original report by heyrocker
When #1833516: Add a new top-level global for settings.php - move things out of $conf was committed, none of the settings got an upgrade path. Not all of them need one, but a few do. This upgrade path needs to be added. These values would need to be pulled from variables and written out to settings.php, so the best way to accomplish this is with #1921818: Modify drupal_rewrite_settings() to allow writing $settings values. This issue is currently postponed on that one.
| Comment | File | Size | Author |
|---|---|---|---|
| #41 | take_account_of-1921822-41.patch | 1.09 KB | dimaro |
| #11 | 1921822-settings-upgrade-path-11.patch | 1.04 KB | gdd |
| #9 | 1921822-settings-upgrade-path-9.patch | 242.09 KB | gdd |
| #7 | 1921822-settings-upgrade-path-7.patch | 1.05 KB | gdd |
| #2 | 1921822-settings-upgrade-path-2.patch | 1.02 KB | gdd |
Comments
Comment #1
gddThis is unblocked now.
Comment #2
gddI think this should work. Do we need upgrade path tests? I have yet to write those yet but I suppose I should. I did test it manually with both scalar and array values ('reverse_proxy_addresses' and 'proxy_exceptions' are arrays).
Comment #4
webchickYeah, I definitely think we do, unless it's absolutely impossible.
Comment #5
chx commentedYou can't write a test that changes settings.php.
Comment #6
chx commentedyou wanted if (!empty($settings)) drupal_rewrite_settings($settings); to avoid a notice and needless work.
Comment #7
gddAh aye.
Comment #8
Anonymous (not verified) commentedthis doesn't look right.
$upgrade's keys are all simple ints, so $variable_name will be 0, 1, 2, ....
i guess it should just be
or was the intention to provide meaninful keys?
Comment #9
gddWhen I first wrote this I had a keyed array with variable name/setting name, thinking there might be cases where the two differ. When there weren't I lopped off the keys in the array but didn't change the loop. Good catch!
Comment #10
gdduh that patch is borked, will u/l a new one in a bit
Comment #11
gddThat's better
Comment #12
Anonymous (not verified) commentedlooks good to me. not going to RTBC it until we get another reviewer.
Comment #13
berdirupdate_variable_get() does not consider $conf overrides. So this doesn't work for things that were defined in $conf only. There will also be things that aren't $conf at all, e.g. $drupal_hash_salt.
We either need to change that or check it ourself. Also not sure what to do with the existing $conf snippets in settings.php that we're replacing with this.
Comment #14
catchHmm I actually think we don't need an upgrade path for this - if you're running a site which needs them, then you're capable of updating them yourself - they're code rather than user data.
Not changing status and others might feel differently, but fwiw.
Comment #15
berdirI'm not sure myself, but at least *some* of them need an upgrade path. For example, drupal_hash_salt and $databases, if we change them to $settings too.
Comment #16
catchOK those two do indeed and it'd be great to move those two to $settings as well so well kill off globals altogether (except maybe $conf).
Comment #17
gddJust trying to brainstorm some ideas since I really think we want to automatically upgrade all these vars if possible.
In UPGRADE.txt we already have the following:
So we're already instructing people to overwrite their old settings file with the new one. What if we change the first step to say
and just remove step three. If we know what the source of the old settings file is, then we can grab the old entries, upgrade them, and write into the new file. We could even detect if your conf_path() is writable and do it automagically for you if so.
Comment #18
chx commentedsettings.d7.php you mean, but yes, I might take this one if noone else does; the database upgrade will need special casing in the new supersimple drupal_rewrite_settings function ;)
Comment #19
yesct commentedhttp://drupal.org/node/1427826 has instructions for updating issue summaries and using the issue summary template
using the template might be helpful, also looks like some good comments to incorporate there.
Comment #20
nategasser commentedIssue summary updated @ Drupalcon Portland
Comment #20.0
nategasser commentedUpdated issue summary.
Comment #21
yesct commentedremoving needs tag
Comment #22
Shellingfox commented#11: 1921822-settings-upgrade-path-11.patch queued for re-testing.
Comment #24
webchickTagging all critical D8 upgrade path issues as "beta blocker."
Comment #25
catchSince the migration based API will use a fresh 8.x install to migrate into, there's no need to migrate $databases, and anything else in settings.php can be configured by the person setting up the new site.
Except for drupal_hash_salt - it's absolutely necessary that old passwords continue to work etc. so that needs to be an explicit step. I think we can either require that it's copied across manually, or rewrite it if we can - but one or the other has to happen.
Comment #26
catchComment #27
catchPostponed on at least the initial framework from #1052692: New import API for major version upgrades (was migrate module).
Comment #28
xmacinfoWhy not keep automated upgrades as much as possible? Not all site should require manual settings and manual database migration.
I still believe that many Drupal sites upgrading to Drupal 8 would still benefits from using the regular upgrade steps and use update.php instead of doing everything manually.
Comment #29
catchComment #29.0
catchformatting
Comment #30
catchStill important to figure out, but no longer blocks release since migratation path doesn't.
Comment #31
mgiffordI think this has been fixed with #2125717: Migrate in core: patch #1
Comment #32
jhedstromAre folks agreed that this is fixed with #2125717: Migrate in core: patch #1?
Comment #33
mikeryanMigration from Drupal 7 has not yet been committed to core - there's been some work on it in the IMP sandbox, but I don't see anything involving drupal_hash_salt. And I don't see how it could do anything, since drupal_hash_salt is defined in the legacy site's settings.php, not in the database we're migrating from - the D8 instance has no way to automatically obtain the value. There's going to need to be a manual step documented, methinks... At the very least, perhaps instructions to the upgrader to copy the D7 drupal_hash_salt and paste into the migrate_upgrade form.
Comment #34
mikeryanSee #2397849: Export migration configuration via services for a possible approach - a contrib-implemented service on D7 to provide drupal_hash_salt (and any other code-based configuration).
Comment #35
jhedstromThis is probably no longer postponed.
Comment #36
berdirNo need for the upgrade path tag here.
Comment #37
alexpottThis is not part of the configuration system.
Comment #38
benjy commentedComment #39
quietone commentedComment #40
catchComment #41
dimaro commentedRerolled #11.
Comment #44
alexpottThis issue needs a completely different direction from #41 - that was based on a time when we upgrade d7 to d8 in place.
Except for drupal_hash_salt - it's absolutely necessary that old passwords continue to work etc. so that needs to be an explicit step. I think we can either require that it's copied across manually, or rewrite it if we can - but one or the other has to happen.
Comment #45
xjmDiscussed with @alexpott, @weal, @mikeryan, and @benjifisher. This is actually a duplicate of #2598038: Invalid passwords after D7 to D8 migration -- that issue cannot be resolved without this, and it doesn't make sense to discuss the solution separately.
The rerolled patch in #41 is not relevant as @alexpott says.
Comment #46
alexpottWe need to work out if we care if a Drupal 7 site that is being migrated to Drupal 8 has a different hash salt in settings.php. (Note that user passwords do not use this salt). This salt is used to generate things like CSRF tokens - or things like this:
If a site migrates it's hash salt then we can determine who is moving from 7 to 8 on d.o...
However given the difficulties of doing anything automatic - a migration cannot have access to both settings.php - I think this issue might be a docs issue.
Comment #47
quietone commentedAdding tag for Drupal source and destination version.
Comment #50
mikeryan@alexpott: Any updated thoughts on this? Just docs, or is there anything else to do here?
Thanks.
Comment #51
heddnPostponing on needing more info to proceed.
Comment #53
heddnSeems like a duplicate. If it isn't, please re-open and provide next steps.