Drupal - What is the command that replaces 'drush variable-set'?
Following some more research it seems the new command is:
drush config-set <config-name> <key>
(where the old format wasdrush variable-set <name> <value>
). Alias:cset
.
So I'm not totally sure that I have this right (so comment and/or another answer from someone who does would be great...), but it seems that the config that includes emails are: contact.form.feedback recipients
, update.settings notification.emails
and system.site mail
.
This update is the result for some good discussion (below). Note that some settings are arrays (rather than strings):
www/drupal8# drush config-get update.settings notification
'update.settings:notification':
emails:
- [email protected]
threshold: all
to update this you need to run:
drush -y config-set update.settings notification.emails.0 [email protected]
Source: Leverage Drush 7 for Drupal 8.
Note: Drush 7 no longer supports Drupal 8, but this still applies.
Additional follow-up,
To find the identifiers for the config to get or set,
- You can NO LONGER guess at the machine names of variables just by inspecting system settings forms. There used to be a 1:1:1 match between the form element seen on many config screens, the
$config['varname']
you could put into$settings.php
, and drush vset/vget - The config manager in the ui (found at
admin/config/development/configuration/single
) provides something of a variable browser.
I wanted to update my local.settings.php
to always disable css & js aggregation when downsyncing.
D7 :
$conf['preprocess_css'] = FALSE;
$conf['preprocess_js'] = FALSE;
D8 :
$config['system.performance']['css']['preprocess'] = 0;
$config['system.performance']['js']['preprocess'] = 0;
(And note that this type of override WILL NOT show up in your Admin UI, or in drush config-get
... though it will take effect)
This worked for me. It's a Drush PHP EVAL command.
drush ev '\Drupal::state()->set("MY_VARIABLE", "MY_VALUE")'
Here it's being used to set the state of MY_VARIABLE
You can also get the state of a variable:
drush ev 'echo \Drupal::state()->get("MY_VARIABLE")'