diff --git a/class/core/mw.py b/class/core/mw.py
index a8950c4a6..02f516c57 100755
--- a/class/core/mw.py
+++ b/class/core/mw.py
@@ -499,6 +499,18 @@ def backFile(file, act=None):
execShell("cp -p {0} {1}".format(file, file + file_type))
+def removeBackFile(file, act=None):
+ """
+ @name 删除备份配置文件
+ @param file 需要删除备份文件
+ @param act 如果存在,则还原默认配置
+ """
+ file_type = "_bak"
+ if act:
+ file_type = "_def"
+ execShell("rm -rf {0}".format(file + file_type))
+
+
def restoreFile(file, act=None):
"""
@name 还原配置文件
diff --git a/class/core/site_api.py b/class/core/site_api.py
index 4a243a23d..9014bd52e 100755
--- a/class/core/site_api.py
+++ b/class/core/site_api.py
@@ -1118,6 +1118,26 @@ class site_api:
host = self.getHostConf(siteName)
return mw.getJson({'host': host})
+ def saveHostConfApi(self):
+ path = request.form.get('path', '')
+ data = request.form.get('data', '')
+ encoding = request.form.get('encoding', '')
+
+ import files_api
+
+ mw.backFile(path)
+ save_ret_data = files_api.files_api().saveBody(path, data, encoding)
+ rdata = json.loads(save_ret_data)
+
+ if rdata['status']:
+ isError = mw.checkWebConfig()
+ if isError != True:
+ mw.restoreFile(path)
+ return mw.returnJson(False, 'ERROR: 检测到配置文件有错误,请先排除后再操作
' + isError.replace("\n", '
') + '')
+ mw.restartWeb()
+ mw.removeBackFile(path)
+ return save_ret_data
+
def getRewriteConfApi(self):
siteName = request.form.get('siteName', '')
rewrite = self.getRewriteConf(siteName)
diff --git a/route/static/app/site.js b/route/static/app/site.js
index 3e0fe671b..7a2a3f004 100755
--- a/route/static/app/site.js
+++ b/route/static/app/site.js
@@ -2379,7 +2379,7 @@ function configFile(webSite){
function saveConfigFile(webSite,encoding,path){
var data = 'encoding='+encoding+'&data='+encodeURIComponent($("#configBody").val())+'&path='+path;
var loadT = layer.msg('保存中...',{icon:16,time:0,shade: [0.3, '#000']});
- $.post('/files/save_body',data,function(rdata){
+ $.post('/site/save_host_conf',data,function(rdata){
layer.close(loadT);
if(rdata.status){
layer.msg(rdata.msg,{icon:1});
diff --git a/scripts/install_dev.sh b/scripts/install_dev.sh
index de2574fc8..2287b794b 100755
--- a/scripts/install_dev.sh
+++ b/scripts/install_dev.sh
@@ -6,7 +6,7 @@ is64bit=`getconf LONG_BIT`
echo -e "您正在安装的是\033[31mmdserver-web测试版\033[0m,非开发测试用途请使用正式版 install.sh !"
echo -e "You are installing\033[31mmdserver-web dev version\033[0m, normally use install.sh for production.\n"
-sleep 2
+sleep 1
{