Files
Jack ed55fa708d Update to 7.7.0
Since version 7.7.0, we recommend yours update python to 3.12.

[+] Using nginx technology to load static files improves access speed
[+] Refactor homepage, website, FTP, and database using vue3
[+] Table loading changed to skeleton screen
[+] Add Website statistics-v2 professional plug-in
[+] Add Home page - top 5 resource occupancy
[+] Add protection for Files management (requires Tamper-proof for Enterprise 3.7)
[+] Website, FTP, Databases page add program status
[+] Add FTP log analysis (only supports Centos)
[+] Add password-free login to phpMyAdmin
[+] Add Proxy Project in Website (Supported when web service uses Nginx)
[+] Add WP Toolkit (Pro version only)
[+] Redesigned Docker module
[+] Add WP Toolkit Protection
[+] Add WP Toolkit Backup and Restore
[+] Add WP Toolkit Migrated
[+] Add WP Toolkit Clone site (supports new domain and subdomain)
[+] Add WP Toolkit Create site from backup of other panel
[+] Add WP Toolkit support for Cron automatic backup (only save Local disk)
[+] Add WP Toolkit operation log
[+] Add Integrity check for WP Toolkit
[+] Add WP Toolkit plug-in management and themes management

[*] Optimize phpMyAdmin formula access method
[*] Optimize Home page PHP display problem
[*] Optimize jump to the login interface after the login expires
[*] Optimize automatic renewal of SSL at some times
[*] Optimize Let's Encrypt to increase application success rate

[-] Fix Logs Audit cannot be opened
[-] Fix apache URL rewrite issue
[-] Fix phpmyadmin installation problem
[-] Fix the problem that some servers cannot install software
[-] Fix upload file error
[-] Fix left menu hiding problem
[-] Fix aaPanel Mobile QR code display problem
[-] Fix problem that third-party plug-ins are not displayed in the App Store
[-] Fix issue where the menu bar is blank when opening new tabs
[-] Fixed panel not being accessible in some cases
[-] Fix the issue where Curl warning caused the inability to apply for SSL
[-] Fix Quota issues for Website, FTP, Databases
[-] Fix file interface display problem on mobile terminal
2024-07-19 11:25:10 +08:00

117 lines
3.7 KiB
Python

#!/usr/bin/env python
#coding:utf-8
# +-------------------------------------------------------------------
# | aaPanel
# +-------------------------------------------------------------------
# | Copyright (c) 2015-2017 aaPanel(www.aapanel.com) All rights reserved.
# +-------------------------------------------------------------------
# | Author: hwliang <hwl@aapanel.com>
# +-------------------------------------------------------------------
#------------------------------
# Tomcat管理类
#------------------------------
from xml.etree.ElementTree import ElementTree,Element
import os
class tomcat:
__TREE = None
__ENGINE = None
__ROOT = None
__CONF_FILE = '/www/server/tomcat/conf/server.xml';
#打开配置文件
def __init__(self):
if self.__TREE: return;
self.__TREE = ElementTree();
self.__TREE.parse(self.__CONF_FILE);
self.__ROOT = self.__TREE.getroot();
self.__ENGINE = self.__TREE.findall('Service/Engine')[0];
#获取虚拟主机列表
def GetVhosts(self):
try:
Hosts = self.__ENGINE.getchildren()
except:
Hosts = list(self.__ENGINE)
data = []
for host in Hosts:
if host.tag != 'Host': continue;
tmp = host.attrib
ch = host.getchildren();
tmp['item'] = {}
for c in ch:
tmp['item'][c.tag] = c.attrib;
data.append(tmp);
return data;
#添加虚拟主机
def AddVhost(self,path,domain):
if self.GetVhost(domain): return False;
if not os.path.exists(path): return False;
attr = {"autoDeploy":"true","name":domain,"unpackWARs":"true","xmlNamespaceAware":"false","xmlValidation":"false"}
Host = Element("Host", attr);
attr = {"docBase":path,"path":"","reloadable":"true","crossContext":"true",}
Context = Element("Context", attr);
Host.append(Context);
self.__ENGINE.append(Host);
self.Save();
return True;
#删除虚拟主机
def DelVhost(self,name):
host = self.GetVhost(name);
if not host: return False
self.__ENGINE.remove(host);
self.Save();
return True;
#获取指定虚拟主机
def GetVhost(self,name):
try:
Hosts = self.__ENGINE.getchildren()
except:
Hosts = list(self.__ENGINE)
for host in Hosts:
if host.tag != 'Host': continue;
if host.attrib['name'] == name:
return host
return None;
#修改根目录
def SetPath(self,name,path):
if not os.path.exists(path): return False;
host = self.GetVhost(name);
if not host: return False
#host.attrib['appBase'] = path;
host.getchildren()[0].attrib['docBase'] = path;
self.Save();
return True;
#修改虚拟主机属性
def SetVhost(self,name,key,value):
host = self.GetVhost(name);
if not host: return False
host.attrib[key] = value;
self.Save();
return True
#保存配置
def Save(self):
self.format(self.__ROOT);
self.__TREE.write(self.__CONF_FILE,'utf-8');
#整理配置文件格式
def format(self,em,level = 0):
i = "\n" + level*" "
if len(em):
if not em.text or not em.text.strip():
em.text = i + " "
for e in em:
self.format(e, level+1)
if not e.tail or not e.tail.strip():
e.tail = i
if level and (not em.tail or not em.tail.strip()):
em.tail = i
if __name__ == '__main__':
tom = tomcat();
print(tom.DelVhost('w1.hao.com'));