comparison src/luan/modules/host/Hosting.luan @ 1408:5b8f76e26ab7

remove old backups
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 24 Sep 2019 15:02:33 -0600
parents 8d7a39ca2c0c
children db57d562c4bd
comparison
equal deleted inserted replaced
1407:1979cff9aad2 1408:5b8f76e26ab7
21 local my_dir = Io.uri("file:"..dir) 21 local my_dir = Io.uri("file:"..dir)
22 my_dir.exists() or error("directory '"..dir.."' not found") 22 my_dir.exists() or error("directory '"..dir.."' not found")
23 my_dir.is_directory() or error("'"..dir.."' is not a directory") 23 my_dir.is_directory() or error("'"..dir.."' is not a directory")
24 local host = Rpc.remote(domain) 24 local host = Rpc.remote(domain)
25 local tree = host.get(domain,password) 25 local tree = host.get(domain,password)
26 host.in_backup_read_lock()
27 if tree == nil then 26 if tree == nil then
28 print("creating "..domain) 27 print("creating "..domain)
29 tree = host.create(domain,password) 28 tree = host.create(domain,password)
30 end 29 end
31 30
65 host.close() 64 host.close()
66 end 65 end
67 66
68 function Hosting.delete(domain,password) 67 function Hosting.delete(domain,password)
69 local host = Rpc.remote(domain) 68 local host = Rpc.remote(domain)
70 host.in_backup_read_lock()
71 host.delete(domain,password) 69 host.delete(domain,password)
72 host.close() 70 host.close()
73 end 71 end
74 72
75 function Hosting.exists(domain) 73 function Hosting.exists(domain)
79 return rtn 77 return rtn
80 end 78 end
81 79
82 function Hosting.change_domain(old_domain,new_domain,password) 80 function Hosting.change_domain(old_domain,new_domain,password)
83 local host = Rpc.remote(new_domain) 81 local host = Rpc.remote(new_domain)
84 host.in_backup_read_lock()
85 local rtn = host.change_domain(old_domain,new_domain,password) 82 local rtn = host.change_domain(old_domain,new_domain,password)
86 host.close() 83 host.close()
87 return rtn 84 return rtn
88 end 85 end
89 86
90 function Hosting.change_password(domain,old_password,new_password) 87 function Hosting.change_password(domain,old_password,new_password)
91 local host = Rpc.remote(domain) 88 local host = Rpc.remote(domain)
92 host.in_backup_read_lock()
93 local rtn = host.change_password(domain,old_password,new_password) 89 local rtn = host.change_password(domain,old_password,new_password)
94 host.close() 90 host.close()
95 return rtn 91 return rtn
96 end 92 end
97 93