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

Function check_disk_used

script/init_db.py:683–707  ·  view source on GitHub ↗

@name 检测磁盘是否可用

()

Source from the content-addressed store, hash-verified

681
682
683def 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
709if __name__ == '__main__':
710 ERR_INFO = None

Callers 1

init_db.pyFile · 0.85

Calls 5

get_data_objFunction · 0.85
listdirMethod · 0.80
formatMethod · 0.45
findMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected