Skip to content

Instantly share code, notes, and snippets.

@Thijzer
Created September 3, 2014 14:41
Show Gist options
  • Save Thijzer/166c8bc9d9a94e570e3b to your computer and use it in GitHub Desktop.
Save Thijzer/166c8bc9d9a94e570e3b to your computer and use it in GitHub Desktop.
##
# Opcache recipe
# => convenience rules for dealing with opcode cache in PHP5.5+ applications using opcache (Zend Optimizer+)
##
_cset(:opcache_webroot) { "" }
namespace :opcache do
desc <<-DESC
Create a temporary PHP file to clear cache, call it (using curl) and removes it
This task must be triggered AFTER the deployment to clear cache
DESC
task :clear_cache, :roles => :app do
opcache_file = "#{current_release}#{opcache_webroot}/opcache_clear.php"
curl_options = "-s"
if !http_auth_users.to_a.empty? then
curl_options = curl_options + " --user " + http_auth_users[0][0] + ":" + http_auth_users[0][1]
end
put "<?php opcache_reset(); ?>", opcache_file, :mode => 0644
run "curl #{curl_options} #{url_base}/opcache_clear.php && rm -f #{opcache_file}"
end
end
@Thijzer
Copy link
Author

Thijzer commented Sep 3, 2014

removes symlink + capistrona and php 5.5 + opcache issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment