Permalink
Browse files

add use of flush option in doctrine:clear_* task

  • Loading branch information...
1 parent a70e94d commit 5a73699bbf6bba3e98bd43f0d8e78fef65ef59f9 ulrich committed Mar 10, 2013
Showing with 6 additions and 3 deletions.
  1. +3 −0 lib/capifony_symfony2.rb
  2. +3 −3 lib/symfony2/doctrine.rb
View
3 lib/capifony_symfony2.rb 100644 → 100755
@@ -114,6 +114,9 @@ def self.load_into(configuration)
# Doctrine custom entity manager
set :doctrine_em, false
+
+ # Use --flush option in doctrine:clear_* task
+ set :doctrine_clear_use_flush_option, false
# Symfony2 version
set(:symfony_version) { guess_symfony_version }
View
6 lib/symfony2/doctrine.rb 100644 → 100755
@@ -5,23 +5,23 @@
task :clear_metadata, :roles => :app, :except => { :no_release => true } do
capifony_pretty_print "--> Clearing Doctrine metadata cache"
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-metadata --env=#{symfony_env_prod}#{doctrine_em_flag}'"
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-metadata --env=#{symfony_env_prod}#{doctrine_em_flag}"+ if doctrine_clear_use_flush_option then " --flush" else "" end +"'"
capifony_puts_ok
end
desc "Clears all query cache for a entity manager"
task :clear_query, :roles => :app, :except => { :no_release => true } do
capifony_pretty_print "--> Clearing Doctrine query cache"
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-query --env=#{symfony_env_prod}#{doctrine_em_flag}'"
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-query --env=#{symfony_env_prod}#{doctrine_em_flag}"+ if doctrine_clear_use_flush_option then " --flush" else "" end +"'"
capifony_puts_ok
end
desc "Clears result cache for a entity manager"
task :clear_result, :roles => :app, :except => { :no_release => true } do
capifony_pretty_print "--> Clearing Doctrine result cache"
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-result --env=#{symfony_env_prod}#{doctrine_em_flag}'"
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:cache:clear-result --env=#{symfony_env_prod}#{doctrine_em_flag}"+ if doctrine_clear_use_flush_option then " --flush" else "" end +"'"
capifony_puts_ok
end
end

0 comments on commit 5a73699

Please sign in to comment.