From 12107376b63a90b06ef891b8a3eff6124ab24841 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 31 Dec 2014 16:41:47 +0800 Subject: [PATCH] fix for restarting server --- app/controllers/store_api_controller.rb | 12 +++++------- config/routes.rb | 1 + 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/controllers/store_api_controller.rb b/app/controllers/store_api_controller.rb index d693539..4bd74e8 100644 --- a/app/controllers/store_api_controller.rb +++ b/app/controllers/store_api_controller.rb @@ -32,7 +32,7 @@ class StoreApiController < ApplicationController render :json => response.to_json if response["success"] bundle_install - give_permissions(params[:module_key]) + # give_permissions(params[:module_key]) end end @@ -57,14 +57,12 @@ class StoreApiController < ApplicationController sleep 5 end - def give_permissions(key) - ma = ModuleApp.find_by_key(key) rescue nil - if !ma.nil? - ma.store_permission_granted = true - ma.save - end + def restart_server_after_install + %x(kill -s USR2 `cat tmp/pids/unicorn.pid`) + sleep 5 end + def download_template(url,name) dir = File.join(Rails.root,"public","template_cache") destination = File.join(Rails.root,"app","templates","#{Site.first.template}","modules") diff --git a/config/routes.rb b/config/routes.rb index e413d1c..73d5b9f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -30,6 +30,7 @@ Orbit::Application.routes.draw do post "/store/confirmation" => "store_api#confirmation" post "/store/install_module" => "store_api#install_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. # See how all your routes lay out with "rake routes".