Created
September 3, 2014 14:41
-
-
Save Thijzer/166c8bc9d9a94e570e3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
removes symlink + capistrona and php 5.5 + opcache issues