Closed geerlingguy closed 7 years ago
I'd vote for just dropping the restart. I'd say the users requiring the opcache to clear is below the <20% use case and could just opt for a custom script and #34. Personally I do https://github.com/generoi/capistrano-tasks/blob/master/lib/capistrano/tasks/cache.rake#L42:L69
@oxyc +1 to that; and I don't think we need to block getting this fixed on #34 (though that one shouldn't be terribly difficult to fix either).
I'd say it's fine to drop the restart. Especially if we just document the issue, or do as suggested by @oxyc. Or instead of making a file, minify the line and pass to drush eval
to execute clearing it.
So
drush eval "if (function_exists('apc_clear_cache')) {apc_clear_cache();}if (function_exists('opcache_reset')) {opcache_reset();}"
Tested this locally and seemed to work okay.
Done! Thanks @mglaman
Currently this role calls the
restart webserver
handler in thegeerlingguy.php
role when a Drupal deployment is completed, but this role shouldn't, since that role is not a hard dependency.In the PHP role, the handlers defined are:
We could either define our own handler(s), or figure out whether it's strictly necessary or not. I think the reason I had that in there initially was for the Raspberry Pi-based setup I tested on—I had opcache configured to not stat files on every page load since the files were on slow microSD cards... for most servers (and by default), since opcache is looking at each file, we technically don't need a hard restart of php-fpm to pick up changed files.