@name 检测磁盘是否可用
()
| 681 | |
| 682 | |
| 683 | def check_disk_used(): |
| 684 | """ |
| 685 | @name 检测磁盘是否可用 |
| 686 | """ |
| 687 | try: |
| 688 | total = 0 |
| 689 | db_path = '{}/data/db'.format(panelPath) |
| 690 | for filename in os.listdir(db_path): |
| 691 | if total >= 3: break |
| 692 | |
| 693 | if filename.find('.db') == -1: |
| 694 | continue |
| 695 | sfile = '{}/{}'.format(db_path, filename) |
| 696 | |
| 697 | db_obj = get_data_obj(sfile) |
| 698 | res = db_obj.query('PRAGMA table_info(sqlite_master);') |
| 699 | if 'unable to open database file' in res: |
| 700 | total += 1 |
| 701 | continue |
| 702 | |
| 703 | if total >= 3: |
| 704 | return True |
| 705 | |
| 706 | except:pass |
| 707 | return False |
| 708 | |
| 709 | if __name__ == '__main__': |
| 710 | ERR_INFO = None |
no test coverage detected