Files
MarketGrid/xyzserver/deploy/bt_addsite.py
T

31 lines
899 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 用宝塔自己的接口新建网站,使其出现在面板的网站列表里。
# 用法:/www/server/panel/pyenv/bin/python3 bt_addsite.py <域名> <网站根目录>
import json
import os
import sys
os.chdir("/www/server/panel")
sys.path.insert(0, "/www/server/panel/class")
import public # noqa: E402
import panelSite # noqa: E402
domain, root = sys.argv[1], sys.argv[2]
get = public.dict_obj()
get.webname = json.dumps({"domain": domain, "domainlist": [], "count": 0})
get.path = root
get.type_id = "0"
get.type = "PHP"
get.version = "00"
get.port = "80"
get.ps = "XYZ 图层使用人数统计(xyzserver)"
get.ftp = "false"
get.sql = "false"
get.codeing = "utf8mb4"
res = panelSite.panelSite().AddSite(get)
print(json.dumps(res, ensure_ascii=False, default=str))
ok = isinstance(res, dict) and (res.get("siteStatus") is True or res.get("status") is True)
sys.exit(0 if ok else 1)