Skip to content

Commit

Permalink
Add handler to clear opcache
Browse files Browse the repository at this point in the history
This clears opcache via `drush eval` instead of restarting the webserver
or the php-fpm service.
  • Loading branch information
mglaman committed Apr 20, 2017
1 parent c426fcc commit ade84ff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: clear opcache
command: "{{ drush_path }} eval \"if (function_exists('apc_clear_cache')) {apc_clear_cache();}if (function_exists('opcache_reset')) {opcache_reset();}\""
args:
chdir: "{{ drupal_core_path }}"
2 changes: 1 addition & 1 deletion tasks/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
dest: "{{ drupal_deploy_dir }}"
accept_hostkey: "{{ drupal_deploy_accept_hostkey }}"
register: drupal_deploy_repo_updated
notify: restart webserver
notify: clear opcache
become: no

- name: Check if a composer.json file is present.
Expand Down
2 changes: 1 addition & 1 deletion tasks/install-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
{{ drupal_site_install_extra_args | default([]) | join(" ") }}
args:
chdir: "{{ drupal_core_path }}"
notify: restart webserver
notify: clear opcache
when: "'Successful' not in drupal_site_installed.stdout"
become: no

Expand Down

0 comments on commit ade84ff

Please sign in to comment.