|
|
@ -211,7 +211,9 @@ class sites(object): |
|
|
|
mw.restartWeb() |
|
|
|
mw.restartWeb() |
|
|
|
return mw.returnData(True, '添加成功') |
|
|
|
return mw.returnData(True, '添加成功') |
|
|
|
|
|
|
|
|
|
|
|
def stop(self, site_id, site_name): |
|
|
|
def stop(self, site_id): |
|
|
|
|
|
|
|
site_info = thisdb.getSitesById(site_id) |
|
|
|
|
|
|
|
|
|
|
|
path = self.setupPath + '/stop' |
|
|
|
path = self.setupPath + '/stop' |
|
|
|
if not os.path.exists(path): |
|
|
|
if not os.path.exists(path): |
|
|
|
os.makedirs(path) |
|
|
|
os.makedirs(path) |
|
|
@ -225,27 +227,26 @@ class sites(object): |
|
|
|
mw.execShell('mkdir -p ' + bpath) |
|
|
|
mw.execShell('mkdir -p ' + bpath) |
|
|
|
mw.execShell('ln -sf ' + path +'/index.html ' + bpath + '/index.html') |
|
|
|
mw.execShell('ln -sf ' + path +'/index.html ' + bpath + '/index.html') |
|
|
|
|
|
|
|
|
|
|
|
site_info = thisdb.getSitesById(site_id) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# nginx |
|
|
|
# nginx |
|
|
|
file = self.getHostConf(site_name) |
|
|
|
file = self.getHostConf(site_info['name']) |
|
|
|
conf = mw.readFile(file) |
|
|
|
conf = mw.readFile(file) |
|
|
|
if conf: |
|
|
|
if conf: |
|
|
|
conf = conf.replace(site_info['path'], path) |
|
|
|
conf = conf.replace(site_info['path'], path) |
|
|
|
mw.writeFile(file, conf) |
|
|
|
mw.writeFile(file, conf) |
|
|
|
|
|
|
|
|
|
|
|
thisdb.setSitesData(site_id, status='0') |
|
|
|
thisdb.setSitesData(site_id, status='0') |
|
|
|
msg = mw.getInfo('网站[{1}]已被停用!', (site_name,)) |
|
|
|
msg = mw.getInfo('网站[{1}]已被停用!', (site_info['name'],)) |
|
|
|
mw.writeLog('网站管理', msg) |
|
|
|
mw.writeLog('网站管理', msg) |
|
|
|
mw.restartWeb() |
|
|
|
mw.restartWeb() |
|
|
|
return mw.returnData(True, '站点已停用!') |
|
|
|
return mw.returnData(True, '站点已停用!') |
|
|
|
|
|
|
|
|
|
|
|
def start(self, site_id, site_name): |
|
|
|
def start(self, site_id): |
|
|
|
path = self.setupPath + '/stop' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
site_info = thisdb.getSitesById(site_id) |
|
|
|
site_info = thisdb.getSitesById(site_id) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
path = self.setupPath + '/stop' |
|
|
|
# nginx |
|
|
|
# nginx |
|
|
|
file = self.getHostConf(site_name) |
|
|
|
file = self.getHostConf(site_info['name']) |
|
|
|
conf = mw.readFile(file) |
|
|
|
conf = mw.readFile(file) |
|
|
|
if conf: |
|
|
|
if conf: |
|
|
|
conf = conf.replace(path, site_info['path']) |
|
|
|
conf = conf.replace(path, site_info['path']) |
|
|
@ -253,7 +254,7 @@ class sites(object): |
|
|
|
|
|
|
|
|
|
|
|
thisdb.setSitesData(site_id, status='1') |
|
|
|
thisdb.setSitesData(site_id, status='1') |
|
|
|
|
|
|
|
|
|
|
|
msg = mw.getInfo('网站[{1}]已被启用!', (site_name,)) |
|
|
|
msg = mw.getInfo('网站[{1}]已被启用!', (site_info['name'],)) |
|
|
|
mw.writeLog('网站管理', msg) |
|
|
|
mw.writeLog('网站管理', msg) |
|
|
|
mw.restartWeb() |
|
|
|
mw.restartWeb() |
|
|
|
return mw.returnData(True, '站点已启用!') |
|
|
|
return mw.returnData(True, '站点已启用!') |
|
|
|