|
1 Page custom StackSelectCreate StackSelectLeave " - Select stack" |
|
2 |
|
3 Function StackSelectCreate |
|
4 ; Only show this page if both WAMPStack and WAPPStack are installed. |
|
5 StrCmp $wampstack_installed 0 "" +3 |
|
6 Call StackSelectLeave |
|
7 Return |
|
8 StrCmp $wappstack_installed 0 "" +3 |
|
9 Call StackSelectLeave |
|
10 Return |
|
11 StrCmp $XPUI_ABORTED 1 "" +2 |
|
12 Abort |
|
13 |
|
14 !insertmacro XPUI_INSTALLOPTIONS_EXTRACT_AS "pages\StackSelect.ini" "StackSelect.ini" |
|
15 !insertmacro XPUI_HEADER_TEXT "Select server stack" "Choose which BitNami stack installation you want to use to run $(^Name)." |
|
16 !insertmacro XPUI_INSTALLOPTIONS_DISPLAY "StackSelect.ini" |
|
17 FunctionEnd |
|
18 |
|
19 Function StackSelectLeave |
|
20 ; Here is where we make the final decision on which stack will be used. |
|
21 IfFileExists "$PLUGINSDIR\StackSelect.ini" "" OnlyOneStackInstalled |
|
22 |
|
23 !macro ConfigCheck |
|
24 IfFileExists "$stack_instdir\apps\${PRODUCT_SHORTNAME}\htdocs\config.php" 0 +3 |
|
25 MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2 "Setup has found that $(^Name) is already installed on this stack. If you continue, the existing installation's configuration file will be deleted and your existing website will be replaced with a fresh one.$\n$\nDo you want to delete your existing $(^Name) website?" IDYES +2 |
|
26 Abort |
|
27 !macroend |
|
28 |
|
29 ; Both stacks are installed; decide based on user selection |
|
30 ReadINIStr $0 "$PLUGINSDIR\StackSelect.ini" "Field 1" "State" |
|
31 StrCmp $0 1 "" UserSelectedWAPP |
|
32 ; User selected WAMP |
|
33 Call BNSetVarsForWAMP |
|
34 !insertmacro ConfigCheck |
|
35 Return |
|
36 |
|
37 UserSelectedWAPP: |
|
38 ; User selected WAPP |
|
39 Call BNSetVarsForWAPP |
|
40 !insertmacro ConfigCheck |
|
41 Return |
|
42 |
|
43 OnlyOneStackInstalled: |
|
44 StrCmp $wampstack_installed 0 +3 |
|
45 ; MySQL |
|
46 Call BNSetVarsForWAMP |
|
47 !insertmacro ConfigCheck |
|
48 Return |
|
49 |
|
50 ; PostgreSQL |
|
51 Call BNSetVarsForWAPP |
|
52 !insertmacro ConfigCheck |
|
53 Return |
|
54 FunctionEnd |
|
55 |
|
56 Function BNSetVarsForWAMP |
|
57 StrCpy $stack_type "WAMP" |
|
58 StrCpy $stack_instdir "$wampstack_installed" |
|
59 StrCpy $db_driver "mysql" |
|
60 StrCpy $db_dbmsname "MySQL" |
|
61 StrCpy $db_rootuser "root" |
|
62 ReadINIStr $db_port "$stack_instdir\properties.ini" "MySQL" "mysql_port" |
|
63 |
|
64 StrCpy $stack_portbit "" |
|
65 ReadINIStr $0 "$stack_instdir\properties.ini" "Apache" "apache_server_port" |
|
66 StrCmp $0 "80" +2 |
|
67 StrCpy $stack_portbit ":$0" |
|
68 FunctionEnd |
|
69 |
|
70 Function BNSetVarsForWAPP |
|
71 StrCpy $stack_type "WAPP" |
|
72 StrCpy $stack_instdir "$wappstack_installed" |
|
73 StrCpy $db_driver "postgresql" |
|
74 StrCpy $db_dbmsname "PostgreSQL" |
|
75 StrCpy $db_rootuser "postgres" |
|
76 ; NOTE: WAPPStack doesn't record the port of PostgreSQL - we have to assume the default |
|
77 StrCpy $db_port 5432 |
|
78 |
|
79 StrCpy $stack_portbit "" |
|
80 ReadINIStr $0 "$stack_instdir\properties.ini" "Apache" "apache_server_port" |
|
81 StrCmp $0 "80" +2 |
|
82 StrCpy $stack_portbit ":$0" |
|
83 FunctionEnd |