def saveAll(): #This dumps the contents of the active modules in ram to a subfolder of the moduledir named after the current unix time""" dn = os.path.join(directories.persistdir,str(time.time()) ) #Ensure dir does not make the last path component util.ensure_dir(os.path.join(dn,"dummy")) savefiles(dn) #We only want 1 backup(for now at least) so clean up old ones. util.deleteAllButHighestNumberedNDirectories(directories.persistdir,2)
def saveAll(): global moduleschanged if not moduleschanged: return moduleschanged = False #This dumps the contents of the active modules in ram to a subfolder of the moduledir named after the current unix time""" saveModules(os.path.join(directories.moduledir,str(time.time()) )) #We only want 1 backup(for now at least) so clean up old ones. util.deleteAllButHighestNumberedNDirectories(directories.moduledir,2)
def saveAll(): global moduleschanged if not moduleschanged: return moduleschanged = False #This dumps the contents of the active modules in ram to a subfolder of the moduledir named after the current unix time""" saveModules(os.path.join(directories.moduledir, str(time.time()))) #We only want 1 backup(for now at least) so clean up old ones. util.deleteAllButHighestNumberedNDirectories(directories.moduledir, 2)
def dumpDatabase(): #Assemble the users and groups data and save it back where we found it temp = {"users":Users,"groups":Groups} p = os.path.join(directories.usersdir,str(time.time())) os.mkdir(p) f = open(os.path.join(p,"users.json"),"w") #prettyprint json.dump(temp,f,sort_keys=True, indent=4, separators=(',', ': ')) f.close() f = open(os.path.join(p,"__COMPLETE__"),"w") f.write("completely arbitrary text") f.close() util.deleteAllButHighestNumberedNDirectories(directories.usersdir,2)