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

Method get_database_size

class/databaseModel/base.py:113–140  ·  view source on GitHub ↗

获取数据库大小

(self, ids, is_pid=False)

Source from the content-addressed store, hash-verified

111 return limit_size
112
113 def get_database_size(self, ids, is_pid=False):
114 """
115 获取数据库大小
116 """
117 result = {}
118 p = self.get_databaseModel()
119 for id in ids:
120 if not is_pid:
121 x = public.M('databases').where('id=?', id).field('id,sid,pid,name,type,ps,addtime').find()
122 else:
123 x = public.M('databases').where('pid=?', id).field('id,sid,pid,name,type,ps,addtime').find()
124 if not x: continue
125 x['backup_count'] = public.M('backup').where("pid=? AND type=?", (x['id'], '1')).count()
126 if x['type'] == 'MySQL':
127 x['total'] = int(public.get_database_size_by_id(id))
128 else:
129 try:
130
131 get = public.dict_obj()
132 get['data'] = {'db_id': x['id']}
133 get['mod_name'] = x['type'].lower()
134 get['def_name'] = 'get_database_size_by_id'
135
136 x['total'] = p.model(get)
137 except:
138 x['total'] = 0
139 result[x['name']] = x
140 return result
141
142 def check_base_del_data(self, get):
143 """

Callers 1

check_base_del_dataMethod · 0.95

Calls 8

get_databaseModelMethod · 0.95
findMethod · 0.45
fieldMethod · 0.45
whereMethod · 0.45
MMethod · 0.45
countMethod · 0.45
modelMethod · 0.45

Tested by

no test coverage detected