From da5ccc6e38c96511fcacbd0e7f96cde362eefdc2 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Mon, 7 Sep 2009 00:59:58 +0000
Subject: [PATCH] Enhance DoliWamp install

---
 build/exe/doliwamp/doliwamp.iss | 236 +++++++++++++++++---------------
 1 file changed, 122 insertions(+), 114 deletions(-)

diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss
index 8ce6ddedd0a..4df30180fa7 100644
--- a/build/exe/doliwamp/doliwamp.iss
+++ b/build/exe/doliwamp/doliwamp.iss
@@ -349,9 +349,6 @@ begin
 
 
 
-    if MsgBox('DoliWamp installer will now start or restart Apache and Mysql, this may last from several seconds to one minute after this confirmation...',mbConfirmation,MB_YESNO) = IDYES then
-    begin
-
 		// Check if parameters already defined in conf.php file
 		srcFile := pathWithSlashes+'/www/dolibarr/htdocs/conf/conf.php';
 		if not FileExists (srcFile) then
@@ -384,116 +381,127 @@ begin
     begin
     
 		  // Test serveur SMTP
-//  		batFile := pathWithSlashes+'/UsedPort.exe';
-//  		MsgBox('batFile = '+batFile,mbConfirmation,MB_YESNO)
-//  		Exec(batFile, '-s '+smtpServer+' -p 25', path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
-      //themessage := 'Le serveur '+smtpServer+' semble ne pas etre joignable pour l envoi de mail SMTP (port 25). Si vous avez un firewall, verifiez sa configuration. Sinon, revenez en arriere pour choisir une autre valeur pour le serveur SMTP sortant d envoi de mail (Cette information est doit etre fournie par votre fournisseur d acces Internet).';
-//      themessage := 'The server '+smtpServer+' seems to be unreachable to send outgoing SMTP emails (port 25). If you have a firewall, check its setup. Otherwise, go back to choose another value for the SMTP server (This information shoud be given by your Internet Service Provider) or click "No" to ignore error.';
-//  		if ((IntToStr(myResult) <> '0') and (MsgBox(themessage,mbConfirmation,MB_YESNO) = IDYES)) then
+//      if paramok then
 //      begin
-//  		  paramok := False;
-//  		end;
-		 			
-		  // Test port Apache
-  		batFile := pathWithSlashes+'/UsedPort.exe';
-  		MsgBox('batFile = '+batFile,mbConfirmation,MB_YESNO)
-  		Exec(batFile, '-s localhost -p '+myporta, path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
-      //themessage := 'Le port '+myporta+' semble deja pris. Revenez en arriere pour choisir une autre valeur pour le port Apache.';
-      themessage := 'Port '+myporta+' seems to be already in use. Go back to choose another value for Apache port or click "No" to ignore error.';
-  		if ((IntToStr(myResult) <> '0') and (MsgBox(themessage,mbConfirmation,MB_YESNO) = IDYES)) then
+//    		batFile := pathWithSlashes+'/UsedPort.exe';
+//    		MsgBox('batFile = '+batFile,mbConfirmation,MB_YESNO)
+//  	    Exec(batFile, '-s '+smtpServer+' -p 25', path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
+        //themessage := 'Le serveur '+smtpServer+' semble ne pas etre joignable pour l envoi de mail SMTP (port 25). Si vous avez un firewall, verifiez sa configuration. Sinon, revenez en arriere pour choisir une autre valeur pour le serveur SMTP sortant d envoi de mail (Cette information est doit etre fournie par votre fournisseur d acces Internet).';
+//        themessage := 'The server '+smtpServer+' seems to be unreachable to send outgoing SMTP emails (port 25). If you have a firewall, check its setup. Otherwise, go back to choose another value for the SMTP server (This information shoud be given by your Internet Service Provider) or click "No" to ignore error. Cancel choice to choose another value ?';
+//  		  if ((IntToStr(myResult) <> '0') and (MsgBox(themessage,mbConfirmation,MB_YESNO) = IDYES)) then
+//        begin
+//  		    paramok := False;
+//  		  end;
+//	    end;
+	    
+      if paramok then
       begin
-  		  paramok := False;
-  		end;
-		 			
-  		// Test port Mysql
-  		batFile := pathWithSlashes+'/UsedPort.exe';
-  		MsgBox('batFile = '+batFile,mbConfirmation,MB_YESNO)
-  		Exec(batFile, '-s localhost -p '+myport, path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
-      //themessage := 'Le port '+myport+' semble deja pris. Revenez en arriere pour choisir une autre valeur pour le port MySQL.';
-      themessage := 'Port '+myport+' seems to be already in use. Go back to choose another value for MySQL port or click "No" to ignore error.';
-  		if ((IntToStr(myResult) <> '0') and (MsgBox(themessage,mbConfirmation,MB_YESNO) = IDYES)) then
-  		begin
-    		paramok := False;
-  		end;
-
+  		  // Test port Apache
+    		batFile := pathWithSlashes+'/UsedPort.exe';
+    		//MsgBox('batFile = '+batFile,mbConfirmation,MB_YESNO)
+    		Exec(batFile, '-s localhost -p '+myporta, path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
+        //themessage := 'Le port '+myporta+' semble deja pris. Revenez en arriere pour choisir une autre valeur pour le port Apache.';
+        themessage := 'Port '+myporta+' seems to be already in use. Go back to choose another value for Apache port. Cancel choice and choose another value ?';
+    		if ((IntToStr(myResult) = '0') and (MsgBox(themessage,mbConfirmation,MB_YESNO) = IDYES)) then
+        begin
+    		  paramok := False;
+    		end;
+      end;
+      
+      if paramok then
+      begin
+    		// Test port Mysql
+    		batFile := pathWithSlashes+'/UsedPort.exe';
+    		//MsgBox('batFile = '+batFile,mbConfirmation,MB_YESNO)
+    		Exec(batFile, '-s localhost -p '+myport, path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
+        //themessage := 'Le port '+myport+' semble deja pris. Revenez en arriere pour choisir une autre valeur pour le port MySQL.';
+        themessage := 'Port '+myport+' seems to be already in use. Go back to choose another value for MySQL port. Cancel choice and choose another value ?';
+    		if ((IntToStr(myResult) = '0') and (MsgBox(themessage,mbConfirmation,MB_YESNO) = IDYES)) then
+    		begin
+      		paramok := False;
+    		end;
+      end;
+      
     end;
 		
 		if paramok
 		then
 		begin
 		    
-		    //----------------------------------------------
-		    // Rename file c:/windows/php.ini (we don't want it)
-		    //----------------------------------------------
-		
-		    if FileExists ('c:/windows/php.ini') then
-		    begin
-		      if MsgBox('A previous c:/windows/php.ini file has been detected in your Windows directory. Do you want DoliWamp to rename it to php_old.ini to avoid conflicts ?',mbConfirmation,MB_YESNO) = IDYES then
-		      begin
-		        RenameFile('c:/windows/php.ini','c:/windows/php_old.ini');
-		      end;
-		    end;
-		    if FileExists ('c:/winnt/php.ini') then
-		    begin
-		      if MsgBox('A previous c:/winnt/php.ini file has been detected in your Windows directory. Do you want DoliWamp to rename it to php_old.ini to avoid conflicts ?',mbConfirmation,MB_YESNO) = IDYES then
-		      begin
-		        RenameFile('c:/winnt/php.ini','c:/winnt/php_old.ini');
-		      end;
-		    end;
-		
-		
-		
-		    //----------------------------------------------
-		    // rundoliwamp.bat, rundolihelp.bat and rundoliadmin.bat
-		    //----------------------------------------------
-		
-		    destFile := pathWithSlashes+'/rundoliwamp.bat';
-		    srcFile := pathWithSlashes+'/rundoliwamp.bat.install';
-		    
-		    destFileH := pathWithSlashes+'/rundolihelp.bat';
-		    srcFileH := pathWithSlashes+'/rundolihelp.bat.install';
-		
-		    destFileA := pathWithSlashes+'/rundoliadmin.bat';
-		    srcFileA := pathWithSlashes+'/rundoliadmin.bat.install';
-		
-		    if (not FileExists (destFile) or not FileExists (destFileH) or not FileExists (destFileA))
-		     and (FileExists(srcFile) and FileExists(srcFileH) and FileExists(srcFileA)) then
-		    begin
-		      //navigateur
-		      browser := 'explorer.exe';
-		      if FileExists ('C:/Program Files/Mozilla Firefox/firefox.exe')  then
-		      begin
-		        if MsgBox('Firefox has been detected on your computer. Would you like to use it as the default browser with Dolibarr ?',mbConfirmation,MB_YESNO) = IDYES then
-		        begin
-		          browser := 'C:/Program Files/Mozilla Firefox/firefox.exe';
-		        end;
-		      end;
+	    //----------------------------------------------
+	    // Rename file c:/windows/php.ini (we don't want it)
+	    //----------------------------------------------
+		
+	    if FileExists ('c:/windows/php.ini') then
+	    begin
+	      if MsgBox('A previous c:/windows/php.ini file has been detected in your Windows directory. Do you want DoliWamp to rename it to php_old.ini to avoid conflicts ?',mbConfirmation,MB_YESNO) = IDYES then
+	      begin
+	        RenameFile('c:/windows/php.ini','c:/windows/php_old.ini');
+	      end;
+	    end;
+	    if FileExists ('c:/winnt/php.ini') then
+	    begin
+	      if MsgBox('A previous c:/winnt/php.ini file has been detected in your Windows directory. Do you want DoliWamp to rename it to php_old.ini to avoid conflicts ?',mbConfirmation,MB_YESNO) = IDYES then
+	      begin
+	        RenameFile('c:/winnt/php.ini','c:/winnt/php_old.ini');
+	      end;
+	    end;
+		
+		
+		
+	    //----------------------------------------------
+	    // rundoliwamp.bat, rundolihelp.bat and rundoliadmin.bat
+	    //----------------------------------------------
+	
+	    destFile := pathWithSlashes+'/rundoliwamp.bat';
+	    srcFile := pathWithSlashes+'/rundoliwamp.bat.install';
+	
+	    destFileH := pathWithSlashes+'/rundolihelp.bat';
+	    srcFileH := pathWithSlashes+'/rundolihelp.bat.install';
+	
+	    destFileA := pathWithSlashes+'/rundoliadmin.bat';
+	    srcFileA := pathWithSlashes+'/rundoliadmin.bat.install';
+	
+	    if (not FileExists (destFile) or not FileExists (destFileH) or not FileExists (destFileA))
+	     and (FileExists(srcFile) and FileExists(srcFileH) and FileExists(srcFileA)) then
+	    begin
+	      //navigateur
+	      browser := 'explorer.exe';
+	      if FileExists ('C:/Program Files/Mozilla Firefox/firefox.exe')  then
+	      begin
+	        if MsgBox('Firefox has been detected on your computer. Would you like to use it as the default browser with Dolibarr ?',mbConfirmation,MB_YESNO) = IDYES then
+	        begin
+	          browser := 'C:/Program Files/Mozilla Firefox/firefox.exe';
+	        end;
+	      end;
+	      if browser = 'explorer.exe' then
+	      begin
+	        GetOpenFileName('Please choose your default browser. If you are not sure, just click Open :', browser, winPath,'exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe');
+	      end;
+	
+	      LoadStringFromFile (srcFile, srcContents);
+	      StringChange (srcContents, 'WAMPBROWSER', browser);
+	      StringChange (srcContents, 'WAMPAPACHEPORT', myporta);
+	      StringChange (srcContents, 'WAMPAPACHEPSSL', myportas);
+	      SaveStringToFile(destFile,srcContents, False);
+	
+	      LoadStringFromFile (srcFileH, srcContents);
+	      StringChange (srcContents, 'WAMPBROWSER', browser);
+	      StringChange (srcContents, 'WAMPAPACHEPORT', myporta);
+	      StringChange (srcContents, 'WAMPAPACHEPSSL', myportas);
+	      SaveStringToFile(destFileH,srcContents, False);
+	
+	      LoadStringFromFile (srcFileA, srcContents);
+	      StringChange (srcContents, 'WAMPBROWSER', browser);
+	      StringChange (srcContents, 'WAMPAPACHEPORT', myporta);
+	      StringChange (srcContents, 'WAMPAPACHEPSSL', myportas);
+	      SaveStringToFile(destFileA,srcContents, False);
+	    end
+
+
+      if MsgBox('DoliWamp installer will now start or restart Apache and Mysql, this may last from several seconds to one minute after this confirmation. Start to install the web server and database server ?',mbConfirmation,MB_YESNO) = IDYES then
+      begin
 
-		      if browser = 'explorer.exe' then
-		      begin
-		        GetOpenFileName('Please choose your default browser. If you are not sure, just click Open :', browser, winPath,'exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe');
-		      end;
-		
-		      LoadStringFromFile (srcFile, srcContents);
-		      StringChange (srcContents, 'WAMPBROWSER', browser);
-		      StringChange (srcContents, 'WAMPAPACHEPORT', myporta);
-		      StringChange (srcContents, 'WAMPAPACHEPSSL', myportas);
-		      SaveStringToFile(destFile,srcContents, False);
-		
-		      LoadStringFromFile (srcFileH, srcContents);
-		      StringChange (srcContents, 'WAMPBROWSER', browser);
-		      StringChange (srcContents, 'WAMPAPACHEPORT', myporta);
-		      StringChange (srcContents, 'WAMPAPACHEPSSL', myportas);
-		      SaveStringToFile(destFileH,srcContents, False);
-		      
-		      LoadStringFromFile (srcFileA, srcContents);
-		      StringChange (srcContents, 'WAMPBROWSER', browser);
-		      StringChange (srcContents, 'WAMPAPACHEPORT', myporta);
-		      StringChange (srcContents, 'WAMPAPACHEPSSL', myportas);
-		      SaveStringToFile(destFileA,srcContents, False);
-		    end
-		
-		
 		
 		    //----------------------------------------------
 		    // Fichier alias phpmyadmin
@@ -846,23 +854,23 @@ begin
 		
         res := True;
 		
-		end
-		else
-		begin
+		  end
+		  else
+		  begin
 		  
-        MsgBox('Selected values seems to be already used. Please choose other values.',mbInformation,MB_OK);
-		  	
-		  	res := False;
+//	  	MsgBox('Apache and Mysql installation has been canceled. Please select parameters to start their installation.',mbInformation,MB_OK)
+
+      	res := False;
 		  	
-		end
+		  end
       
     end
     else
     begin
     
-//	  	MsgBox('Apache and Mysql installation has been canceled. Please select parameters to start their installation.',mbInformation,MB_OK)
-      
-      	res := False;
+        //MsgBox('Selected values seems to be already used. Please choose other values.',mbInformation,MB_OK);
+		  	
+		  	res := False;
 
     end
     
-- 
GitLab