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