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

Method get_database_size

class/database.py:2821–2849  ·  view source on GitHub ↗

获取数据库大小

(self, ids, is_pid=False)

Source from the content-addressed store, hash-verified

2819 return limit_size
2820
2821 def get_database_size(self, ids, is_pid=False):
2822 """
2823 获取数据库大小
2824 """
2825 result = {}
2826 for id in ids:
2827 if not is_pid:
2828 x = public.M('databases').where("id=? AND LOWER(type)=LOWER('mysql')", id).field('id,sid,pid,name,type,ps,addtime').find()
2829 else:
2830 x = public.M('databases').where("pid=? AND LOWER(type)=LOWER('mysql')", id).field('id,sid,pid,name,ps,type,addtime').find()
2831 if not x: continue
2832 x['backup_count'] = public.M('backup').where("pid=? AND type=?", (x['id'], '1')).count()
2833 if (x['type']).lower() == 'mysql':
2834 x['total'] = int(public.get_database_size_by_id(x['id']))
2835 else:
2836 try:
2837 from panelDatabaseController import DatabaseController
2838 project_obj = DatabaseController()
2839
2840 get = public.dict_obj()
2841 get['data'] = {'db_id': x['id']}
2842 get['mod_name'] = x['type'].lower()
2843 get['def_name'] = 'get_database_size_by_id'
2844
2845 x['total'] = project_obj.model(get)
2846 except:
2847 x['total'] = int(public.get_database_size_by_id(x['id']))
2848 result[x['name']] = x
2849 return result
2850
2851 def get_database_table(self, get):
2852 if not hasattr(get, "sid"):

Callers 1

check_del_dataMethod · 0.95

Calls 8

modelMethod · 0.95
DatabaseControllerClass · 0.90
findMethod · 0.45
fieldMethod · 0.45
whereMethod · 0.45
MMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected