fix some error

This commit is contained in:
chiu 2020-02-20 16:18:43 +08:00
parent 702aa493c8
commit ae2735fb5f
3 changed files with 16 additions and 9 deletions

View File

@ -1,5 +1,5 @@
source 'https://rubygems.org'
#complete!!!!!!!!
#complete2!!!!!!!!
#social gems
gem "omniauth-google-oauth2"
@ -51,7 +51,7 @@ gem 'impressionist', '~> 1.5.2'
gem 'chartkick', '~> 2.3.5'
gem 'usagewatch_ext'
gem 'ckeditor', '~> 4.2.4'
gem 'unicorn', '~> 5.4.1'
gem 'unicorn', '~> 5.4.0'
gem 'zhconv'
gem 'time_difference'
gem 'execjs'

View File

@ -134,7 +134,16 @@ class Admin::SitesController < OrbitAdminController
end
def get_update_history
@update_log = %x{git log --pretty=format:"%H','%ad','%s" --date=short}.split("\n").map{|log| log.gsub("'","").split(",")}.to_json
update_log = %x{git log --pretty=format:"%H','%ad','%s" --date=short}.split("\n")
emergency_log = %x{git reflog --pretty=format:"%H','%ad','%s" --date=short}.split("\n")
@update_log = update_log.collect do |v|
if v.include? 'complete_update_'
tmp = emergency_log.select{|v1| v1.exclude?('complete_update_') && v1.include?(v.split(/complete_update_/)[-1])}[0] rescue []
[v,tmp]
else
v
end
end.flatten.map{|log| log.gsub("'","").split(",")}.to_json
render :json => @update_log
end
@ -165,7 +174,7 @@ class Admin::SitesController < OrbitAdminController
"#{git} add -f '#{v}'"
end.join(' && ')
time_now = Time.now.strftime('%Y_%m_%d_%H_%M')
Bundler.with_clean_env{system("#{git_add_except_public} && #{git} commit -m auto_backup_before_#{type}_#{time_now} && #{git} reset #{commit} --mixed && #{git_add_all_program} && #{git} reset #{commit} --merge && #{git} commit -m complete_#{type}_#{time_now}")}
Bundler.with_clean_env{system("#{git_add_except_public} && #{git} commit -m auto_backup_before_#{type}_#{time_now} && #{git} reset #{commit} --mixed && #{git_add_all_program} && #{git} reset #{commit} --merge && #{git_add_except_public}&& #{git} commit -m complete_#{type}_#{time_now}")}
mul.update_attributes(status: 'finish')
end
end
@ -196,8 +205,8 @@ class Admin::SitesController < OrbitAdminController
def restart_server
mode = Rails.env
unicorn_rails = %x[which unicorn_rails].sub("\n",'')
Bundler.with_clean_env{system("kill -s TERM `cat tmp/pids/unicorn.pid` && unset UNICORN_FD && sleep 1 && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}")}
render :nothing => true
Bundler.with_clean_env{system("kill -s TERM `cat tmp/pids/unicorn.pid` && unset UNICORN_FD && sleep 1 && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}")}
end
private

View File

@ -273,10 +273,8 @@
$.get("<%= admin_site_update_orbit_path %>",{type: type,id: id},function(result){
if (result=='finish'){
$("#progress_msg").html("<strong><%= t("update_manager_.restart_server") %></strong>");
$.get("<%= admin_site_restart_server_path %>",function(result){
$("#update_progress").fadeOut(function(){$("#update_done").fadeIn();});
$("#update_status").fadeIn();
get_update_history();
$.get("<%= admin_site_restart_server_path %>").always(function(){
setTimeout(function(){window.location.href="<%= admin_site_update_manager_path %>"},5000)
});
}else if(result=='waiting'){
$("#progress_msg").html("<strong><%= t("update_manager_.restart_server") %></strong>");