diff src/luan/host/WebHandler.java @ 1763:164c6ea53147

fix change_password
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 22 May 2023 19:21:14 -0600
parents 07be5015159d
children 8df0b80e715e
line wrap: on
line diff
--- a/src/luan/host/WebHandler.java	Fri May 19 18:08:46 2023 -0600
+++ b/src/luan/host/WebHandler.java	Mon May 22 19:21:14 2023 -0600
@@ -123,6 +123,22 @@
 		domainHandler.removeHandler(domain);
 	}
 
+	public static void moveTo(String domain,String toDomain,String password) throws LuanException, IOException {
+		toDomain = toDomain.toLowerCase();
+		File fromDir = new File(sitesDir,domain);
+		File toDir = new File(sitesDir,toDomain);
+		synchronized(domain) {
+			if( !fromDir.exists() )
+				throw new LuanException("domain not found");
+			if( toDir.exists() )
+				throw new LuanException("new_domain already exists");
+			callSite(domain,"close_lucene",password);
+			removeHandler(domain);
+			IoUtils.move(fromDir,toDir);
+		}
+		loadHandler(toDomain);
+	}
+
 	public static void loadHandler(String domain) throws LuanException {
 		try {
 			domainHandler.getHandler(domain);