We need to delete the configuration file in the DataStore when a component is not tracked anymore... as well that update the tracked.inc file.

CommentFileSizeAuthor
#11 1822174.11.patch9.18 KBgdrupal
#9 1822174.9.patch9.17 KBgdrupal
#8 1822174.8.patch4.54 KBgdrupal

Comments

dragonwize’s picture

This should happen indirectly as when you stop tracking you have to export for that to take effect and export should delete the whole dir and export the current state of config.

gdrupal’s picture

So... You are saying that we do not have to delete a single configuration file when a component is not tacked anymore... so no need to update the tracked.inc file? Only when we force a "export all tracked configurations" scenario?

dragonwize’s picture

Correct because when you save the form to change what you are tracking, that is what writes the config out of the DB to files.

dagmar’s picture

Remember that now the UI is not the only way to use this module.

dragonwize’s picture

That doesn't matter because the UI and Drush should always be calling the same APIs to keep in sync. The point is that when tracking is changed then config is flushed and exported. That is the only way we can ever hope to make sure things are correct and not patched together.

lucascaro’s picture

After talking with @GDrupal I think I see the point here. When a configuration stops being tracked, right now, that never reflects on the datastore since:

  • There's no way to export the entire activestore to the datastore at once.
  • Said configuration disappears from the "tracked" UI which is the only way to write the activestore to the datastore.

So basically the datastore is never deleted and regenerated from scratch, and the only way to write to datastore is by selecting tracked configurations and click on "Write activestore to datastore".

The bug here is that wen we stop tracking a configuration, it's not updating the datastore to reflect that change and the configuration is still there (clicking on Synchronize configurations would bring it back on).

So basically what is being proposed here is that we should be updating the files (removing from the list of tracked configurations) when we stop tracking a configuration (when we check a configuration from admin/config/system/configuration and click on "Stop Tracking").

I think this is how it's intended to work and this is a bug that needs to be fixed.

@dragonwize, you said:

Correct because when you save the form to change what you are tracking, that is what writes the config out of the DB to files.

and

The point is that when tracking is changed then config is flushed and exported.

But that doesn't happen on 2.x and that's what this issue tries to fix.

I think we don't need to export everything every time we stop tracking something (it's not necessary anymore) and there might be some configurations we don't want to write to the datastore at that point, but we definitely need to update the datastore when we stop tracking a configuration (which the module is not doing now).

dragonwize’s picture

We do need to redo everything because just deleting one file is not sufficient and trying to figure out which files to delete is very complex.

For example: I start tracking 2 content types. Through the dependency system we find they are dependent on 5 fields so we are now tracking 7 things and those are written to files. If we stop tracking 1 of those content types and delete the content type file, which of the fields do we also delete? All that are attached to the content type? No. Let's say for argument here that the deleted content type had 2 unique fields to it and 1 shared field with the other content type. Deleting that shared field just because it was on the removed content type would be incorrect and cause data loss.

In the above example if you just re-exported the things we are tracking the system would automatically take care of itself. In a system like this, stability and reliability are extremely important and so anything we can do to remove unneeded complexity.

That is a very simple example with just a content type and field but it can get much deeper and complex than that. The only way we can absolutely know for sure that everything in the files is what they are suppose to be is by copying it out of the DB and putting it to files. Trying to make a master-master configuration where the DB and files are both needed to separately control what is and is not suppose to be there and try to merge together both ways gets extremely difficult and is a waste of code IMHO. I would rather see an architecture where the master is always the DB(activestore) because that is all the site cares about and uses so it is the most important.

gdrupal’s picture

Status: Active » Needs review
StatusFileSize
new4.54 KB

Work in progress...

gdrupal’s picture

StatusFileSize
new9.17 KB

This patch delete configuration files when stop tracking them as well that re-start tracking the other components to ensure consistence.

This patch also provides a static function to check for file permissions before deletion, creation or edition to cover the issue explained in http://drupal.org/node/1820076

Status: Needs review » Needs work

The last submitted patch, 1822174.9.patch, failed testing.

gdrupal’s picture

Status: Needs work » Needs review
StatusFileSize
new9.18 KB

This patch delete configuration files when stop tracking them as well that re-start tracking the other components to ensure consistence.

This patch also provides a static function to check for file permissions before deletion, creation or edition to cover the issue explained in http://drupal.org/node/1820076

gdrupal’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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