This commit is contained in:
邱博亞 2022-12-09 14:44:26 +08:00
parent e0b71cec6d
commit ace95e8b72
3 changed files with 10 additions and 2 deletions

View File

@ -7,6 +7,7 @@ en:
upload_cert: Upload Cert
cert_management: Cert Management
client_management:
get_template: "Get Template"
finished_reload_page: "Finished!\\nReload Page!"
apply_change: "Apply Change"
are_you_sure_to_delete: "Are you sure to delete?"

View File

@ -7,6 +7,7 @@ zh_tw:
upload_cert: 上傳憑證
cert_management: 憑證管理
client_management:
get_template: "獲取版型"
finished_reload_page: "已完成!\\n重新載入頁面!"
apply_change: "設定生效"
are_you_sure_to_delete: "您確定要刪除嗎?"

View File

@ -35,7 +35,9 @@ namespace :exec_commands do
@command_trans = {}
@command_relations = {"upgrade_site"=>'git fetch origin && rails runner "a=Admin::SitesController.new;a.git_reset(%w(origin)[0],%w(update)[0]);while(1) do (Multithread.where(key: %w(update_manager)[0],status: %w(finish)[0]).count!=0 ? break : nil) end;sleep(5)"',
"bundle_update"=>"bundle update && kill -s USR2 `cat tmp/pids/unicorn.pid`",
"restart_site"=>"kill -s TERM `fuser tmp/pids/unicorn.sock tmp/sockets/unicorn.sock tmp/unicorn.sock`;bundle exec unicorn_rails -c config/unicorn.rb -D -E {{rails_env}}"}
"restart_site"=>"kill -s TERM `fuser tmp/pids/unicorn.sock tmp/sockets/unicorn.sock tmp/unicorn.sock`;bundle exec unicorn_rails -c config/unicorn.rb -D -E {{rails_env}}",
"get_template"=>"mongo --eval 'db.sites.find().pretty()[0][\"template\"]' {{db_name}} --quiet"}
@preserve_output = ["get_template"]
@command_relations.each do |k,v|
@command_trans[k] = I18n.t("client_management.#{k}")
end
@ -137,7 +139,11 @@ namespace :exec_commands do
update_flag = 1
@command_relations.each do |k,v|
if command.include?("{{#{k}}}")
update_flag = 2 #Not logging commands result
if @preserve_output.include?(k)
update_flag = 1
else
update_flag = 2 #Not logging commands result
end
end
command = command.gsub("{{#{k}}}",v)
@command_i18n = @command_i18n.gsub("{{#{k}}}",@command_trans[k])