lib/tasks/zena.rake in zena-1.2.1 vs lib/tasks/zena.rake in zena-1.2.2
- old
+ new
@@ -17,11 +17,11 @@
# FIXME: how do we keep favicon.ico and robots.txt in the root dir of a site ?
# FIXME: ln should be to 'current' release, not calendar -> /var/zena/releases/20070511195642/public/calendar
# we could create a symlink in the sites dir to 'shared' -> /var/zena/current/public
# and then symlink with "#{host_path}/public/#{dir}" -> "../shared/public/#{dir}"
# OR we could symlink /var/zena/current/...
- ['calendar', 'images', 'javascripts', 'stylesheets'].each do |dir|
+ ['static', 'calendar', 'images', 'javascripts', 'stylesheets'].each do |dir|
File.unlink("#{to}/public/#{dir}") if File.symlink?("#{to}/public/#{dir}")
if File.exist?("#{to}/public/#{dir}")
if File.directory?("#{to}/public/#{dir}")
# replace each file
Dir.foreach("#{from}/public/#{dir}") do |f|
@@ -353,26 +353,30 @@
end
end
desc 'Rebuild index for all sites or site defined by HOST param.'
task :rebuild_index => :environment do
+ # Make sure all bricks are loaded before executing the index rebuild
+ Zena::Use.upgrade_class('Site')
+
include Zena::Acts::Secure
if ENV['HOST']
sites = [Site.find_by_host(ENV['HOST'])]
else
sites = Site.all
end
+
sites.each do |site|
+ Thread.current[:visitor] = site.any_admin
+
if ENV['WORKER'] == 'false' || RAILS_ENV == 'test'
# We avoid SiteWorker by passing nodes.
- Thread.current[:visitor] = site.any_admin
nodes = Node.find(:all,
:conditions => ['site_id = ?', site.id]
)
site.rebuild_index(secure_result(nodes))
else
# We try to use the site worker.
- Thread.current[:visitor] = site.any_admin
site.rebuild_index
end
end
end