MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / save_installed_msg

Method save_installed_msg

task.py:2009–2035  ·  view source on GitHub ↗
(task_data: dict)

Source from the content-addressed store, hash-verified

2007
2008 @staticmethod
2009 def save_installed_msg(task_data: dict):
2010 msg_path = "{}/data/msg_box_data".format(PANEL_PATH)
2011 try:
2012 msg_list = [i for i in os.listdir(msg_path) if i not in ("not_read.tip", "update.pl")]
2013 for msg_name in msg_list:
2014 msg_file = "{}/{}".format(msg_path, msg_name)
2015 try:
2016 with open(msg_file, "r") as f:
2017 msg: dict = json.load(f)
2018 if msg["sub"]["task_id"] == task_data["id"]:
2019 task_data["msg_name"] = msg_name
2020 else:
2021 continue
2022
2023 msg["title"] = "正在" + msg["title"][2:]
2024 msg["sub"]["file_name"] = "/tmp/panelExec.log"
2025 msg["sub"]["install_status"] = "正在" + msg["sub"]["install_status"][2:]
2026 msg["sub"]["status"] = 1
2027 msg["read"] = False
2028 msg["read_time"] = 0
2029 with open(msg_file, "w") as f:
2030 json.dump(msg, f)
2031 except:
2032 continue
2033 except:
2034 err_log = traceback.format_exc()
2035 write_log(err_log, _level="error", color="")
2036
2037 @staticmethod
2038 def update_installed_msg(task_data: dict):

Callers 1

do_oneMethod · 0.95

Calls 6

openFunction · 0.85
listdirMethod · 0.80
write_logFunction · 0.70
formatMethod · 0.45
loadMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected