Problem/Motivation
The 1.2 release added the ability to create multiple containers. Along with this, a 'uri' setting was added as the location for the snippet files. Previously this was hard-coded as 'public://google_tag'.
The first step taken when the snippet files are recreated (on cron or cache rebuild) is to recursively delete the uri directory. Apparently user error can occur and set this uri to a value that has unintended negative consequences during such a recursive delete.
Proposed resolution
Change the uri setting to be the parent directory for the snippet directory instead of the snippet directory. The snippet directory will always end in 'google_tag'. The default uri will become 'public:/' and the default snippet directory 'public://google_tag'.
This change will ensure the recursive directory cleanup is limited to the snippet directory.
Add a 'flush_snippets' setting to indicate whether to recreate the snippet directory, with a default value of FALSE. If set to FALSE, then it is up to the user to prune the snippet directory of any deprecated snippets.
Remaining tasks
Review, test, update the uri setting description in user interface.
User interface changes
None other than the description of the uri setting.
API changes
None.
Data model changes
None.
Release notes snippet
Need to add.
Comments
Comment #3
solotandem commentedComment #4
solotandem commentedThe commit implements the proposed resolution.
Comment #7
bceyssensBe careful when updating to 1.3. Code in 66f82ce just removed the entire public folder in our development environment.
Every developer uses a seperate codebase but we are all using a single shared database (in the cloud). I updated to version 1.3 and executed update_8103. My colleague cleared his caches (still using version 1.2 of the module), which will execute:
\Drupal::config('google_tag.settings')->get('uri') after update now contains "public:/", which will remove the public folder.