Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
48

You can get the UUID with: drush config-get "system.site" uuid And you can change it with drush config-set "system.site" uuid "fjfj34-e3bb-2ab8-4d21-9100-b5etgetgd99d5" With that you gotta have the same sites.


48

The easiest way to do this at the moment is to use drush php (or core-cli) to open an interactive session. Then use: Drupal::configFactory()->getEditable('system.menu.devel')->delete(); This functionality will be added into Drupal console as well.


26

The easiest way is to ensure that the config has a dependency on your module. dependencies: module: - yourmodule enforced: module: - yourmodule Then Drupal will automatically remove that configuration and also warn in the UI that it will be removed. Note that this only works for new installations, it won't fix existing ones. An ...


24

Maybe you hope to learn that variable_set is the magical way to store all kinds of structured data in your database, and that variable_get is the way to get it out again. Unfortunately, it is not. The "persistent variables", as they are often called, are meant for relatively simple key-value pairs that should persist across requests, users and sessions, ...


24

Drush command to delete configuration object: drush config-delete <config_name>.


20

As mentioned in the original question, and follow-up comments, there are a variety of contrib modules and manual methods to accomplish this. To do it automatically, or in a custom fashion, I think hook_update_N() is still probably the most viable option. For instance, this is an example from the Head 2 Head to update system.site to set the default_langcode:...


18

Method: Drush Drush can ignore the enabled states of extensions when synchronizing configuration. drush cex --skip-modules=devel drush cim --skip-modules=devel With Drush CMI tools you can operate with a list of configuration to ignore. drush cexy --ignore-list=/path/to/config-ignore.yml drush cimy --delete-list=/path/to/config-ignore.yml Method: ...


17

The Configuration Management only allow sync configuration between same site or project to avoid issues importing configuration from site a.com to b.com, to accomplish this validation Drupal 8 generate a UUID for each site. You cat get your current site UUID executing the following command: drush cget system.site The command above we will have a similar ...


13

You can import one configuration by running the following command: drupal config:import:single If you are trying to run multiple import you can create a chain for that. Command Documentation - config:import:single


12

You can use the following methods. Use the following code in hook_uninstall Drupal::configFactory()->reset('field.storage.bloom_stem.bs_twitter_ac'); OR in the yml file you can put the dependencies like dependencies: module: - yourmodule enforced: module: - yourmodule then drupal will automatically remove this configurations on ...


12

Configuration management is exporting exactly what it was designed to do: Export the configuration settings. The actual taxonomy terms themselves are sitting in the taxonomy_term_field_data table in the database.


12

You can use $ drush cim --partial --source=only-few-configs/ Your help says: $ drush cim --help Import config from a config directory. Examples: drush config-import --partial Import configuration; do not remove missing configuration. Arguments: label A config directory label (i.e. a key in $...


11

It's the same: The variable_set function saves the variable to database serializing it. variable_get takes the variable from $conf where the variable is already unserialized. Example: $var1 = array( 'key1' => 'value1', 'key2' => 'value2' ); variable_set('var1', $var1); print_r variable_get('var1'); Output Array ( [key1] => value1 [...


11

Cloned site means that you copied the database instead of installing twice from scratch. Drupal identifies two different sites as cloned sites by checking their uuid. If the uuids match, then it will assume that the sites are cloned instances. Faulty configuration imports can lead to broken sites which we may not be able to restore. Hence to avoid this ...


10

Variables are cached, so deleting manually is fine so long as you invalidate that cache, e.g. db_delete('variable') ->condition('name', 'mymodule_%', 'LIKE') ->execute(); cache_clear_all('variables', 'cache_bootstrap');


10

Yes and no. (I am not sure if this will be too technical). The configuration is stored in configuration objects. Drupal has by default an active and a staging storage for those configuration objects. The default active storage is in the database, yes, for performance and easier backup/restore, among other reasons. But that is an implementation detail. It ...


10

You can use the "Config Ignore" module: https://www.drupal.org/project/config_ignore Ever experienced that your site's configuration was overridden by the configuration on the filesystem, when doing a drush cim? Not anymore! This module is a tool to let you keep the configuration you want, in place.


10

In Drupal 7 $data = variable_get('test_content_types'); In Drupal 8 $data = \Drupal::state()->get('test_content_types'); For more information about about "get", "set", "delete" visit - Step 5: How to upgrade D7 variables to D8's state system.


10

UPDATE You might also try Drupal Console's drupal config:export:content:type command. It's description says: The config:export:content:type command Export a specific content type and their fields. Content types and Fields are 2 separate configuration in Drupal 8, so if you want to export content type with fields you have to export all it's fields ...


10

You can create a new setting in your settings.local.php or settings.php file like: $settings['event_base_url'] = 'https://www.example.com'; or some people are adding switch block based on the server host, e.g.: switch (@$_SERVER['HTTP_HOST']) { default: case 'dev.example.com': $settings['event_base_url'] = 'http://dev.example.com'; break; ...


9

To elaborate on @dawehner's answers, default configuration is not cached. It is only imported when you install a module. After that, if you make changes to default configuration, the only way to add it to existing installations is to write an update function that adds it manually. During development, there are modules like Configuration development, that ...


9

Using the drupal console: $ drupal config:delete 'the_config_to_delete'


9

As I landed on this question as well but did not really find the correct answer for my situation here, I'd like to add another answer. Please note: Anti-pattern ahead! Use case When we're developing projects we constantly update our test / acceptance environment with new configuration updates. Take for example a simple fictional News-module, we'd like to ...


9

Updates must be run before configuration is imported A pending issue against core will ensure that the code and schema versions match before allowing configuration to be imported. Problems with config import before updates An update hook relying on a configuration value could end in a different result than if it were run on the pre-import value. An update ...


9

From Dave Reid on Twitter Ignoring Development Modules If you have a certain list of modules that should only be enabled on the development or staging server, then this may be done with the built-in --skip-modules option in the config-export and config-import commands. For example, if you want to enable the 'devel' module on development systems, but not ...


9

A sequence is an unlimited list of identically structured elements. A mapping is a limited set of keys, each key has a possibly different structure. Your key has node types, so you're storing a list of node type ids, which means a sequence with an inner type string. Exactly what you have. If you'd use a mapping, you could only store book and test, but ...


8

I think you are looking for Configuration Management module. The module knows where configuration was changed and allows users to either "activate" a configuration that was changed in the datastore, or "write" to datastore if a configuration was changed in the activestore. If you enable the diff module, you can see the what is in the activestore ...


8

There are a number of approaches to synchronizing configuration between environments. A few popular ones for Drupal 7 are: https://drupal.org/project/features (recommended) https://drupal.org/project/strongarm https://drupal.org/project/configuration For example with drush and features you can revert a component to the code definition with drush fr ...


8

Using Drupal Console You can achieve the same with Drupal Console by overriding the system.site — uuid key. $ drupal config:override Then enter the configuration name system.site, the configuration key uuid and the appropriate value when prompted. Enter configuration name [advagg.settings]: > system.site Enter the configuration key [uuid]: > ...


8

There was a discussion in the Drush issue queue on allowing config-import to force the adoption of the UUIDs in the imported configuration to be inserted into the database. The problem with allowing this is that this operation is equivalent to deleting all of your configuration (e.g. all of your content types) and then re-creating them, which has the side-...


Only top voted, non community-wiki answers of a minimum length are eligible