mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 04:19:26 +08:00
update
This commit is contained in:
@@ -72,6 +72,11 @@ def isAppleSystem():
|
||||
return False
|
||||
|
||||
|
||||
def deleteFile(file):
|
||||
if os.path.exists(file):
|
||||
os.remove(file)
|
||||
|
||||
|
||||
def isInstalledWeb():
|
||||
path = getServerDir() + '/openresty/nginx/sbin/nginx'
|
||||
if os.path.exists(path):
|
||||
|
||||
+17
-8
@@ -123,7 +123,8 @@ class site_api:
|
||||
def deleteApi(self):
|
||||
sid = request.form.get('id', '').encode('utf-8')
|
||||
webname = request.form.get('webname', '').encode('utf-8')
|
||||
return self.delete(sid, webname)
|
||||
path = request.form.get('path', '0').encode('utf-8')
|
||||
return self.delete(sid, webname, path)
|
||||
##### ----- end ----- ###
|
||||
|
||||
# 域名编码转换
|
||||
@@ -477,17 +478,25 @@ class site_api:
|
||||
public.restartWeb()
|
||||
return public.getJson(data)
|
||||
|
||||
def delete(self, sid, webname):
|
||||
|
||||
def deleteWSLogs(self, webname):
|
||||
assLogPath = public.getLogsDir() + '/' + webname + '.log'
|
||||
errLogPath = public.getLogsDir() + '/' + webname + '.error.log'
|
||||
confFile = self.setupPath + '/openresty/nginx/conf/vhost/' + webname + '.conf'
|
||||
if os.path.exists(confFile):
|
||||
os.remove(confFile)
|
||||
|
||||
rewriteFile = self.setupPath + '/openresty/nginx/conf/rewrite/' + webname + '.conf'
|
||||
if os.path.exists(rewriteFile):
|
||||
os.remove(rewriteFile)
|
||||
logs = [assLogPath, errLogPath, confFile, rewriteFile]
|
||||
for i in logs:
|
||||
public.deleteFile(i)
|
||||
|
||||
def delete(self, sid, webname, path):
|
||||
|
||||
self.deleteWSLogs(webname)
|
||||
|
||||
if path == '1':
|
||||
rootPath = public.getWwwDir() + '/' + webname
|
||||
public.execShell('rm -rf ' + rootPath)
|
||||
|
||||
public.M('sites').where("id=?", (sid,)).delete()
|
||||
public.restartWeb()
|
||||
return public.returnJson(True, '站点删除成功!')
|
||||
|
||||
def setEndDate(self, sid, edate):
|
||||
|
||||
Reference in New Issue
Block a user