diff --git a/app/controllers/admin/site_panel_controller.rb b/app/controllers/admin/site_panel_controller.rb index ee902ce..9fb1331 100644 --- a/app/controllers/admin/site_panel_controller.rb +++ b/app/controllers/admin/site_panel_controller.rb @@ -317,6 +317,7 @@ class Admin::SitePanelController < OrbitAdminController db_name = site_construct.db_name path = site_construct.path site_construct_id = params[:id] + site_construct.update(:status => "creating") if site_construct.copy_id Thread.new do system("bundle exec rake create_site:copy_site['#{ip}','#{server_port}','#{user}','#{password}','#{site_name}','#{domain_name}','#{port}','#{db_name}','#{path}','#{site_construct_id}','#{site_construct.copy_id}',#{site_construct.only_copy_installed_module}]") @@ -331,6 +332,8 @@ class Admin::SitePanelController < OrbitAdminController def edit_site case params[:type] when 'delete' + @site_construct = SiteConstruct.find(params[:id]) + @site_construct.update(:status => "deleting") Thread.new do system("bundle exec rake create_site:delete_site[#{params[:id]}]") end diff --git a/app/views/admin/site_panel/_sites_list_table.html.erb b/app/views/admin/site_panel/_sites_list_table.html.erb index 3f0e6c6..ceb06de 100644 --- a/app/views/admin/site_panel/_sites_list_table.html.erb +++ b/app/views/admin/site_panel/_sites_list_table.html.erb @@ -226,12 +226,8 @@ ""); }else{ $("#info_texts").html("Do you really want to "+_this.attr('title')+"."); - if($('#confirm_input').length == 0){ - $('#info_texts').after("\" style=\"width: 17em;\">"); - }else{ - $('#confirm_input').css('display','block'); - $('#confirm_input').val(''); - } + $('#confirm_input').remove(); + $('#info_texts').after("\" style=\"width: 17em;\">"); } $( "#dialog-confirm" ).dialog({ resizable: true, @@ -285,12 +281,8 @@ ""); }else{ $("#info_texts").html("Do you really want to "+$(this).attr('title')+"."); - if($('#confirm_input').length == 0){ - $('#info_texts').after("\" style=\"width: 17em;\">"); - }else{ - $('#confirm_input').css('display','block'); - $('#confirm_input').val(''); - } + $('#confirm_input').remove(); + $('#info_texts').after("\" style=\"width: 17em;\">"); } $( "#dialog-confirm" ).dialog({ resizable: true, diff --git a/lib/tasks/copy_site.rake b/lib/tasks/copy_site.rake index 44b8815..0437460 100644 --- a/lib/tasks/copy_site.rake +++ b/lib/tasks/copy_site.rake @@ -48,9 +48,8 @@ namespace :create_site do extra_exclude_path = ",public/uploads/" end server = SiteServer.where(:server_name => template_site.server_type).first - update_infos("Copying site's files for #{args.site_name}!") - ls_out = exec_ssh_command_for_copy(ssh, "ls #{@site_construct.full_site_path}/app", false).join("\n") - if ls_out.include?("No such") || org_creating + ls_out = exec_ssh_command_for_copy(ssh, "if [ ! -d \"#{@site_construct.full_site_path}/app\" ]; then echo 'No such file or directory: #{@site_construct.full_site_path}/app'; fi", false).join("\n") + if ls_out.include?("No such file or directory") || org_creating if @site_construct.server_type == template_site.server_type exec_ssh_command_for_copy(ssh,"rsync -ar --info=progress2 --no-inc-recursive --delete --exclude={tmp/cache/,tmp/unicorn.sock,tmp/pids/*#{extra_exclude_path}} #{template_site.path}/#{template_site.get_site_name}/ #{args.path}/#{@site_construct.get_site_name}/",true) else @@ -141,9 +140,12 @@ namespace :create_site do end def exec_ssh_command_for_copy(session,command,update_outputs=false) outputs = [] + if update_outputs + update_infos_for_exec("") + end session.open_channel do |channel| channel.request_pty do |channel, success| - channel.exec("LANG=en.UTF8 #{command}") do |ch, success| + channel.exec("LANG=en.UTF8 && #{command}") do |ch, success| abort "could not execute command: #{command}" unless success channel.on_data do |ch, data| data_str = data.to_s diff --git a/lib/tasks/create_site.rake b/lib/tasks/create_site.rake index 8314eda..2a58fd6 100644 --- a/lib/tasks/create_site.rake +++ b/lib/tasks/create_site.rake @@ -110,9 +110,12 @@ namespace :create_site do end def exec_ssh_command_for_create(session,command,update_outputs=false) outputs = [] + if update_outputs + update_infos_for_exec("") + end session.open_channel do |channel| channel.request_pty do |channel, success| - channel.exec("LANG=en.UTF8 #{command}") do |ch, success| + channel.exec("LANG=en.UTF8 && #{command}") do |ch, success| abort "could not execute command: #{command}" unless success channel.on_data do |ch, data| data_str = data.to_s