diff --git a/defaults/main.yml b/defaults/main.yml index 33fd487ad00775ab3fbe1595e1cb2839ef2c5dc9..8a623f708ed7264e5cc4b5e1102f5c15077ad984 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -24,6 +24,7 @@ drupal_post_deploy_tasks: - updatedb - config-import sync - dev-modules {{ (drupal.dev_mode|default(false))|ternary("on","off") }} + - php:eval "node_access_rebuild();" - sset system.maintenance_mode 0 - cache-rebuild diff --git a/tasks/install.yml b/tasks/install.yml index e3ccffa58f681fd3dc5d68450c666065f7d8a0d7..caf840fcb67061602225e4506ed7a14722592405 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -390,6 +390,7 @@ changed_when: no tags: - deploy + - reset-locale - name: Post Deploy Tasks include_tasks: deploy/post-tasks.yml @@ -398,3 +399,11 @@ loop_var: drupal_domain tags: - deploy + +- name: Reset Locale + include_tasks: reset-locale.yml + with_items: '{{ drupal.domains }}' + loop_control: + loop_var: drupal_domain + tags: + - reset-locale diff --git a/tasks/main.yml b/tasks/main.yml index 8aca847fc9fb0a416e17166918bc52eb7a1d9afe..bcbc06d8df195a955ec76de0ae4d5aafabaa67a3 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -36,6 +36,7 @@ - deploy - SetPermissions - mysql + - reset-locale - name: Install HAProxy redirects collector include_tasks: haproxy_redirects_collector.yml diff --git a/tasks/reset-locale.yml b/tasks/reset-locale.yml new file mode 100644 index 0000000000000000000000000000000000000000..009671095b9401d1ab0af93793dc63dcab716085 --- /dev/null +++ b/tasks/reset-locale.yml @@ -0,0 +1,41 @@ +--- +# file: roles/drupal/tasks/reset-locale.yml + +- block: + + - name: Set default facts + set_fact: + drushAlias: '@{{ drupal.id }}.{{ drupal_domain.shortname|default("default") }}' + drushAliasValidate: "'@{{ drupal.id }}.{{ drupal_domain.shortname|default('default') }}':" + - name: Set facts for Drush 8 + set_fact: + drushAlias: '@{{ inventory_hostname }}{{ drushSubkey }}.{{ drupal_domain.shortname|default("default") }}' + drushAliasValidate: '@{{ inventory_hostname }}{{ drushSubkey }}.{{ drupal_domain.shortname|default("default") }}' + when: drush_version_main|default('8') == '8' + + - name: Reset locale + shell: drush -y {{ drushAlias }} {{ item }} + args: + chdir: '{{ webRoot }}' + with_items: + - sql:query "truncate locales_location;" + - sql:query "truncate locales_source;" + - sql:query "truncate locales_target;" + - sql:query "truncate locale_file;" + - sql:query "delete from key_value where collection='locale.translation_status';" + - sdel locale.translation_last_checked + - locale:check + - locale:update + changed_when: no + when: drushAliasValidate in drush_aliases.stdout_lines + + - name: Import extra locale files + shell: drush -y {{ drushAlias }} locale:import {{ item.lang }} {{ item.file }} --type=custom --override=all + args: + chdir: '{{ webRoot }}' + with_items: '{{ drupal_domain.extra_locales|default([]) }}' + changed_when: no + when: drushAliasValidate in drush_aliases.stdout_lines + + tags: + - reset-locale