diff --git a/class/core/config_api.py b/class/core/config_api.py index e24e422f3..a6e425a39 100755 --- a/class/core/config_api.py +++ b/class/core/config_api.py @@ -58,6 +58,9 @@ class config_api: port = request.form.get('port', '') host_ip = request.form.get('host_ip', '') domain = request.form.get('domain', '') + sites_path = request.form.get('sites_path', '') + backup_path = request.form.get('backup_path', '') + if domain != '': reg = "^([\w\-\*]{1,100}\.){1,4}(\w{1,10}|\w{1,10}\.\w{1,10})$" if not re.match(reg, domain): @@ -69,6 +72,12 @@ class config_api: if webname != public.getConfig('title'): public.setConfig('title', webname) + if sites_path != public.getWwwDir(): + public.setWwwDir(sites_path) + + if backup_path != public.getWwwDir(): + public.setBackupDir(backup_path) + if port != public.getHostPort(): import system_api public.setHostPort(port) diff --git a/class/core/public.py b/class/core/public.py index 27f2d7ac4..78dba80c5 100755 --- a/class/core/public.py +++ b/class/core/public.py @@ -55,9 +55,17 @@ def getServerDir(): def getWwwDir(): + file = getRunDir() + '/data/site.pl' + if os.path.exists(file): + return readFile(file).strip() return getRootDir() + '/wwwroot' +def setWwwDir(wdir): + file = getRunDir() + '/data/site.pl' + return writeFile(file, wdir) + + def getLogsDir(): return getRootDir() + '/wwwlogs' @@ -66,6 +74,11 @@ def getBackupDir(): return getRootDir() + '/backup' +def setBackupDir(bdir): + file = getRunDir() + '/data/backup.pl' + return writeFile(file, wdir) + + def getOs(): return sys.platform diff --git a/data/site.pl b/data/site.pl new file mode 100644 index 000000000..220fce19d --- /dev/null +++ b/data/site.pl @@ -0,0 +1 @@ +/Users/midoks/Desktop/fwww/wwwroot \ No newline at end of file diff --git a/route/templates/default/config.html b/route/templates/default/config.html index 0dd4712cf..620349417 100755 --- a/route/templates/default/config.html +++ b/route/templates/default/config.html @@ -66,7 +66,7 @@

默认备份目录 - + 网站和数据库的备份目录!