Problem/Motivation

It is possible that the module installer when run during the config import does not use the config that comes with the module so It is important that we only add/edit config in hook_install when config installer is not in syncing state. See #2550357: Fix shortcut_install(): Only update config when syncing flag is TRUE or forum_install().

Proposed resolution

Update the hook_install documentation to accommodate that.

Remaining tasks

Review
Commit

User interface changes

None

API changes

None

Data model changes

None

Files: 
CommentFileSizeAuthor
hook_update-doc.patch1.54 KBjibran
PASSED: [[SimpleTest]]: [PHP 5.5 MySQL] 101,622 pass(es). View

Comments

jibran created an issue. See original summary.

jhodgdon’s picture

Status: Needs review » Needs work

This documentation addition does not give me enough information. I haven't read the referenced issue, and we cannot expect people who are reading the documentation of hook_install() to do so either.

The disconnect I have is this:

"make sure that config installer should not be in syncing state"

I do not know what this means, and this documentation does not explain it.

alexpott’s picture

Component: tracker.module » documentation
Priority: Normal » Major
Issue tags: +Configuration system

This is a major task since getting this wrong means that enabling a module during config import is broken.

jibran’s picture

As far as my understanding, the current configuration and stored configuration can be different in hook_install.
How?
When we install a module during config import at that point the current configuration and stored configuration are different because config import is changing the configuration so to make sure that we have valid/current configuration in hook_install we have to make sure that config installer is not in syncing state i.e. !\Drupal::service('config.installer')->isSyncing().

Does it make sense? I don't know how to accommodate this in patch.

jhodgdon’s picture

OK, that makes sense... But what should a module really do if config is in the process of synching? If its install tasks don't get done (if they're just skipped), the module won't be installed correctly.

jhodgdon’s picture

Actually, it seems like Drupal should really not allow you to install/uninstall modules while it's doing a config synch.

ifrik’s picture

Issue tags: +Barcelona2015
jibran’s picture

Quoting @alexpott from #2696593-17: Fix the module install during config import so it doesn't get lost in contrib tracker.

We need to add documentation to hook_install about the dangers of doing programatic configuration updates and not checking this.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.