获取数据库大小
(self, ids, is_pid=False)
| 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 | """ |
no test coverage detected