I have run into this issue quite a few times and its somewhat infuriating. The title doesn't explain it well but let me attempt to try and make it more clear.

As an example, configuration.inc currently stores both the default image styles and the node type information (so it implements hook_configuration_node_info and hook_configuration_image_default_styles). Let's say I have added in all my sets to configuration and to the datastore. Its all splendid.

Down the line, I need to change just an image style config (or could be mutiple image style configs). But only in that side of the configuration. The activestore shows there are changes and I decide to write from the activestore to the datastore.

When I now do a diff of my configuration.inc file, it'll show that the image style config has come through cleanly; however, it will also show that implementation of hook_configuration_node_info is now missing (so none of my content types are now tracked). This problem is particularly rampant with display suite since it stores multiple configurations in the same file so I have to manually add my diffs to the file (making what would take at most a couple minutes into something that is 30+ minutes if I have a lot of changes).

I'll try and figure out where the issue is but one possible way to solve it is for any / all hooks to get their own config file or to rebuild the entirely of whatever hooks are stored in a particular config file.

Comments

dagmar’s picture

Assigned: Unassigned » dagmar

Now I have better understanding about how this module works I will try to fix this important issue.

dagmar’s picture

Status: Active » Needs review
StatusFileSize
new5.12 KB

I tried to figure out what was happening here. But I couldn't find an easy way to fix this.

However, in my opinion, is a lot easier to have different files for different configurations. In fact, this makes a lot of sense, it's more visible to track using VCS, and users can see really quickly what configurations are being exported just taking a look to the files saved in /config.

This patch makes the content types and images use they own files to storage they configurations. Also includes tests for overridden node types.

I made some tests and the configuration for each component is complete rewritten into the file, so, if you change only one content type, all the exported content type will be saved again.

dagmar’s picture

#2: 1538502.diferent_files.2.patch queued for re-testing.

dagmar’s picture

#2: 1538502.diferent_files.2.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 1538502.diferent_files.2.patch, failed testing.

dagmar’s picture

Status: Needs work » Needs review
StatusFileSize
new5.12 KB

Re-rolled

GDrupal’s picture

Status: Needs review » Reviewed & tested by the community

RTBC Thanks @dagmar!

btmash’s picture

Looks like this works well between the node/image changes for configuration inc. I'm going to test this out for display suite as well where I encountered this issue the most (it uses ctools so I should be able to answer shortly).

btmash’s picture

Hmm...there seems to be some other strange behavior now (this likely makes sense as another issue) - the image preset goes to a different file correctly; however, if there are changes to the file configuration, they do not get 'sensed' correctly and will create a new image effect (so you have to into your config and change it back as needed). Its a small issue, however and not exactly related. Back to more testing.

btmash’s picture

Status: Reviewed & tested by the community » Needs work

Unfortunately, the issue still comes up for ctools exportable plugins. It seems to be that the 'default file' is what the exportable goes by. But if a module exports all of the hooks to the same file, then that would bring up the same wipe issue. Looking at my set of modules that have ctools exportables, display suite puts its exportables into a file named ds.inc. And panels would put its page_manager exportables into a file called pages_default.inc. I'm wondering if we could change line 372 of configuration.ctools.inc from

if (file_exists('config://' . $info[$component]['default_filename'] . '.inc')) {

to

if (file_exists('config://' . $info[$component]['default_filename'] . '.' . $component . '.inc')) {

It would guarantee each component/function is then its own file.

lucascaro’s picture

Thanks @BTMash I think that's what we need to move this issue forward. I wonder how all these changes would work with the rest of the api like configuration_download_diff() and configuration_write_exports(), etc. In theory it should be ok, right?

dagmar’s picture

Could we split this into two issues? To properly test CTools integration we should write a custom test module.

lucascaro’s picture

I think that, since configuration.ctools.inc is part of the configuration module (that is, we provide integration with ctools in configuration) the integration tests for ctools belong in the configuration module (it's just like the support for image styles).

dagmar’s picture

Yes, but I mean, CTools will not be tested by the bot unless you add Ctools as a dependency of configuration management module.

GDrupal’s picture

@dagmar you can add it as a dependency for a configuration test module... take a look how features implements that.

GDrupal’s picture

Assigned: dagmar » GDrupal
GDrupal’s picture

StatusFileSize
new4.45 KB

Original patch re-rolled and tested... @btsmash issue still pending... i'm on it that will take a while.

GDrupal’s picture

Status: Needs work » Needs review
GDrupal’s picture

Status: Needs review » Reviewed & tested by the community
GDrupal’s picture

Status: Reviewed & tested by the community » Needs work
lucascaro’s picture

Committed the partial patch from #17.
We still need to deal with #10 so setting to needs work.

lucascaro’s picture

StatusFileSize
new769 bytes

Thanks to this patch we don't need this exception anymore for the tests:
In ConfigurationTrackingTest::testTracking

 $types = array(
      'field',
      'filter',
      'image',
      'node',
      'user_permission',
      'user_role',
      'taxonomy',
    );
    foreach ($types as $type) {
      $this->assertRaw(t('Tracking configurations for %type have been saved', array('%type' => $type)));
      if (!in_array($type, array('node', 'image'))) {
        $this->assertRaw(t('Wrote %type to filesystem', array('%type' => 'configuration.' . $type . '.inc')));
      }
    }

changed to:

       $types = array(
      'field',
      'filter',
      'image',
      'node',
      'user_permission',
      'user_role',
      'taxonomy',
    );
    foreach ($types as $type) {
      $this->assertRaw(t('Tracking configurations for %type have been saved', array('%type' => $type)));
      $this->assertRaw(t('Wrote %type to filesystem', array('%type' => 'configuration.' . $type . '.inc')));
    }
lucascaro’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, configuration-tests-1538502-22.patch, failed testing.

lucascaro’s picture

it failed because I had already committed the patch so it's not applicable....
(here's the test result for the commit: http://qa.drupal.org/pifr/test/219688).

Leaving as needs work so we add support for ctools for this issue.

GDrupal’s picture

Status: Needs work » Needs review
StatusFileSize
new23.54 KB

This patch provides support for ctools to avoid the issue on http://drupal.org/node/1538502#comment-6270296
It includes a test for views for checking the correct behavior. From this issue i'm noticed that a bigger re-factory is needed so this patch only fix the issue and I'm creating another post for tracking the re-factory.

dagmar’s picture

Status: Needs review » Needs work
+++ b/configuration.moduleundefined
@@ -1095,36 +1095,39 @@ function configuration_hook_info() {
-  $status = $config[$component][$identifier]['status'];
+  (int) $status = $config[$component][$identifier]['status'];

Why?

+++ b/configuration.moduleundefined
@@ -1095,36 +1095,39 @@ function configuration_hook_info() {
-  $status |= ($from_activestore) ? CONFIGURATION_ACTIVESTORE_OVERRIDDEN : CONFIGURATION_DATASTORE_OVERRIDDEN;
+  $status |= ( $from_activestore) ? CONFIGURATION_ACTIVESTORE_OVERRIDDEN : CONFIGURATION_DATASTORE_OVERRIDDEN;

The original line is the correct one.

The rest looks good.

GDrupal’s picture

Status: Needs work » Needs review
StatusFileSize
new23.45 KB
+++ b/configuration.moduleundefined
@@ -1095,36 +1095,39 @@ function configuration_hook_info() {
-  $status = $config[$component][$identifier]['status'];
+  (int) $status = $config[$component][$identifier]['status'];

It was added it in the debugging process, I was getting strange values for $status... and since $config[$component][$identifier]['status'] comes as string and we are doing bit operations. Anyway this will be re-factored in a next patch now that is working.

+++ b/configuration.moduleundefined
@@ -1095,36 +1095,39 @@ function configuration_hook_info() {
-  $status |= ($from_activestore) ? CONFIGURATION_ACTIVESTORE_OVERRIDDEN : CONFIGURATION_DATASTORE_OVERRIDDEN;
+  $status |= ( $from_activestore) ? CONFIGURATION_ACTIVESTORE_OVERRIDDEN : CONFIGURATION_DATASTORE_OVERRIDDEN;

Sorry about this.. i can't remember how many times i changed this line to make this work :P

dagmar’s picture

Status: Needs review » Reviewed & tested by the community

Tested with Views and Display Suite. It seems to be working fine.

lucascaro’s picture

Status: Reviewed & tested by the community » Fixed

committed, thanks guys. I think we can close this issue and start a fresh new one for any changes :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.