fix for restarting server

This commit is contained in:
Harry Bomrah 2014-12-31 16:41:47 +08:00
parent ceca2c58c0
commit 12107376b6
2 changed files with 6 additions and 7 deletions

View File

@ -32,7 +32,7 @@ class StoreApiController < ApplicationController
render :json => response.to_json render :json => response.to_json
if response["success"] if response["success"]
bundle_install bundle_install
give_permissions(params[:module_key]) # give_permissions(params[:module_key])
end end
end end
@ -57,14 +57,12 @@ class StoreApiController < ApplicationController
sleep 5 sleep 5
end end
def give_permissions(key) def restart_server_after_install
ma = ModuleApp.find_by_key(key) rescue nil %x(kill -s USR2 `cat tmp/pids/unicorn.pid`)
if !ma.nil? sleep 5
ma.store_permission_granted = true
ma.save
end
end end
def download_template(url,name) def download_template(url,name)
dir = File.join(Rails.root,"public","template_cache") dir = File.join(Rails.root,"public","template_cache")
destination = File.join(Rails.root,"app","templates","#{Site.first.template}","modules") destination = File.join(Rails.root,"app","templates","#{Site.first.template}","modules")

View File

@ -30,6 +30,7 @@ Orbit::Application.routes.draw do
post "/store/confirmation" => "store_api#confirmation" post "/store/confirmation" => "store_api#confirmation"
post "/store/install_module" => "store_api#install_module" post "/store/install_module" => "store_api#install_module"
post "/store/uninstall_module" => "store_api#uninstall_module" post "/store/uninstall_module" => "store_api#uninstall_module"
post "/store/restart_srever_after_install" => "store_api#restart_server_after_install"
# The priority is based upon order of creation: first created -> highest priority. # The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes". # See how all your routes lay out with "rake routes".