doliwamp.iss 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012
  1. ; ----- DoliWamp.iss ---------------------------------------------------------------------
  2. ; Script to build an auto installer for Dolibarr.
  3. ; Works with InnoSetup 5.4.0 (a)
  4. ; Idea from WampServer 2 (http://www.wampserver.com)
  5. ;----------------------------------------------------------------------------------------
  6. ; You must edit some path in this file to build an exe (like SourceDir).
  7. ; WARNING: Be sure that user.* files of Mysql database used to build
  8. ; package contains only one user called root with no password.
  9. ; For this, you can edit the mysql.user table of the source database to keep
  10. ; only the root user with no password, stop server and catch
  11. ; files user.MY* to put them in the Dolibarr build/exe/doliwamp/mysql directory.
  12. ;
  13. ;----------------------------------------------------------------------------------------
  14. [Setup]
  15. ; ----- Change this -----
  16. AppName=DoliWamp
  17. ; DoliWamp-x.x.x or DoliWamp-x.x.x-dev or DoliWamp-x.x.x-beta
  18. AppVerName=DoliWamp-3.2.0-alpha
  19. ; DoliWamp-x.x x or DoliWamp-x.x.x-dev or DoliWamp-x.x.x-beta
  20. OutputBaseFilename=DoliWamp-3.2.0-alpha
  21. ; Define full path from wich all relative path are defined
  22. ; You must modify this to put here your dolibarr root directory
  23. SourceDir=c:\Documents and Settings\ldestail\git\dolibarr
  24. ; ----- End of change
  25. ;OutputManifestFile=build\doliwampbuild.log
  26. AppId=doliwamp
  27. AppPublisher=NLTechno
  28. AppPublisherURL=http://www.nltechno.com
  29. AppSupportURL=http://www.dolibarr.org
  30. AppUpdatesURL=http://www.dolibarr.org
  31. AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql softwares.
  32. AppCopyright=Copyright (C) 2008-2011 Laurent Destailleur, NLTechno
  33. DefaultDirName=c:\dolibarr
  34. DefaultGroupName=Dolibarr
  35. ;LicenseFile=COPYING
  36. ;Compression=none
  37. Compression=lzma
  38. SolidCompression=yes
  39. WizardImageFile=build\exe\doliwamp\doliwamp.bmp
  40. WizardSmallImageFile=build\exe\doliwamp\doliwampsmall.bmp
  41. SetupIconFile=doc\images\dolibarr.ico
  42. PrivilegesRequired=admin
  43. DisableProgramGroupPage=yes
  44. ChangesEnvironment=no
  45. CreateUninstallRegKey=yes
  46. ;UseSetupLdr=no
  47. ;UninstallDisplayIcon={app}\bidon
  48. OutputDir=build
  49. ShowLanguageDialog=auto
  50. ShowUndisplayableLanguages=no
  51. ;LanguageDetectionMethod=none
  52. LanguageDetectionMethod=uilanguage
  53. ;SignedUninstaller=yes
  54. [Languages]
  55. Name: "en"; MessagesFile: "compiler:Default.isl,build\exe\doliwamp\Languages\MyEnglish.isl"
  56. Name: "br"; MessagesFile: "compiler:Languages\Portuguese.isl,build\exe\doliwamp\Languages\MyBrazilianPortuguese.isl"
  57. Name: "ca"; MessagesFile: "compiler:Languages\Catalan.isl,build\exe\doliwamp\Languages\MyCatalan.isl"
  58. Name: "da"; MessagesFile: "compiler:Languages\Danish.isl,build\exe\doliwamp\Languages\MyDanish.isl"
  59. Name: "es"; MessagesFile: "compiler:Languages\Spanish.isl,build\exe\doliwamp\Languages\MySpanish.isl"
  60. Name: "nl"; MessagesFile: "compiler:Languages\Dutch.isl,build\exe\doliwamp\Languages\MyDutch.isl"
  61. Name: "fi"; MessagesFile: "compiler:Languages\Finnish.isl,build\exe\doliwamp\Languages\MyFinnish.isl"
  62. Name: "fr"; MessagesFile: "compiler:Languages\French.isl,build\exe\doliwamp\Languages\MyFrench.isl"
  63. Name: "ge"; MessagesFile: "compiler:Languages\German.isl,build\exe\doliwamp\Languages\MyGerman.isl"
  64. Name: "it"; MessagesFile: "compiler:Languages\Italian.isl,build\exe\doliwamp\Languages\MyItalian.isl"
  65. Name: "nb"; MessagesFile: "compiler:Languages\Norwegian.isl,build\exe\doliwamp\Languages\MyNorwegian.isl"
  66. Name: "po"; MessagesFile: "compiler:Languages\Polish.isl,build\exe\doliwamp\Languages\MyPolish.isl"
  67. Name: "pt"; MessagesFile: "compiler:Languages\Portuguese.isl,build\exe\doliwamp\Languages\MyPortuguese.isl"
  68. Name: "ru"; MessagesFile: "compiler:Languages\Russian.isl,build\exe\doliwamp\Languages\MyRussian.isl"
  69. Name: "sv"; MessagesFile: "compiler:Languages\Slovenian.isl,build\exe\doliwamp\Languages\MySlovenian.isl"
  70. [Tasks]
  71. ;Name: "autostart"; Description: "Automatically launch DoliWamp server on startup. If you check this option, Services will be installed as automatic. Otherwise, services will be installed as manual and will start and stop with the service manager."; GroupDescription: "Auto Start:" ;Flags: unchecked;
  72. Name: "quicklaunchicon"; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
  73. Name: "desktopicon"; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
  74. [Dirs]
  75. Name: "{app}\logs"
  76. Name: "{app}\tmp"
  77. Name: "{app}\dolibarr_documents"
  78. Name: "{app}\bin\apache\apache2.2.6\logs"
  79. [Files]
  80. ; Stop/start
  81. Source: "build\exe\doliwamp\stopdoliwamp.bat"; DestDir: "{app}\"; Flags: ignoreversion; AfterInstall: close()
  82. Source: "build\exe\doliwamp\startdoliwamp.bat"; DestDir: "{app}\"; Flags: ignoreversion;
  83. Source: "build\exe\doliwamp\removefiles.bat"; DestDir: "{app}\"; Flags: ignoreversion;
  84. Source: "build\exe\doliwamp\rundoliwamp.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  85. Source: "build\exe\doliwamp\rundolihelp.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  86. Source: "build\exe\doliwamp\rundoliadmin.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  87. Source: "build\exe\doliwamp\install_services.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  88. Source: "build\exe\doliwamp\uninstall_services.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  89. Source: "build\exe\doliwamp\mysqlinitpassword.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  90. Source: "build\exe\doliwamp\mysqltestinstall.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  91. Source: "build\exe\doliwamp\startdoliwamp_manual_donotuse.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  92. Source: "build\exe\doliwamp\builddemosslfiles.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  93. Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversion;
  94. ; PhpMyAdmin, Apache, Php, Mysql
  95. ; Put here path of Wampserver applications
  96. ; Value OK: apache 2.2.6, php 5.2.5 (5.2.11 fails if php_exif is on), mysql 5.0.45 or 5.1.36
  97. Source: "C:\Program Files\Wamp\apps\phpmyadmin3.2.0.1\*.*"; DestDir: "{app}\apps\phpmyadmin3.2.0.1"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log"
  98. Source: "C:\Program Files\Wamp\bin\apache\apache2.2.6\*.*"; DestDir: "{app}\bin\apache\apache2.2.6"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
  99. Source: "C:\Program Files\Wamp\bin\php\php5.2.5\*.*"; DestDir: "{app}\bin\php\php5.2.5"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
  100. Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe"
  101. ; Mysql data files (does not overwrite if exists)
  102. Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db"
  103. ; Dolibarr
  104. Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,telephonie\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\install.forced.php"
  105. Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,xdebug\*"
  106. Source: "doc\*.*"; DestDir: "{app}\www\dolibarr\doc"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,wiki\*,plaquette\*,dev\*,images\dolibarr_screenshot2.png,images\dolibarr_screenshot3.png,images\dolibarr_screenshot4.png,images\dolibarr_screenshot5.png,images\dolibarr_screenshot6.png,images\dolibarr_screenshot7.png,images\dolibarr_screenshot8.png,images\dolibarr_screenshot9.png,images\dolibarr_screenshot10.png,images\dolibarr_screenshot11.png,images\dolibarr_screenshot12.png"
  107. Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,product\materiel.net.php,product\import-product.php"
  108. Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,default.properties,install.lock"
  109. ; Config files
  110. Source: "build\exe\doliwamp\phpmyadmin.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
  111. Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
  112. Source: "build\exe\doliwamp\config.inc.php.install"; DestDir: "{app}\apps\phpmyadmin3.2.0.1"; Flags: ignoreversion;
  113. Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.2.6\conf"; Flags: ignoreversion;
  114. Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion;
  115. Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.2.5"; Flags: ignoreversion;
  116. Source: "build\exe\doliwamp\index.php.install"; DestDir: "{app}\www"; Flags: ignoreversion;
  117. Source: "build\exe\doliwamp\install.forced.php.install"; DestDir: "{app}\www\dolibarr\htdocs\install"; Flags: ignoreversion;
  118. Source: "build\exe\doliwamp\openssl.conf"; DestDir: "{app}"; Flags: ignoreversion;
  119. Source: "build\exe\doliwamp\ca_demo_dolibarr.crt"; DestDir: "{app}"; Flags: ignoreversion;
  120. Source: "build\exe\doliwamp\ca_demo_dolibarr.key"; DestDir: "{app}"; Flags: ignoreversion;
  121. ; Licence
  122. Source: "COPYRIGHT"; DestDir: "{app}"; Flags: ignoreversion;
  123. [Icons]
  124. Name: "{group}\Dolibarr ERP-CRM"; Filename: "{app}\rundoliwamp.bat"; WorkingDir: "{app}"; IconFilename: {app}\www\dolibarr\doc\images\dolibarr.ico
  125. Name: "{group}\Tools\Help center"; Filename: "{app}\rundolihelp.bat"; WorkingDir: "{app}"; IconFilename: {app}\www\dolibarr\doc\images\dolihelp.ico
  126. Name: "{group}\Tools\Start DoliWamp server"; Filename: "{app}\startdoliwamp.bat"; WorkingDir: "{app}"; IconFilename: {app}\www\dolibarr\doc\images\doliwampon.ico
  127. Name: "{group}\Tools\Stop DoliWamp server"; Filename: "{app}\stopdoliwamp.bat"; WorkingDir: "{app}"; IconFilename: {app}\www\dolibarr\doc\images\doliwampoff.ico
  128. Name: "{group}\Tools\Admin DoliWamp server"; Filename: "{app}\rundoliadmin.bat"; WorkingDir: "{app}"; IconFilename: {app}\www\dolibarr\doc\images\doliadmin.ico
  129. Name: "{group}\Tools\Uninstall DoliWamp"; Filename: "{app}\unins000.exe"; WorkingDir: "{app}"; IconFilename: {app}\uninstall_services.bat
  130. Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\Dolibarr"; WorkingDir: "{app}"; Filename: "{app}\rundoliwamp.bat"; Tasks: quicklaunchicon; IconFilename: {app}\www\dolibarr\doc\images\dolibarr.ico
  131. Name: "{userdesktop}\Dolibarr ERP-CRM"; Filename: "{app}\rundoliwamp.bat"; WorkingDir: "{app}"; Tasks: desktopicon; IconFilename: {app}\www\dolibarr\doc\images\dolibarr.ico
  132. Name: "{userdesktop}\Dolibarr Help center"; Filename: "{app}\rundolihelp.bat"; WorkingDir: "{app}"; Tasks: desktopicon; IconFilename: {app}\www\dolibarr\doc\images\dolihelp.ico
  133. ;Start of servers fromstartup menu disabled as services are auto
  134. ;Name: "{userstartup}\DoliWamp server"; Filename: "{app}\startdoliwamp.bat"; WorkingDir: "{app}"; Flags: runminimized; IconFilename: {app}\www\dolibarr\doc\images\dolibarr.ico
  135. [Code]
  136. //variables globales
  137. var phpVersion: String;
  138. var apacheVersion: String;
  139. var path: String;
  140. var pfPath: String;
  141. var winPath: String;
  142. var pathWithSlashes: String;
  143. var Page: TInputQueryWizardPage;
  144. var smtpServer: String;
  145. var apachePort: String;
  146. var mysqlPort: String;
  147. var newPassword: String;
  148. var lockFile: String;
  149. var srcFile: String;
  150. var destFile: String;
  151. var srcFileH: String;
  152. var destFileH: String;
  153. var srcFileA: String;
  154. var destFileA: String;
  155. var srcContents: String;
  156. var browser: String;
  157. var mysqlVersion: String;
  158. var phpmyadminVersion: String;
  159. var phpDllCopy: String;
  160. var batFile: String;
  161. var mysmtp: String;
  162. var myporta: String;
  163. var myportas: String;
  164. var myport: String;
  165. var mypass: String;
  166. var firstinstall: Boolean;
  167. var value: String;
  168. //-----------------------------------------------
  169. //procedures lancees au debut de l'installation
  170. function InitializeSetup(): Boolean;
  171. begin
  172. Result := MsgBox(CustomMessage('YouWillInstallDoliWamp')+#13#13+CustomMessage('ThisAssistantInstallOrUpgrade')+#13#13+CustomMessage('IfYouHaveTechnicalKnowledge')+#13#13+CustomMessage('ButIfYouLook')+#13#13+CustomMessage('DoYouWantToStart'), mbConfirmation, MB_YESNO) = IDYES;
  173. end;
  174. procedure InitializeWizard();
  175. begin
  176. //version des applis, a modifier pour chaque version de WampServer 2
  177. apacheVersion := '2.2.6';
  178. phpVersion := '5.2.5' ;
  179. mysqlVersion := '5.0.45';
  180. phpmyadminVersion := '3.2.0.1';
  181. smtpServer := 'localhost';
  182. apachePort := '80';
  183. mysqlPort := '3306';
  184. newPassword := 'changeme';
  185. firstinstall := true;
  186. //LoadStringFromFile (srcFile, srcContents);
  187. //posvalue=Pos('$dolibarr_main_db_port=', srcFile);
  188. if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp','smtpServer', value) then
  189. begin
  190. if value <> '' then smtpServer:=value;
  191. end
  192. else
  193. begin
  194. if RegQueryStringValue(HKEY_CURRENT_USER, 'Software\Microsoft\Internet Account Manager\Accounts\00000001','SMTP Server', value) then
  195. begin
  196. if value <> '' then smtpServer:=value;
  197. end
  198. else
  199. begin
  200. if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'PMail\ServiceInfo\Mail_Account_1','SvcSMTPHost', value) then
  201. begin
  202. if value <> '' then smtpServer:=value;
  203. end
  204. else
  205. begin
  206. if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\MSCRM','SMTPServer', value) then
  207. begin
  208. if value <> '' then smtpServer:=value;
  209. end
  210. end
  211. end
  212. end;
  213. if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp','apachePort', value) then
  214. begin
  215. if value <> '' then apachePort:=value;
  216. end;
  217. if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp','mysqlPort', value) then
  218. begin
  219. if value <> '' then mysqlPort:=value;
  220. end;
  221. if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp','newPassword', value) then
  222. begin
  223. if value <> '' then newPassword:=value;
  224. end;
  225. // Prepare an object calle "Page" of type wpInstalling.
  226. // Object will be show later in NextButtonClick function.
  227. Page := CreateInputQueryPage(wpInstalling,
  228. CustomMessage('TechnicalParameters'), '',
  229. CustomMessage('IfFirstInstall'));
  230. // TODO Add control differently if first install or update
  231. if firstinstall
  232. then
  233. begin
  234. Page.Add(CustomMessage('SMTPServer'), False);
  235. Page.Add(CustomMessage('ApachePort'), False);
  236. Page.Add(CustomMessage('MySqlPort'), False);
  237. Page.Add(CustomMessage('MySqlPassword'), False);
  238. end
  239. else
  240. begin
  241. Page.Add(CustomMessage('SMTPServer'), False);
  242. Page.Add(CustomMessage('ApachePort'), False);
  243. Page.Add(CustomMessage('MySqlPort'), False);
  244. Page.Add(CustomMessage('MySqlPassword'), False);
  245. end;
  246. // Default values
  247. Page.Values[0] := smtpServer;
  248. Page.Values[1] := apachePort;
  249. Page.Values[2] := mysqlPort;
  250. Page.Values[3] := newPassword;
  251. end;
  252. //-----------------------------------------------
  253. // Stop all services (if exist)
  254. procedure close();
  255. var myResult: Integer;
  256. begin
  257. path := ExpandConstant('{app}');
  258. pfPath := ExpandConstant('{pf}');
  259. winPath := ExpandConstant('{win}');
  260. pathWithSlashes := path;
  261. StringChange (pathWithSlashes, '\','/');
  262. batFile := path+'\stopdoliwamp.bat';
  263. Exec(batFile, '',path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  264. end;
  265. //-----------------------------------------------------------
  266. // Install pages
  267. function NextButtonClick(CurPageID: Integer): Boolean;
  268. var myResult: Integer;
  269. var res: Boolean;
  270. var paramok: Boolean;
  271. var datadirold: String;
  272. var datadirnew: String;
  273. var exedirold: String;
  274. var exedirnew: String;
  275. var themessage: String;
  276. begin
  277. res := True;
  278. //MsgBox(''+CurPageID,mbConfirmation,MB_YESNO);
  279. if CurPageID = Page.ID then
  280. begin
  281. // This must be in if curpage.id = page.id, otherwise it is executed after each Next button
  282. path := ExpandConstant('{app}');
  283. winPath := ExpandConstant('{win}');
  284. pathWithSlashes := path;
  285. StringChange (pathWithSlashes, '\','/');
  286. datadirold := pathWithSlashes+'/bin/mysql/mysql5.0.45/data';
  287. datadirnew := pathWithSlashes+'/bin/mysql/data';
  288. exedirold := pathWithSlashes+'/bin/mysql/mysql5.0.45';
  289. exedirnew := pathWithSlashes+'/bin/mysql/mysql5.0.45';
  290. // If we have a new database version, we should only copy old my.ini file into new directory
  291. // and change only all basedir= strings to use new version. Like this, data dir is still correct.
  292. // Install of service and stop/start scripts are already rebuild by installer.
  293. // FileCopy(exedirold+'/my.ini',exedirnew+'/my.ini', true);
  294. // We should not need this, also databases may not be called dolibarr
  295. // res := RenameFile(ibdata1dirold+'/dolibarr',ibdata1dirnew+'/dolibarr');
  296. // if res then
  297. // begin
  298. // themessage := CustomMessage('OldVersionFoundAndMoveInNew');
  299. // MsgBox(themessage,mbInformation,MB_OK);
  300. // TODO Replace also mysql.ini and resintall service
  301. // end
  302. // else
  303. // begin
  304. // themessage := CustomMessage('OldVersionFoundButFailedToMoveInNew');
  305. // MsgBox(themessage,mbInformation,MB_OK);
  306. // end;
  307. //----------------------------------------------
  308. // Copie des dll de php vers apache
  309. //----------------------------------------------
  310. // TODO Update this list when changing PHP/Apache versions
  311. phpDllCopy := 'fdftk.dll';
  312. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  313. phpDllCopy := 'fribidi.dll';
  314. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  315. phpDllCopy := 'gds32.dll';
  316. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  317. phpDllCopy := 'libeay32.dll';
  318. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  319. phpDllCopy := 'libmhash.dll';
  320. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  321. phpDllCopy := 'libmysql.dll';
  322. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  323. phpDllCopy := 'libpq.dll';
  324. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  325. phpDllCopy := 'msql.dll';
  326. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  327. phpDllCopy := 'libmcrypt.dll';
  328. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  329. phpDllCopy := 'libmysqli.dll';
  330. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  331. phpDllCopy := 'ntwdblib.dll';
  332. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  333. phpDllCopy := 'php5activescript.dll';
  334. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  335. phpDllCopy := 'php5isapi.dll';
  336. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  337. phpDllCopy := 'php5nsapi.dll';
  338. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  339. phpDllCopy := 'php5ts.dll';
  340. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  341. phpDllCopy := 'ssleay32.dll';
  342. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  343. phpDllCopy := 'yaz.dll';
  344. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  345. // Remove lock file
  346. lockfile := pathWithSlashes+'/dolibarr_documents/install.lock';
  347. if FileExists (lockfile) and not DeleteFile(lockfile) then
  348. begin
  349. themessage := FmtMessage(CustomMessage('FailedToDeleteLock'),[pathWithSlashes]);
  350. MsgBox(themessage,mbInformation,MB_OK);
  351. end
  352. // Check if parameters already defined in conf.php file
  353. srcFile := pathWithSlashes+'/www/dolibarr/htdocs/conf/conf.php';
  354. if not FileExists (srcFile) then
  355. begin
  356. firstinstall := true;
  357. // Values from wizard
  358. mysmtp := Page.Values[0];
  359. myporta := Page.Values[1];
  360. myportas:= '443';
  361. myport := Page.Values[2];
  362. mypass := Page.Values[3];
  363. end
  364. else
  365. begin
  366. firstinstall := false;
  367. // Values from registry
  368. mysmtp := smtpServer;
  369. myporta := apachePort;
  370. myportas:= '443';
  371. myport := mysqlPort;
  372. mypass := newPassword;
  373. end;
  374. paramok := True;
  375. // TODO Test if choice of param is ok if firstinstall
  376. if (firstinstall) then
  377. begin
  378. // Test serveur SMTP
  379. // if paramok then
  380. // begin
  381. // batFile := pathWithSlashes+'/UsedPort.exe';
  382. // MsgBox('batFile = '+batFile,mbConfirmation,MB_YESNO)
  383. // Exec(batFile, '-s '+smtpServer+' -p 25', path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  384. //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).';
  385. // 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 ?';
  386. // if ((IntToStr(myResult) <> '0') and (MsgBox(themessage,mbConfirmation,MB_YESNO) = IDYES)) then
  387. // begin
  388. // paramok := False;
  389. // end;
  390. // end;
  391. if paramok then
  392. begin
  393. // Test port Apache
  394. batFile := pathWithSlashes+'/UsedPort.exe';
  395. //MsgBox('batFile = '+batFile,mbConfirmation,MB_YESNO)
  396. Exec(batFile, '-s localhost -p '+myporta, path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  397. //themessage := 'Le port '+myporta+' semble deja pris. Revenez en arriere pour choisir une autre valeur pour le port Apache.';
  398. themessage := FmtMessage(CustomMessage('PortAlreadyInUse'),[myporta,'Apache']);
  399. if ((IntToStr(myResult) = '0') and (MsgBox(themessage,mbConfirmation,MB_YESNO) = IDYES)) then
  400. begin
  401. paramok := False;
  402. end;
  403. end;
  404. if paramok then
  405. begin
  406. // Test port Mysql
  407. batFile := pathWithSlashes+'/UsedPort.exe';
  408. //MsgBox('batFile = '+batFile,mbConfirmation,MB_YESNO)
  409. Exec(batFile, '-s localhost -p '+myport, path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  410. //themessage := 'Le port '+myport+' semble deja pris. Revenez en arriere pour choisir une autre valeur pour le port MySQL.';
  411. themessage := FmtMessage(CustomMessage('PortAlreadyInUse'),[myport,'MySql']);
  412. if ((IntToStr(myResult) = '0') and (MsgBox(themessage,mbConfirmation,MB_YESNO) = IDYES)) then
  413. begin
  414. paramok := False;
  415. end;
  416. end;
  417. end;
  418. if paramok
  419. then
  420. begin
  421. //----------------------------------------------
  422. // Rename file c:/windows/php.ini (we don't want it)
  423. //----------------------------------------------
  424. if FileExists ('c:/windows/php.ini') then
  425. begin
  426. 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
  427. begin
  428. RenameFile('c:/windows/php.ini','c:/windows/php_old.ini');
  429. end;
  430. end;
  431. if FileExists ('c:/winnt/php.ini') then
  432. begin
  433. 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
  434. begin
  435. RenameFile('c:/winnt/php.ini','c:/winnt/php_old.ini');
  436. end;
  437. end;
  438. //----------------------------------------------
  439. // Create rundoliwamp.bat, rundolihelp.bat and rundoliadmin.bat (if not exists)
  440. //----------------------------------------------
  441. destFile := pathWithSlashes+'/rundoliwamp.bat';
  442. srcFile := pathWithSlashes+'/rundoliwamp.bat.install';
  443. destFileH := pathWithSlashes+'/rundolihelp.bat';
  444. srcFileH := pathWithSlashes+'/rundolihelp.bat.install';
  445. destFileA := pathWithSlashes+'/rundoliadmin.bat';
  446. srcFileA := pathWithSlashes+'/rundoliadmin.bat.install';
  447. if (not FileExists (destFile) or not FileExists (destFileH) or not FileExists (destFileA))
  448. and (FileExists(srcFile) and FileExists(srcFileH) and FileExists(srcFileA)) then
  449. begin
  450. //navigateur
  451. browser := 'iexplore.exe';
  452. if FileExists (pfPath+'/Mozilla Firefox/firefox.exe') then
  453. begin
  454. if MsgBox(CustomMessage('FirefoxDetected'),mbConfirmation,MB_YESNO) = IDYES then
  455. begin
  456. browser := pfPath+'/Mozilla Firefox/firefox.exe';
  457. end;
  458. end;
  459. if browser = 'iexplore.exe' then
  460. begin
  461. GetOpenFileName(CustomMessage('ChooseDefaultBrowser'), browser, winPath,'exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe');
  462. end;
  463. LoadStringFromFile (srcFile, srcContents);
  464. StringChangeEx (srcContents, 'WAMPBROWSER', browser, True);
  465. StringChangeEx (srcContents, 'WAMPAPACHEPORT', myporta, True);
  466. StringChangeEx (srcContents, 'WAMPAPACHEPSSL', myportas, True);
  467. SaveStringToFile(destFile,srcContents, False);
  468. LoadStringFromFile (srcFileH, srcContents);
  469. StringChangeEx (srcContents, 'WAMPBROWSER', browser, True);
  470. StringChangeEx (srcContents, 'WAMPAPACHEPORT', myporta, True);
  471. StringChangeEx (srcContents, 'WAMPAPACHEPSSL', myportas, True);
  472. SaveStringToFile(destFileH,srcContents, False);
  473. LoadStringFromFile (srcFileA, srcContents);
  474. StringChangeEx (srcContents, 'WAMPBROWSER', browser, True);
  475. StringChangeEx (srcContents, 'WAMPAPACHEPORT', myporta, True);
  476. StringChangeEx (srcContents, 'WAMPAPACHEPSSL', myportas, True);
  477. SaveStringToFile(destFileA,srcContents, False);
  478. end
  479. if MsgBox(CustomMessage('DoliWampWillStartApacheMysql'),mbConfirmation,MB_YESNO) = IDYES then
  480. begin
  481. //----------------------------------------------
  482. // Create file alias phpmyadmin (always)
  483. //----------------------------------------------
  484. destFile := pathWithSlashes+'/alias/phpmyadmin.conf';
  485. srcFile := pathWithSlashes+'/alias/phpmyadmin.conf.install';
  486. if FileExists(srcFile) then
  487. begin
  488. LoadStringFromFile (srcFile, srcContents);
  489. //installDir et version de phpmyadmin
  490. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  491. StringChangeEx (srcContents, 'WAMPPHPMYADMINVERSION', phpmyadminVersion, True);
  492. SaveStringToFile(destFile,srcContents, False);
  493. end
  494. DeleteFile(srcFile);
  495. //----------------------------------------------
  496. // Create file alias dolibarr (if not exists)
  497. //----------------------------------------------
  498. destFile := pathWithSlashes+'/alias/dolibarr.conf';
  499. srcFile := pathWithSlashes+'/alias/dolibarr.conf.install';
  500. if not FileExists (destFile) and FileExists(srcFile) then
  501. begin
  502. LoadStringFromFile (srcFile, srcContents);
  503. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  504. StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
  505. SaveStringToFile(destFile, srcContents, False);
  506. end
  507. DeleteFile(srcFile);
  508. //----------------------------------------------
  509. // Create file configuration for phpmyadmin (if not exists)
  510. //----------------------------------------------
  511. destFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php';
  512. srcFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php.install';
  513. if not FileExists (destFile) and FileExists (srcFile) then
  514. begin
  515. // sinon on prends le fichier par defaut
  516. LoadStringFromFile (srcFile, srcContents);
  517. StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
  518. StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
  519. SaveStringToFile(destFile,srcContents, False);
  520. end
  521. //----------------------------------------------
  522. // Create file httpd.conf (if not exists)
  523. //----------------------------------------------
  524. destFile := pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/conf/httpd.conf';
  525. srcFile := pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/conf/httpd.conf.install';
  526. if not FileExists (destFile) and FileExists (srcFile) then
  527. begin
  528. LoadStringFromFile (srcFile, srcContents);
  529. //installDir et version de php
  530. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  531. StringChangeEx (srcContents, 'WAMPPHPVERSION', phpVersion, True);
  532. StringChangeEx (srcContents, 'WAMPAPACHEPORT', myporta, True);
  533. StringChangeEx (srcContents, 'WAMPAPACHEPSSL', myportas, True);
  534. SaveStringToFile(destFile,srcContents, False);
  535. end
  536. //----------------------------------------------
  537. // Create file my.ini (if not exists)
  538. //----------------------------------------------
  539. destFile := pathWithSlashes+'/bin/mysql/mysql'+mysqlVersion+'/my.ini';
  540. srcFile := pathWithSlashes+'/bin/mysql/mysql'+mysqlVersion+'/my.ini.install';
  541. if not FileExists (destFile) then
  542. begin
  543. LoadStringFromFile (srcFile, srcContents);
  544. //installDir et version de php
  545. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  546. StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
  547. SaveStringToFile(destFile,srcContents, False);
  548. end
  549. //----------------------------------------------
  550. // Create file index.php (always but archive if exists)
  551. //----------------------------------------------
  552. destFile := pathWithSlashes+'/www/index.php';
  553. srcFile := pathWithSlashes+'/www/index.php.install';
  554. if not FileExists (destFile) then
  555. begin
  556. LoadStringFromFile (srcFile, srcContents);
  557. StringChangeEx (srcContents, 'WAMPPHPVERSION', phpVersion, True);
  558. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  559. StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
  560. StringChangeEx (srcContents, 'WAMPAPACHEPORT', myporta, True);
  561. StringChangeEx (srcContents, 'WAMPAPACHEPSSL', myportas, True);
  562. SaveStringToFile(destFile, srcContents, False);
  563. end
  564. else
  565. begin
  566. RenameFile(destFile, destFile+'.old');
  567. LoadStringFromFile (srcFile, srcContents);
  568. StringChangeEx (srcContents, 'WAMPPHPVERSION', phpVersion, True);
  569. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  570. StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
  571. StringChangeEx (srcContents, 'WAMPAPACHEPORT', myporta, True);
  572. StringChangeEx (srcContents, 'WAMPAPACHEPSSL', myportas, True);
  573. SaveStringToFile(destFile, srcContents, False);
  574. end
  575. //----------------------------------------------
  576. // Create file dolibarr parametres predefinis install web (if not exists)
  577. //----------------------------------------------
  578. destFile := pathWithSlashes+'/www/dolibarr/htdocs/install/install.forced.php';
  579. srcFile := pathWithSlashes+'/www/dolibarr/htdocs/install/install.forced.php.install';
  580. if not FileExists (destFile) and FileExists (srcFile) then
  581. begin
  582. LoadStringFromFile (srcFile, srcContents);
  583. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  584. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  585. StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
  586. StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
  587. SaveStringToFile(destFile,srcContents, False);
  588. end
  589. //----------------------------------------------
  590. // Create file install_services.bat (always)
  591. //----------------------------------------------
  592. destFile := pathWithSlashes+'/install_services.bat';
  593. srcFile := pathWithSlashes+'/install_services.bat.install';
  594. if FileExists(srcFile) then
  595. begin
  596. LoadStringFromFile (srcFile, srcContents);
  597. //version de apache et mysql
  598. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  599. StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
  600. SaveStringToFile(destFile,srcContents, False);
  601. end
  602. //----------------------------------------------
  603. // Create file install_services_auto.bat (always)
  604. //----------------------------------------------
  605. destFile := pathWithSlashes+'/install_services_auto.bat';
  606. srcFile := pathWithSlashes+'/install_services_auto.bat.install';
  607. if FileExists (srcFile) then
  608. begin
  609. LoadStringFromFile (srcFile, srcContents);
  610. //version de apache et mysql
  611. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  612. StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
  613. SaveStringToFile(destFile,srcContents, False);
  614. end
  615. //----------------------------------------------
  616. // Create file uninstall_services.bat (always)
  617. //----------------------------------------------
  618. destFile := pathWithSlashes+'/uninstall_services.bat';
  619. srcFile := pathWithSlashes+'/uninstall_services.bat.install';
  620. if FileExists (srcFile) then
  621. begin
  622. LoadStringFromFile (srcFile, srcContents);
  623. //version de apache et mysql
  624. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  625. StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
  626. SaveStringToFile(destFile,srcContents, False);
  627. end
  628. //----------------------------------------------
  629. // Create file mysqlinitpassword.bat (always)
  630. //----------------------------------------------
  631. destFile := pathWithSlashes+'/mysqlinitpassword.bat';
  632. srcFile := pathWithSlashes+'/mysqlinitpassword.bat.install';
  633. if FileExists (srcFile) then
  634. begin
  635. LoadStringFromFile (srcFile, srcContents);
  636. //version de apache et mysql
  637. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  638. StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
  639. StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
  640. SaveStringToFile(destFile,srcContents, False);
  641. end
  642. //----------------------------------------------
  643. // Create file mysqltestinstall.bat (always)
  644. //----------------------------------------------
  645. destFile := pathWithSlashes+'/mysqltestinstall.bat';
  646. srcFile := pathWithSlashes+'/mysqltestinstall.bat.install';
  647. if FileExists (srcFile) then
  648. begin
  649. LoadStringFromFile (srcFile, srcContents);
  650. //version de apache et mysql
  651. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  652. StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
  653. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  654. StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
  655. SaveStringToFile(destFile,srcContents, False);
  656. end
  657. //----------------------------------------------
  658. // Create file startdoliwamp_manual_donotuse.bat (always)
  659. //----------------------------------------------
  660. destFile := pathWithSlashes+'/startdoliwamp_manual_donotuse.bat';
  661. srcFile := pathWithSlashes+'/startdoliwamp_manual_donotuse.bat.install';
  662. if FileExists (srcFile) then
  663. begin
  664. LoadStringFromFile (srcFile, srcContents);
  665. //version de apache et mysql
  666. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  667. StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
  668. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  669. StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
  670. SaveStringToFile(destFile,srcContents, False);
  671. end
  672. //----------------------------------------------
  673. // Create file builddemosslfiles.bat (always)
  674. //----------------------------------------------
  675. destFile := pathWithSlashes+'/builddemosslfiles.bat';
  676. srcFile := pathWithSlashes+'/builddemosslfiles.bat.install';
  677. if FileExists (srcFile) then
  678. begin
  679. LoadStringFromFile (srcFile, srcContents);
  680. //version de apache et mysql
  681. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  682. StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
  683. SaveStringToFile(destFile,srcContents, False);
  684. end
  685. //----------------------------------------------
  686. // Create file php.ini in php (if not exists)
  687. //----------------------------------------------
  688. destFile := pathWithSlashes+'/bin/php/php'+phpVersion+'/php.ini';
  689. srcFile := pathWithSlashes+'/bin/php/php'+phpVersion+'/php.ini.install';
  690. if not FileExists (destFile) and FileExists(srcFile) then
  691. begin
  692. LoadStringFromFile (srcFile, srcContents);
  693. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  694. StringChangeEx (srcContents, 'WAMPSMTP', mysmtp, True);
  695. SaveStringToFile(destFile,srcContents, False);
  696. end
  697. //----------------------------------------------
  698. // Create file php.ini in apache (if not exists)
  699. //----------------------------------------------
  700. destFile := pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/php.ini';
  701. srcFile := pathWithSlashes+'/bin/php/php'+phpVersion+'/php.ini.install';
  702. if not FileExists (destFile) and FileExists(srcFile) then
  703. begin
  704. LoadStringFromFile (srcFile, srcContents);
  705. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  706. StringChangeEx (srcContents, 'WAMPSMTP', mysmtp, True);
  707. SaveStringToFile(destFile,srcContents, False);
  708. end
  709. // Uninstall and Install services
  710. batFile := path+'\uninstall_services.bat';
  711. Exec(batFile, '',path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  712. batFile := path+'\install_services.bat';
  713. Exec(batFile, '',path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  714. // Start services
  715. batFile := path+'\startdoliwamp.bat';
  716. Exec(batFile, '',path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  717. //MsgBox(myResult,mbInformation,MB_OK);
  718. // Change mysql password (works only if not yet defined)
  719. batFile := path+'\mysqlinitpassword.bat';
  720. Exec(batFile, '',path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  721. // Remove dangerous files
  722. batFile := path+'\removefiles.bat';
  723. Exec(batFile, '',path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  724. // Save parameters to registry
  725. RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp', 'smtpServer', mysmtp);
  726. RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp', 'apachePort', myporta);
  727. RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp', 'apachePSSL', myportas);
  728. RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp', 'mysqlPort', myport);
  729. RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp', 'newPassword', mypass);
  730. res := True;
  731. end
  732. else
  733. begin
  734. // MsgBox('Apache and Mysql installation has been canceled. Please select parameters to start their installation.',mbInformation,MB_OK)
  735. res := False;
  736. end
  737. end
  738. else
  739. begin
  740. //MsgBox('Selected values seems to be already used. Please choose other values.',mbInformation,MB_OK);
  741. res := False;
  742. end
  743. end
  744. Result := res;
  745. end;
  746. //-----------------------------------------------
  747. //procedure launched by the end of the installation, it deletes the installation files
  748. procedure DeinitializeSetup();
  749. begin
  750. // DeleteFile(path+'\install_services.bat');
  751. // DeleteFile(path+'\install_services_auto.bat');
  752. end;
  753. //-----------------------------------------------
  754. //procedure launched at beginning of the uninstallation
  755. function InitializeUninstall(): Boolean;
  756. begin
  757. Result := RegDeleteValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp','smtpServer');
  758. Result := RegDeleteValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp','apachePort');
  759. Result := RegDeleteValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp','mysqlPort');
  760. Result := RegDeleteValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp','newPassword');
  761. Result := RegDeleteKeyIncludingSubkeys(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp');
  762. Result := True;
  763. end;
  764. //-----------------------------------------------
  765. //procedure launched by the end of the uninstallation
  766. procedure DeinitializeUninstall();
  767. begin
  768. path := ExpandConstant('{app}');
  769. winPath := ExpandConstant('{win}');
  770. pathWithSlashes := path;
  771. StringChange (pathWithSlashes, '\','/');
  772. MsgBox(FmtMessage(CustomMessage('ProgramHasBeenRemoved'),[path]),mbInformation,MB_OK);
  773. end;
  774. [Run]
  775. ; Launch Dolibarr in browser. This is run after Wizard because of postinstall flag
  776. Filename: "{app}\rundoliwamp.bat"; Description: {cm:LaunchNow}; Flags: shellexec postinstall skipifsilent runhidden
  777. [UninstallDelete]
  778. Type: files; Name: "{app}\*.*"
  779. Type: files; Name: "{app}\bin\mysql\mysql5.0.45\*.*"
  780. Type: filesandordirs; Name: "{app}\alias"
  781. Type: filesandordirs; Name: "{app}\apps"
  782. Type: filesandordirs; Name: "{app}\bin\apache"
  783. Type: filesandordirs; Name: "{app}\bin\php"
  784. Type: filesandordirs; Name: "{app}\help"
  785. Type: filesandordirs; Name: "{app}\lang"
  786. Type: filesandordirs; Name: "{app}\logs"
  787. Type: filesandordirs; Name: "{app}\scripts"
  788. Type: filesandordirs; Name: "{app}\tmp"
  789. Type: filesandordirs; Name: "{app}\www\dolibarr"
  790. [UninstallRun]
  791. Filename: "{app}\uninstall_services.bat"; Flags: runhidden