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

Method get_backup_list

class/databaseModel/sqliteModel.py:144–173  ·  view source on GitHub ↗

@获取备份文件列表

(self,get)

Source from the content-addressed store, hash-verified

142 return public.returnMsg(True, 'DEL_SUCCESS');
143
144 def get_backup_list(self,get):
145 """
146 @获取备份文件列表
147 """
148 nlist = []
149 search = ''
150 path = get.path
151
152 if hasattr(get,'search'):
153 search = get['search'].strip().lower()
154
155 path = session['config']['backup_path'] + '/database/sqlite/' + public.md5(path)
156 if not os.path.exists(path): os.makedirs(path)
157 for name in os.listdir(path):
158 if search:
159 if name.lower().find(search) == -1: continue;
160
161 arrs = name.split('_')
162
163 filepath = '{}/{}'.format(path,name).replace('//','/')
164 stat = os.stat(filepath)
165
166 item = {}
167 item['name'] = name
168 item['filepath'] = filepath
169 item['size'] = stat.st_size
170 item['mtime'] = int(stat.st_mtime)
171
172 nlist.append(item)
173 return nlist
174
175 def get_table_list(self,args):
176 """

Callers 1

get_listMethod · 0.95

Calls 9

listdirMethod · 0.80
statMethod · 0.80
md5Method · 0.45
existsMethod · 0.45
findMethod · 0.45
splitMethod · 0.45
replaceMethod · 0.45
formatMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected