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

Method get_list

class/databaseModel/sqliteModel.py:25–54  ·  view source on GitHub ↗

@name 获取数据库列表 @param args['path'] 数据库文件路径 @return list

(self,args)

Source from the content-addressed store, hash-verified

23 db_file = '{}/data/db_model.json'.format(public.get_panel_path())
24
25 def get_list(self,args):
26 """
27 @name 获取数据库列表
28 @param args['path'] 数据库文件路径
29 @return list
30 """
31 result = []
32 data = self.get_database_list()
33 for sfile in data:
34 info = {}
35
36 info['name'] = os.path.basename(sfile)
37 if 'name' in data[sfile]:
38 info['name'] = data[sfile]['name']
39
40 info['path'] = sfile
41 if os.path.exists(sfile):
42 info['size'] = os.path.getsize(sfile)
43 info['st_time'] = int(os.path.getmtime(sfile))
44 info['backup_count'] = 0
45 try:
46 get = public.dict_obj()
47 get.path = sfile
48 nlist = self.get_backup_list(get)
49 info['backup_count'] = len(nlist)
50 except:pass
51
52 result.append(info)
53
54 return result
55
56 def AddDatabase(self,args):
57

Callers

nothing calls this directly

Calls 5

get_database_listMethod · 0.95
get_backup_listMethod · 0.95
basenameMethod · 0.80
existsMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected