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

solotandem created an issue. See original summary.

  • solotandem committed 66f82ce on 8.x-1.x
    Issue #3088579 Recharacterize the base uri setting as the parent uri...
solotandem’s picture

Issue summary: View changes
solotandem’s picture

Assigned: Unassigned » solotandem
Status: Active » Fixed

The commit implements the proposed resolution.

  • solotandem committed ffd57c8 on 8.x-1.x
    Issue #3088579 Recharacterize the base uri setting as the parent uri...

Status: Fixed » Closed (fixed)

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

bceyssens’s picture

Be 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:

$this->fileSystem->deleteRecursive(\Drupal::config('google_tag.settings')->get('uri'))

\Drupal::config('google_tag.settings')->get('uri') after update now contains "public:/", which will remove the public folder.