@name 获取数据库列表 @param args['path'] 数据库文件路径 @return list
(self,args)
| 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 |
nothing calls this directly
no test coverage detected