# HG changeset patch
# User Dan
# Date 1243400723 14400
# Node ID 67e1cc6cd929a9969ac63a447e5308d8ff48823b
First commit. It's working!
diff -r 000000000000 -r 67e1cc6cd929 enano-bundle.nsi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/enano-bundle.nsi Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,276 @@
+; Script generated by the HM NIS Edit Script Wizard.
+
+; HM NIS Edit Wizard helper defines
+!define PRODUCT_NAME "Enano CMS"
+!define PRODUCT_VERSION "1.1.6"
+!define PRODUCT_PUBLISHER "Enano CMS Project"
+!define PRODUCT_WEB_SITE "http://enanocms.org"
+!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
+!define PRODUCT_UNINST_ROOT_KEY "HKLM"
+!define PRODUCT_SHORTNAME "enanocms"
+
+!ifndef ENANO_ROOT
+!define ENANO_ROOT "Q:\enano-1.1\repo"
+!endif
+
+SetCompressor /FINAL /SOLID lzma
+CRCCheck force
+
+Var wampstack_installed
+Var wappstack_installed
+Var stack_type
+Var stack_instdir
+Var stack_portbit
+Var db_dbmsname
+Var db_rootuser
+Var db_rootpass
+Var db_needroot
+Var db_driver
+Var db_port
+Var db_user
+Var db_password
+Var db_name
+Var enano_user
+Var enano_password
+Var admin_email
+Var site_name
+Var site_desc
+Var site_copyright
+Var url_scheme
+Var start_with
+
+!include "inst-resources\bitnamiutils.nsh"
+!include "inst-resources\dbal.nsh"
+!include "inst-resources\mysql.nsh"
+!include "inst-resources\postgresql.nsh"
+!include "inst-resources\str_replace.nsh"
+!include "inst-resources\kickstart.nsh"
+!include "inst-resources\apacheconfig.nsh"
+!include "inst-resources\applist.nsh"
+
+Function .onInit
+ Call BNSetWAMPInstalledFlag
+ Call BNSetWAPPInstalledFlag
+
+ ; If neither WAMP nor WAPP is installed, die
+ StrCmp $wampstack_installed 0 "" FoundStack
+ StrCmp $wampstack_installed 0 "" FoundStack
+
+ MessageBox MB_OK|MB_ICONEXCLAMATION "Setup could not find any BitNami stacks on your server.$\r$\n\
+ $\r$\n\
+ Please install a BitNami stack and re-run setup. You can download a BitNami stack for free from http://www.bitnami.org."
+ Abort
+
+ FoundStack:
+FunctionEnd
+
+; ExperienceUI GUI parameters
+!define XPUI_BGIMAGE
+!define XPUI_BGIMAGE_BMP "gfx\enano-bg.bmp"
+!define XPUI_TEXT_COLOR "F2F2F2"
+!define XPUI_TEXT_BGCOLOR "202020" ; irrelevant but still
+!define XPUI_TEXT_LIGHTCOLOR "B4C3EA"
+!define XPUI_ABORTWARNING
+!define XPUI_BRANDINGTEXT "NSIS Installer ${NSIS_VERSION}"
+!define XPUI_BRANDINGTEXT_COLOR_FG "b6d9ff"
+!define XPUI_BRANDINGTEXT_COLOR_BG "4c5b6b"
+!define XPUI_FASTERSKINNING
+
+; MUI 1.67 compatible / XPUI 1.11 (2.0pre) compatible ------
+!ifndef XPUI_SYSDIR
+ !define XPUI_SYSDIR "C:\ExperienceUI\Contrib\ExperienceUI"
+!endif
+!include "${XPUI_SYSDIR}\..\..\Include\XPUI.nsh"
+
+; MUI Settings
+!define MUI_ABORTWARNING
+!define MUI_ICON "inst-resources\generic-install.ico"
+!define MUI_UNICON "inst-resources\generic-uninstall.ico"
+!include "WinMessages.nsh"
+
+; Welcome page
+!insertmacro XPUI_PAGE_WELCOME2
+; License page
+!insertmacro MUI_PAGE_LICENSE "licenses\GPL.txt"
+; Stack selection - automatic unless both stacks are installed
+!include "pages\StackSelect.nsi"
+; Database credentials entry
+!include "pages\DatabaseConfig.nsi"
+; Site config page
+!include "pages\SiteConfig.nsi"
+; User credentials page
+!include "pages\Login.nsi"
+; Components page
+!insertmacro MUI_PAGE_COMPONENTS
+; Instfiles page
+!insertmacro MUI_PAGE_INSTFILES
+; Finish page
+!define XPUI_FINISHPAGE_RUN
+!define XPUI_FINISHPAGE_CHECKBOX_RUN "Go to my new $(^Name) website now"
+!define XPUI_FINISHPAGE_RUN_FUNCTION OpenBitnamiWebsite
+Function OpenBitnamiWebsite
+ ExecShell open "http://localhost$stack_portbit/${PRODUCT_SHORTNAME}/"
+FunctionEnd
+!insertmacro MUI_PAGE_FINISH
+
+!insertmacro XPUI_PAGE_ABORT
+
+; Uninstaller pages
+!insertmacro MUI_UNPAGE_INSTFILES
+
+; Language files
+!insertmacro MUI_LANGUAGE "English"
+
+; Reserve files
+!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
+
+; MUI end ------
+
+; File lists
+!include "inst-resources\core-files.nsh"
+; End file lists
+
+Name "${PRODUCT_NAME}"
+Caption "${PRODUCT_NAME} ${PRODUCT_VERSION} Bitnami installer"
+OutFile "enano-1.1.6-bitnami-setup.exe"
+InstallDir "$PROGRAMFILES\Enano CMS"
+ShowInstDetails show
+ShowUnInstDetails show
+
+Section "-pre"
+ StrCpy $INSTDIR "$stack_instdir"
+ IfFileExists "$INSTDIR\apps\${PRODUCT_SHORTNAME}\htdocs\config.php" 0 +2
+ Delete "$INSTDIR\apps\${PRODUCT_SHORTNAME}\htdocs\config.php"
+SectionEnd
+
+Section "-DatabaseSetup"
+ StrCmp $db_needroot 1 +2
+ Return
+
+ ; Create database
+ ${db_create} $R0 "$db_rootuser" "$db_rootpass" "$db_name" "$db_user" "$db_password"
+ IntCmp $R0 0 DatabaseCreateSuccess
+ !insertmacro XPUI_HEADER_TEXT "Installation failed" "Could not create the database."
+ DetailPrint "Database creation failed."
+ MessageBox MB_OK|MB_ICONEXCLAMATION "Setup failed to create the database for $(^Name).$\r$\n\
+ $\r$\n\
+ It's possible that your authentication details were rejected or that there \
+ is a bug in the installer. Try removing any special characters (especially \
+ quote symbols and backslashes) from your password. Make sure to use only \
+ letters, numbers, and underscores in the database name and username."
+ Abort
+ DatabaseCreateSuccess:
+SectionEnd
+
+Section "Enano Core" SEC01
+ SectionIn RO
+ !insertmacro Core_Install
+SectionEnd
+
+Section "Enable GMP in PHP" SecGMP
+ ClearErrors
+ WriteINIStr "$stack_instdir\php\php.ini" "GMP" "extension" "php_gmp.dll"
+ IfErrors 0 +2
+ MessageBox MB_OK|MB_ICONEXCLAMATION "GMP was not automatically enabled in PHP. Logins will be several seconds slower."
+SectionEnd
+
+Section "YubiKey auth plugin" SEC02
+SectionEnd
+
+Section "AjIM2" SEC03
+SectionEnd
+
+Section "Admin Alerts" SEC04
+SectionEnd
+
+Section "RSS Feeds" SEC06
+SectionEnd
+
+Section "News Portal" SEC08
+SectionEnd
+
+Section "Code syntax highlighting" SEC11
+SectionEnd
+
+Section "Wiki functionality extensions" SEC12
+SectionEnd
+
+Section -ConfigureApache
+ DetailPrint "Configuring Apache web server"
+ Call write_apache_config
+ DetailPrint "Restarting Apache"
+ nsExec::Exec '"$SYSDIR\net.exe" stop "$stack_typestackApache"'
+ nsExec::Exec '"$SYSDIR\net.exe" start "$stack_typestackApache"'
+SectionEnd
+
+Section -WriteKickStart
+ Call enano_write_kickstart_script
+SectionEnd
+
+Section -DoEnanoDBSetup
+ Call enano_run_kickstart_script
+SectionEnd
+
+Section -InsertApplistEntry
+ Call enano_add_to_applist
+SectionEnd
+
+Section -AdditionalIcons
+ WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
+ CreateDirectory "$SMPROGRAMS\Enano CMS"
+ CreateShortCut "$SMPROGRAMS\Enano CMS\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
+ CreateShortCut "$SMPROGRAMS\Enano CMS\Uninstall.lnk" "$INSTDIR\apps\${PRODUCT_SHORTNAME}\uninst.exe"
+SectionEnd
+
+Section -Post
+ WriteUninstaller "$INSTDIR\uninst.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
+ WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
+SectionEnd
+
+; Section descriptions
+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "Core components of Enano CMS, necessary to run Enano"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "Adds support for Yubikey authentication"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} "An AJAX chatbox sidebar gadget for Enano"
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} "Provides a sidebar block that alerts you about unapproved comments, inactive users, and pages with requested deletion."
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} "Provides the ability to generate RSS feeds based on the latest page edits and comments. It also has a plugin API so plugins can add their own feeds."
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} "Provides a portal with news and static content combined onto one page."
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC11} "Parser extension that adds syntax highlighting support using the GeSHi highlighting engine."
+ !insertmacro MUI_DESCRIPTION_TEXT ${SEC12} "Adds several parser extensions that provide MediaWiki-like behavior, including references (footnotes) and Table of Contents support."
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecGMP} "Enables PHP's GMP extension, which speeds up cryptographic operations."
+!insertmacro MUI_FUNCTION_DESCRIPTION_END
+
+
+Function un.onUninstSuccess
+ HideWindow
+ MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
+FunctionEnd
+
+Function un.onInit
+ MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
+ Abort
+FunctionEnd
+
+Section Uninstall
+ Delete "$INSTDIR\apps\${PRODUCT_SHORTNAME}\${PRODUCT_NAME}.url"
+
+ !insertmacro Core_Uninstall
+
+ DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
+ SetAutoClose true
+SectionEnd
+
+; Version Information
+
+VIProductVersion "1.1.6.0"
+VIAddVersionKey /LANG=1033 "ProductName" "Enano CMS"
+VIAddVersionKey /LANG=1033 "Setup Information" "Enano CMS installer module for Windows Apache stacks"
+VIAddVersionKey /LANG=1033 "Comments" "This installer contains a beta build of Enano CMS, use with caution!"
+VIAddVersionKey /LANG=1033 "Publisher Name" "Neal Gompa (King InuYasha), Enano CMS Project"
+VIAddVersionKey /LANG=1033 "LegalCopyright" "©2009 Enano CMS Project"
+VIAddVersionKey /LANG=1033 "FileDescription" "Enano - The CMS that focuses on what matters most: content."
+VIAddVersionKey /LANG=1033 "FileVersion" "${PRODUCT_VERSION}"
diff -r 000000000000 -r 67e1cc6cd929 gfx/application.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gfx/application.html Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,29 @@
+
+
+
+
diff -r 000000000000 -r 67e1cc6cd929 gfx/enano-bg.bmp
Binary file gfx/enano-bg.bmp has changed
diff -r 000000000000 -r 67e1cc6cd929 gfx/enanocms-module.png
Binary file gfx/enanocms-module.png has changed
diff -r 000000000000 -r 67e1cc6cd929 inst-resources/apacheconfig.nsh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/inst-resources/apacheconfig.nsh Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,74 @@
+/**
+ * Search the Apache configuration for the Include line for this package's Apache settings.
+ * @return int 0 if successful (found line); 1 if not found
+ */
+
+Function search_apache_config
+ FileOpen $0 "$INSTDIR\apache2\conf\httpd.conf" "r"
+ loop:
+ ClearErrors
+ FileRead $0 $1 1024
+ IfErrors done
+ Push $1
+ Push "Include "
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" loop
+ ; This is an include line
+ Push $1
+ Push "/apps/${PRODUCT_SHORTNAME}/"
+ Call StrStr
+ Pop $2
+ StrCmp $2 "" loop
+ ; We found it
+ Push 0
+ FileClose $0
+ Return
+ done:
+ FileClose $0
+ Push 1
+FunctionEnd
+
+Function write_apache_config
+ Call search_apache_config
+ Pop $0
+ IntCmp $0 1 +2 0 0
+ Goto WriteLocalConfig
+
+ ClearErrors
+ FileOpen $0 "$INSTDIR\apache2\conf\httpd.conf" "a"
+ IfErrors 0 +4
+ Push "write to the Apache configuration file"
+ Call ks_error
+ Return
+
+ FileSeek $0 0 END
+ FileWrite $0 "$\r$\nInclude $\"../apps/${PRODUCT_SHORTNAME}/conf/httpd.conf$\"$\r$\n"
+ FileClose $0
+
+ WriteLocalConfig:
+
+ ClearErrors
+ CreateDirectory "$INSTDIR\apps\${PRODUCT_SHORTNAME}\conf"
+ IfErrors 0 +4
+ Push "create the configuration directory"
+ Call ks_error
+ Return
+
+ ClearErrors
+ FileOpen $0 "$INSTDIR\apps\${PRODUCT_SHORTNAME}\conf\httpd.conf" "w"
+ IfErrors 0 +4
+ Push "write to the local configuration file"
+ Call ks_error
+ Return
+
+ FileWrite $0 "Alias /${PRODUCT_SHORTNAME} $\"../apps/${PRODUCT_SHORTNAME}/htdocs$\"$\r$\n$\r$\n"
+ FileWrite $0 "$\r$\n"
+ FileWrite $0 " Options -Indexes MultiViews FollowSymLinks$\r$\n"
+ FileWrite $0 " AllowOverride All$\r$\n"
+ FileWrite $0 " Order allow,deny$\r$\n"
+ FileWrite $0 " Allow from all$\r$\n"
+ FileWrite $0 "$\r$\n"
+ FileClose $0
+
+FunctionEnd
\ No newline at end of file
diff -r 000000000000 -r 67e1cc6cd929 inst-resources/applist.nsh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/inst-resources/applist.nsh Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,112 @@
+/**
+ * Inserts an HTML file at the necessary point in applications.html.
+ * @param string HTML file
+ */
+
+Function BNRegisterApplicationToList
+ ClearErrors
+
+ ; Make sure it's not already in there
+ FileOpen $0 "$stack_instdir\apache2\htdocs\applications.html" "r"
+ IfErrors 0 +3
+ SetErrors
+ Return
+
+ loop:
+ FileRead $0 $1
+ IfErrors EOF
+ Push $1
+ Push "Module ${PRODUCT_SHORTNAME}"
+ Call StrStr
+ Pop $1
+ StrCmp $1 "" +3
+ ; found it, skip write
+ FileClose $0
+ Return
+ Goto loop
+ EOF:
+ FileClose $0
+
+ Pop $0
+ Push "$stack_instdir\apache2\htdocs\applications.html"
+ Push $0
+ Push ""
+ Call AppendBeforeSubstring
+FunctionEnd
+
+Function AppendBeforeSubstring
+ Pop $R2 ; marker
+ Pop $R1 ; file to insert
+ Pop $R0 ; file to modify
+
+ StrCpy $R7 0 ; $R7 = current offset
+
+ ClearErrors
+ FileOpen $R3 $R0 "a" ; $R3 = handle
+ FileSeek $R3 0
+ IfErrors 0 +3
+ SetErrors
+ Return
+
+ loop:
+ FileRead $R3 $R4 ${NSIS_MAX_STRLEN} ; $R4 = line
+ IfErrors 0 +3
+ DetailPrint "EOF"
+ Goto EOF
+ StrLen $R8 $R4 ; $R8 = length of line
+ IntOp $R7 $R7 + $R8
+
+ Push $R4
+ Push $R2
+ Call StrStr
+ Pop $R5 ; $R5 = substring test
+ StrCmp $R5 "" /* no match */ loop
+
+ ; got a match!
+ StrLen $R6 $R5 ; Length of found substring
+ ; rewind a little bit, to right before the substring
+ IntOp $R8 $R7 - $R6
+ FileSeek $R3 -$R6 CUR $R5
+
+ ; store the rest of the file
+ StrCpy $R9 ""
+ remainderloop:
+ ClearErrors
+ FileRead $R3 $R7
+ StrCpy $R9 "$R9$R7"
+ IfErrors 0 remainderloop
+ ; now jump back to our point
+ FileSeek $R3 $R5
+
+ ; Now, write it all in
+ FileOpen $R4 $R1 "r"
+ IfErrors 0 +3
+ SetErrors
+ Return
+ loop2:
+ FileRead $R4 $R5 ${NSIS_MAX_STRLEN}
+ IfErrors EOF2
+ FileWrite $R3 $R5
+ Goto loop2
+ EOF2:
+ FileClose $R5
+
+ FileWrite $R3 $R9
+ EOF:
+ FileClose $R3
+FunctionEnd
+
+Function enano_add_to_applist
+ StrCmp $PLUGINSDIR "" 0 +2
+ InitPluginsDir
+
+ SetOutPath "$stack_instdir\apache2\htdocs\img"
+ File "gfx\enanocms-module.png"
+ SetOutPath "$PLUGINSDIR"
+ File "gfx\application.html"
+ Push "$PLUGINSDIR\application.html"
+ Call BNRegisterApplicationToList
+ IfErrors 0 +2
+ MessageBox MB_OK|MB_ICONEXCLAMATION "There was an error adding the application to the list."
+FunctionEnd
+
diff -r 000000000000 -r 67e1cc6cd929 inst-resources/bitnamiutils.nsh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/inst-resources/bitnamiutils.nsh Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,17 @@
+Function BNSetWAMPInstalledFlag
+ ClearErrors
+ ReadRegStr $wampstack_installed HKLM "Software\BitNami\BitNami WAMPStack" "Location"
+ IfErrors 0 +2
+ StrCpy $wampstack_installed 0
+
+ ClearErrors
+FunctionEnd
+
+Function BNSetWAPPInstalledFlag
+ ClearErrors
+ ReadRegStr $wappstack_installed HKLM "Software\BitNami\BitNami WAPPStack" "Location"
+ IfErrors 0 +2
+ StrCpy $wappstack_installed 0
+
+ ClearErrors
+FunctionEnd
\ No newline at end of file
diff -r 000000000000 -r 67e1cc6cd929 inst-resources/core-files.nsh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/inst-resources/core-files.nsh Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,15 @@
+!macro Core_Install
+ SetOverwrite try
+ SectionIn RO
+
+ ; not a huge deal if this fails, it just helps me avoid dumb mistakes.
+ !system 'hg -R "${ENANO_ROOT}" update'
+
+ SetOutPath "$INSTDIR\apps\${PRODUCT_SHORTNAME}\htdocs"
+ File /r /x .hg /x .hgtags "${ENANO_ROOT}"
+!macroend
+
+!macro Core_Uninstall
+ ; I'm sorry, but 1,000 files don't deserve to be listed out.
+ RmDir /r "$INSTDIR\apps\${PRODUCT_SHORTNAME}\htdocs"
+!macroend
diff -r 000000000000 -r 67e1cc6cd929 inst-resources/dbal.nsh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/inst-resources/dbal.nsh Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,27 @@
+!macro db_connect result user pass
+ Push "${user}"
+ Push "${pass}"
+ ClearErrors
+ StrCmp $db_driver "mysql" 0 +3
+ Call mysql_connect
+ Goto +2
+ Call postgresql_connect
+ Pop ${result}
+!macroend
+
+!define db_connect "!insertmacro db_connect"
+
+!macro db_create result user pass dbname nuser npass
+ Push "${user}"
+ Push "${pass}"
+ Push "${dbname}"
+ Push "${nuser}"
+ Push "${npass}"
+ StrCmp $db_driver "mysql" 0 +3
+ Call mysql_create_db
+ Goto +2
+ Call postgresql_create_db
+ Pop ${result}
+!macroend
+
+!define db_create "!insertmacro db_create"
\ No newline at end of file
diff -r 000000000000 -r 67e1cc6cd929 inst-resources/kickstart.nsh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/inst-resources/kickstart.nsh Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,61 @@
+; Now we're going to put the kickstart code into a separate file and try to keep it
+; as clean and human-readable as possible.
+
+!macro kickstart_var Var Value
+ ${str_replace} $1 "$$" "\$$" "${Value}"
+ FileWrite $0 "$$${Var} = <<0 on error. Will push an error string to the stack if >0.
+ */
+
+Function mysql_connect
+ Pop $R1 ; Password
+ Pop $R0 ; Username
+
+ SetOutPath $PLUGINSDIR
+ File "inst-resources\mysqlutil.php"
+
+ nsExec::ExecToLog '"$stack_instdir\php\php.exe" "$PLUGINSDIR\mysqlutil.php" $db_port "$R0" "$R1"'
+ Delete "$PLUGINSDIR\mysqlutil.php"
+ ; just be done; nsExec's result is on the top of the stack.
+FunctionEnd
+
+/**
+ * Create a MySQL database and grant privileges on it to the given user.
+ * @param string User to connect with
+ * @param string Password to connect with
+ * @param string Database name
+ * @param string New user
+ * @param string New user's password
+ */
+
+Function mysql_create_db
+ Pop $R5 ; Password
+ Pop $R4 ; User
+ Pop $R3 ; Database
+ Pop $R1 ; Password
+ Pop $R0 ; Username
+
+ ReadINIStr $R2 "$stack_instdir\properties.ini" "MySQL" "mysql_root_directory"
+ IfFileExists "$R2\data\$R3" 0 DatabaseDoesNotExist
+ MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2 "The database $\"$R3$\" already exists. Do you want to delete and recreate it?$\n$\nIf you choose No, Setup will not alter MySQL's permissions, and you may need to set up permissions manually." IDYES +2
+ Return
+
+ DatabaseDoesNotExist:
+
+ SetOutPath $PLUGINSDIR
+ File "inst-resources\mysqlutil.php"
+
+ nsExec::ExecToLog '"$stack_instdir\php\php.exe" "$PLUGINSDIR\mysqlutil.php" $db_port "$R0" "$R1" \
+ "DROP DATABASE IF EXISTS `$R3`; \
+ CREATE DATABASE `$R3`; \
+ GRANT ALL PRIVILEGES ON `$R3`.* TO `$R4`@localhost \
+ IDENTIFIED BY $\'$R5$\' WITH GRANT OPTION;"'
+ Delete "$PLUGINSDIR\mysqlutil.php"
+FunctionEnd
+
diff -r 000000000000 -r 67e1cc6cd929 inst-resources/mysqlutil.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/inst-resources/mysqlutil.php Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,31 @@
+0 on error. Will push an error string to the stack if >0.
+ */
+
+!macro postgresql_get_bin_dir
+ StrCpy $R2 "$stack_instdir\postgresql\bin"
+!macroend
+
+Function postgresql_connect
+ Pop $R1 ; Password
+ Pop $R0 ; Username
+
+ SetOutPath $PLUGINSDIR
+ File "inst-resources\postgresqlutil.php"
+
+ nsExec::ExecToLog '"$stack_instdir\php\php.exe" "$PLUGINSDIR\postgresqlutil.php" "$R0" "$R1"'
+ Delete "$PLUGINSDIR\postgresqlutil.php"
+ ; just be done; nsExec's result is on the top of the stack.
+FunctionEnd
+
+/**
+ * Create a postgresql database and grant privileges on it to the given user.
+ * @param string User to connect with
+ * @param string Password to connect with
+ * @param string Database name
+ * @param string New user
+ * @param string New user's password
+ */
+
+Function postgresql_create_db
+ Pop $R5 ; Password
+ Pop $R4 ; User
+ Pop $R3 ; Database
+ Pop $R1 ; Password
+ Pop $R0 ; Username
+
+ /*
+ ; This isn't a working feature in PostgreSQL.
+ IfFileExists "$stack_instdir\postgresql\data\$R3" 0 DatabaseDoesNotExist
+ MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2 "The database $\"$R3$\" already exists. Do you want to delete and recreate it?$\n$\nIf you choose No, Setup will not alter PostgreSQL's permissions, and you may need to set up permissions manually." IDYES +2
+ Return
+
+ DatabaseDoesNotExist:
+ */
+
+ SetOutPath $PLUGINSDIR
+ File "inst-resources\postgresqlutil.php"
+
+ nsExec::ExecToLog '"$stack_instdir\php\php.exe" "$PLUGINSDIR\postgresqlutil.php" "$R0" "$R1" \
+ "DROP DATABASE IF EXISTS $R3; \
+ DROP ROLE IF EXISTS $R4; \
+ CREATE ROLE $R4 WITH PASSWORD $\'$R5$\' LOGIN; \
+ CREATE DATABASE $R3 WITH OWNER $R4;"'
+ Delete "$PLUGINSDIR\postgresqlutil.php"
+FunctionEnd
+
diff -r 000000000000 -r 67e1cc6cd929 inst-resources/postgresqlutil.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/inst-resources/postgresqlutil.php Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,31 @@
+
+ Copyright (C)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ , 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff -r 000000000000 -r 67e1cc6cd929 pages/DatabaseConfig.ini
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pages/DatabaseConfig.ini Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,115 @@
+; Ini file generated by the HM NIS Edit IO designer.
+[Settings]
+NumFields=14
+
+[Field 1]
+Type=RadioButton
+Text=Create a database for me
+Left=16
+Right=-1
+Top=33
+Bottom=44
+State=1
+Flags=NOTIFY
+
+[Field 2]
+Type=RadioButton
+Text=Use an existing database
+Left=16
+Right=-1
+Top=73
+Bottom=84
+Flags=NOTIFY
+
+[Field 3]
+Type=Checkbox
+Text=Manually enter database name and login
+Flags=NOTIFY
+Left=16
+Right=-1
+Top=93
+Bottom=104
+
+[Field 4]
+Type=Password
+Left=96
+Right=176
+Top=54
+Bottom=67
+
+[Field 5]
+Type=Text
+Left=96
+Right=176
+Top=112
+Bottom=125
+
+[Field 6]
+Type=Text
+Left=96
+Right=176
+Top=132
+Bottom=145
+
+[Field 7]
+Type=Password
+Left=96
+Right=176
+Top=152
+Bottom=164
+
+[Field 8]
+Type=Password
+Left=96
+Right=176
+Top=171
+Bottom=184
+
+[Field 9]
+Type=Label
+Text=intro text will be filled here
+Left=0
+Right=-1
+Top=0
+Bottom=27
+
+[Field 10]
+Type=Label
+Text=Root password:
+Left=26
+Right=92
+Top=56
+Bottom=64
+
+[Field 11]
+Type=Label
+Text=Database name:
+Left=26
+Right=92
+Top=115
+Bottom=123
+
+[Field 12]
+Type=Label
+Text=Username:
+Left=26
+Right=92
+Top=134
+Bottom=142
+
+[Field 13]
+Type=Label
+Text=Password:
+Left=26
+Right=92
+Top=153
+Bottom=161
+
+[Field 14]
+Type=Label
+Text=Confirm password:
+Left=26
+Right=92
+Top=172
+Bottom=180
+
diff -r 000000000000 -r 67e1cc6cd929 pages/DatabaseConfig.nsi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pages/DatabaseConfig.nsi Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,163 @@
+!macro ShowRange hwnd low high value
+ !define tmp_id ${__LINE__}
+ StrCpy $R0 ${low}
+ loop.${tmp_id}:
+ GetDlgItem $R1 ${hwnd} $R0
+ ShowWindow $R1 ${value}
+ IntOp $R0 $R0 + 1
+ IntCmp $R0 ${high} loop.${tmp_id} loop.${tmp_id}
+
+ !undef tmp_id
+!macroend
+!define ShowRange "!insertmacro ShowRange"
+
+Page custom DatabaseConfigCreate DatabaseConfigLeave " - Database configuration"
+
+Function DatabaseConfigCreate
+ StrCmp $XPUI_ABORTED 1 0 +2
+ Return
+ !insertmacro XPUI_INSTALLOPTIONS_EXTRACT_AS "pages\DatabaseConfig.ini" "DatabaseConfig.ini"
+ !insertmacro XPUI_HEADER_TEXT "Database configuration" "Configure how $(^Name) will access your database."
+ WriteINIStr "$PLUGINSDIR\DatabaseConfig.ini" "Field 9" "Text" \
+ "$(^Name) needs database access to work properly. Setup can create a database for you if you provide \
+ $db_dbmsname's administration password, or you can choose to enter credentials for a database that already exists."
+
+ !insertmacro XPUI_INSTALLOPTIONS_INITDIALOG "DatabaseConfig.ini"
+ Pop $XPUI_HWND
+
+ ${ShowRange} $XPUI_HWND 1204 1207 ${SW_HIDE}
+ ${ShowRange} $XPUI_HWND 1210 1213 ${SW_HIDE}
+
+ !insertmacro XPUI_INSTALLOPTIONS_SHOW
+FunctionEnd
+
+Function DatabaseConfigLeave
+ StrCmp $XPUI_ABORTED 1 0 +2
+ Return
+
+ ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Settings" "State"
+ StrCmp $0 1 RadioButtonClicked
+ StrCmp $0 2 RadioButtonClicked
+ StrCmp $0 3 UseManualClicked
+ Goto NextClicked
+
+ RadioButtonClicked:
+ LockWindow on
+ ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 1" "State"
+ IntCmp $0 0 SetUseExisting
+
+ ; Show root password
+ GetDlgItem $0 $XPUI_HWND 1203
+ ShowWindow $0 ${SW_SHOW}
+ GetDlgItem $0 $XPUI_HWND 1209
+ ShowWindow $0 ${SW_SHOW}
+
+ GetDlgItem $0 $XPUI_HWND 1202 ; Checkbox
+ SendMessage $0 ${BM_SETCHECK} ${BST_UNCHECKED} 0
+ EnableWindow $0 1
+ ${ShowRange} $XPUI_HWND 1204 1207 ${SW_HIDE}
+ ${ShowRange} $XPUI_HWND 1210 1213 ${SW_HIDE}
+ LockWindow off
+ Abort
+
+ SetUseExisting:
+
+ ; Hide root password
+ GetDlgItem $0 $XPUI_HWND 1203
+ ShowWindow $0 ${SW_HIDE}
+ GetDlgItem $0 $XPUI_HWND 1209
+ ShowWindow $0 ${SW_HIDE}
+
+ GetDlgItem $0 $XPUI_HWND 1202 ; Checkbox
+ SendMessage $0 ${BM_SETCHECK} ${BST_CHECKED} 0
+ EnableWindow $0 0
+ ${ShowRange} $XPUI_HWND 1204 1207 ${SW_SHOW}
+ ${ShowRange} $XPUI_HWND 1210 1213 ${SW_SHOW}
+ LockWindow off
+ Abort
+
+ UseManualClicked:
+ ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 3" "State"
+ IntOp $0 $0 * ${SW_SHOW}
+ ${ShowRange} $XPUI_HWND 1204 1207 $0
+ ${ShowRange} $XPUI_HWND 1210 1213 $0
+ Abort
+
+ NextClicked:
+
+ ; Figure out how we want to go about this.
+ StrCpy $db_needroot 0
+ ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 1" "State"
+ IntCmp $0 0 UseCustomLogin
+
+ ; Validate based on root password.
+ StrCpy $db_needroot 1
+ ReadINIStr $db_rootpass "$PLUGINSDIR\DatabaseConfig.ini" "Field 4" "State"
+ ${db_connect} $1 "$db_rootuser" "$db_rootpass"
+ IntCmp $1 0 +3
+ MessageBox MB_OK|MB_ICONEXCLAMATION "The $db_dbmsname root password you entered is incorrect. Please re-enter it."
+ Abort
+
+ ; Does the user have their own credentials?
+ ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 3" "State"
+ IntCmp $0 0 GenerateRandomLogin
+
+ UseCustomLogin:
+
+ ; Pull database settings from dialog
+ ReadINIStr $db_name "$PLUGINSDIR\DatabaseConfig.ini" "Field 5" "State"
+ ReadINIStr $db_user "$PLUGINSDIR\DatabaseConfig.ini" "Field 6" "State"
+ ReadINIStr $db_password "$PLUGINSDIR\DatabaseConfig.ini" "Field 7" "State"
+ ReadINIStr $R0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 8" "State"
+
+ ; Check password length
+ ; but don't if the user entered credentials that already exist
+ IntCmp $db_needroot 0 SkipLengthCheck
+ StrLen $R1 $R0
+ IntCmp $R1 6 +3 0 +3
+ MessageBox MB_OK|MB_ICONEXCLAMATION "Please choose a database password that is at least 6 characters in length."
+ Abort
+
+ SkipLengthCheck:
+ ; Check password/confirm fields
+ StrCmp $db_password $R0 +3
+ MessageBox MB_OK|MB_ICONEXCLAMATION "The passwords you entered do not match. Please enter them again."
+ Abort
+
+ ; If we're root, we can assume the login doesn't exist yet, so skip the validation
+ IntCmp $db_needroot 0 +2
+ Return
+
+ ${db_connect} $R0 $db_user $db_password
+ IntCmp $R0 0 +3
+ ; Database auth failed
+ MessageBox MB_OK|MB_ICONEXCLAMATION "The username and password you entered are invalid. Please enter them again."
+ Abort
+
+ ; This can be an error-prone process because entering credentials manually will keep
+ ; the installer from touching the database. If tables already exist, Enano's installer
+ ; will throw an error. Confirm this with the user.
+ MessageBox MB_YESNO|MB_ICONQUESTION "Do you really want to use manual database settings?$\r$\n\
+ $\r$\n\
+ Setup will not attempt to modify your existing database. If there is \
+ already an installation of $(^Name) in the database, the installer will \
+ fail. This option is recommended only for advanced users." IDYES +2
+ Abort ; on No
+
+ Return
+
+ GenerateRandomLogin:
+ StrCpy $db_name "bn_enanocms"
+ StrCpy $db_user "bn_enanocms"
+ Call GenerateRandomPassword
+ Pop $db_password
+ Return
+
+FunctionEnd
+
+Function GenerateRandomPassword
+ SetOutPath $PLUGINSDIR
+ File "inst-resources\randompass.php"
+ nsExec::ExecToStack '"$stack_instdir\php\php.exe" "$PLUGINSDIR\randompass.php"'
+ Pop $R0
+FunctionEnd
diff -r 000000000000 -r 67e1cc6cd929 pages/Login.ini
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pages/Login.ini Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,88 @@
+[Settings]
+NumFields=9
+
+;
+; Fields
+;
+
+; Username
+[Field 1]
+Type=Text
+Top=15
+Left=70
+Right=130
+Bottom=27
+
+; Password 1
+[Field 2]
+Type=Password
+Top=32
+Left=70
+Right=130
+Bottom=44
+
+; Password 2
+[Field 3]
+Type=Password
+Top=49
+Left=70
+Right=130
+Bottom=61
+
+; E-mail
+[Field 4]
+Type=Text
+Top=66
+Left=70
+Right=180
+Bottom=78
+
+;
+; Labels
+;
+
+; Username
+[Field 5]
+Type=Label
+Top=17
+Bottom=25
+Left=5
+Right=68
+Text=Username:
+
+; Password 1
+[Field 6]
+Type=Label
+Top=34
+Bottom=42
+Left=5
+Right=68
+Text=Password:
+
+; Password 2
+[Field 7]
+Type=Label
+Top=51
+Bottom=59
+Left=5
+Right=68
+Text=Confirm password:
+
+; E-mail
+[Field 8]
+Type=Label
+Top=68
+Bottom=76
+Left=5
+Right=69
+Text=E-mail address:
+
+; Header
+[Field 9]
+Type=Label
+Top=0
+Bottom=8
+Left=0
+Right=-1
+Text=Please enter your desired login details below. These will be used to administer your website.
+
diff -r 000000000000 -r 67e1cc6cd929 pages/Login.nsi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pages/Login.nsi Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,34 @@
+Page custom CredentialsCreate CredentialsLeave " - Admin login"
+
+Function CredentialsCreate
+ !insertmacro XPUI_HEADER_TEXT "Create administrator" "Enter your desired username and password for administering your site."
+ !insertmacro XPUI_INSTALLOPTIONS_EXTRACT_AS "pages\Login.ini" "Login.ini"
+ !insertmacro XPUI_INSTALLOPTIONS_DISPLAY "Login.ini"
+FunctionEnd
+
+Function CredentialsLeave
+ StrCmp $XPUI_ABORTED "1" 0 +2
+ Return
+
+ ReadIniStr $enano_user "$PLUGINSDIR\Login.ini" "Field 1" "State"
+ StrCmp $enano_user "" 0 +3
+ MessageBox MB_OK|MB_ICONEXCLAMATION "Please enter a username."
+ Abort
+
+ ReadIniStr $enano_password "$PLUGINSDIR\Login.ini" "Field 2" "State"
+ Strlen $0 $enano_password
+ IntCmp $0 6 +3 0 +3
+ MessageBox MB_OK|MB_ICONEXCLAMATION "Please enter a password that is at least six characters long."
+ Abort
+
+ ReadIniStr $0 "$PLUGINSDIR\Login.ini" "Field 3" "State"
+ StrCmp $0 $enano_password +3
+ MessageBox MB_OK|MB_ICONEXCLAMATION "The passwords you entered do not match. Please enter them again."
+ Abort
+
+ ReadIniStr $admin_email "$PLUGINSDIR\Login.ini" "Field 4" "State"
+ StrCmp $admin_email "" 0 +3
+ MessageBox MB_OK|MB_ICONEXCLAMATION "Please enter your e-mail address."
+ Abort
+FunctionEnd
+
diff -r 000000000000 -r 67e1cc6cd929 pages/SiteConfig.ini
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pages/SiteConfig.ini Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,110 @@
+; Ini file generated by the HM NIS Edit IO designer.
+[Settings]
+NumFields=13
+
+[Field 1]
+Type=Text
+State=Enano website
+Left=90
+Right=251
+Top=24
+Bottom=37
+
+[Field 2]
+Type=Text
+State=My first Enano website
+Left=90
+Right=251
+Top=44
+Bottom=57
+
+[Field 3]
+Type=Text
+State=© 2009 You. All rights reserved.
+Left=90
+Right=251
+Top=64
+Bottom=76
+
+[Field 4]
+Type=Checkbox
+Text=Enable search engine friendly URLs
+State=1
+Left=90
+Right=251
+Top=103
+Bottom=113
+
+[Field 5]
+Type=RadioButton
+Text=Install a blank website
+State=1
+Left=90
+Right=262
+Top=128
+Bottom=138
+
+[Field 6]
+Type=RadioButton
+Text=Install the Enano tutorial site
+Left=90
+Right=256
+Top=142
+Bottom=153
+
+[Field 7]
+Type=Label
+Text=Please enter some basic information about your Enano website.
+Left=0
+Right=-1
+Top=0
+Bottom=8
+
+[Field 8]
+Type=Label
+Text=Site name:
+Left=0
+Right=86
+Top=27
+Bottom=35
+
+[Field 9]
+Type=Label
+Text=Site description:
+Left=0
+Right=86
+Top=46
+Bottom=54
+
+[Field 10]
+Type=Label
+Text=Copyright notice:
+Left=0
+Right=86
+Top=65
+Bottom=73
+
+[Field 11]
+Type=Label
+Text=To make a copyright (©) symbol, hold down Alt and press the numbers 0169 on your NumPad.
+Left=90
+Right=-1
+Top=78
+Bottom=96
+
+[Field 12]
+Type=Label
+Text=Install website content:
+Left=0
+Right=86
+Top=128
+Bottom=136
+
+[Field 13]
+Type=Label
+Text=The Enano tutorial site provides a set of pages you can view and edit to learn how Enano works.
+Left=103
+Right=-1
+Top=157
+Bottom=175
+
diff -r 000000000000 -r 67e1cc6cd929 pages/SiteConfig.nsi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pages/SiteConfig.nsi Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,46 @@
+Page custom SiteConfigCreate SiteConfigLeave " - Configure site information"
+
+Function SiteConfigCreate
+ !insertmacro XPUI_INSTALLOPTIONS_EXTRACT_AS "pages\SiteConfig.ini" "SiteConfig.ini"
+ !insertmacro XPUI_HEADER_TEXT "Configure website" "Enter basic information about your website."
+ !insertmacro XPUI_INSTALLOPTIONS_DISPLAY "SiteConfig.ini"
+FunctionEnd
+
+Function SiteConfigLeave
+ StrCmp $XPUI_ABORTED 1 0 +2
+ Return
+
+ ReadINIStr $site_name "$PLUGINSDIR\SiteConfig.ini" "Field 1" "State"
+ StrCmp $site_name "" 0 +3
+ MessageBox MB_OK|MB_ICONEXCLAMATION "Please enter a name for your site."
+ Abort
+
+ ReadINIStr $site_desc "$PLUGINSDIR\SiteConfig.ini" "Field 2" "State"
+ StrCmp $site_desc "" 0 +3
+ MessageBox MB_OK|MB_ICONEXCLAMATION "Please enter a description for your site."
+ Abort
+
+ ReadINIStr $site_copyright "$PLUGINSDIR\SiteConfig.ini" "Field 3" "State"
+ StrCmp $site_copyright "" 0 +2
+ StrCpy $site_copyright "No copyright assigned."
+
+ Push $site_copyright
+ Call CleanCopyright
+ Pop $site_copyright
+
+ StrCpy $url_scheme "standard"
+ ReadINIStr $0 "$PLUGINSDIR\SiteConfig.ini" "Field 4" "State"
+ IntCmp $0 1 0 +2 +2
+ StrCpy $url_scheme "short"
+
+ StrCpy $start_with "blank"
+ ReadINIStr $0 "$PLUGINSDIR\SiteConfig.ini" "Field 6" "State"
+ IntCmp $0 1 0 +2 +2
+ StrCpy $start_with "tutorial"
+FunctionEnd
+
+Function CleanCopyright
+ Pop $0
+ ${str_replace} $0 "©" "©" "$0"
+ Push $0
+FunctionEnd
diff -r 000000000000 -r 67e1cc6cd929 pages/StackSelect.ini
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pages/StackSelect.ini Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,30 @@
+; Ini file generated by the HM NIS Edit IO designer.
+[Settings]
+NumFields=3
+
+[Field 1]
+Type=RadioButton
+Text=WAMPStack (MySQL)
+State=1
+Left=32
+Right=-1
+Top=36
+Bottom=47
+
+[Field 2]
+Type=RadioButton
+Text=WAPPStack (PostgreSQL)
+State=0
+Left=32
+Right=-1
+Top=52
+Bottom=63
+
+[Field 3]
+Type=Label
+Text=Setup found both BitNami WAMPStack and BitNami WAPPStack on your server. Please select which one you would like to use:
+Left=0
+Right=-1
+Top=4
+Bottom=25
+
diff -r 000000000000 -r 67e1cc6cd929 pages/StackSelect.nsi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pages/StackSelect.nsi Wed May 27 01:05:23 2009 -0400
@@ -0,0 +1,83 @@
+Page custom StackSelectCreate StackSelectLeave " - Select stack"
+
+Function StackSelectCreate
+ ; Only show this page if both WAMPStack and WAPPStack are installed.
+ StrCmp $wampstack_installed 0 "" +3
+ Call StackSelectLeave
+ Return
+ StrCmp $wappstack_installed 0 "" +3
+ Call StackSelectLeave
+ Return
+ StrCmp $XPUI_ABORTED 1 "" +2
+ Abort
+
+ !insertmacro XPUI_INSTALLOPTIONS_EXTRACT_AS "pages\StackSelect.ini" "StackSelect.ini"
+ !insertmacro XPUI_HEADER_TEXT "Select server stack" "Choose which BitNami stack installation you want to use to run $(^Name)."
+ !insertmacro XPUI_INSTALLOPTIONS_DISPLAY "StackSelect.ini"
+FunctionEnd
+
+Function StackSelectLeave
+ ; Here is where we make the final decision on which stack will be used.
+ IfFileExists "$PLUGINSDIR\StackSelect.ini" "" OnlyOneStackInstalled
+
+ !macro ConfigCheck
+ IfFileExists "$stack_instdir\apps\${PRODUCT_SHORTNAME}\htdocs\config.php" 0 +3
+ 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
+ Abort
+ !macroend
+
+ ; Both stacks are installed; decide based on user selection
+ ReadINIStr $0 "$PLUGINSDIR\StackSelect.ini" "Field 1" "State"
+ StrCmp $0 1 "" UserSelectedWAPP
+ ; User selected WAMP
+ Call BNSetVarsForWAMP
+ !insertmacro ConfigCheck
+ Return
+
+ UserSelectedWAPP:
+ ; User selected WAPP
+ Call BNSetVarsForWAPP
+ !insertmacro ConfigCheck
+ Return
+
+ OnlyOneStackInstalled:
+ StrCmp $wampstack_installed 0 +3
+ ; MySQL
+ Call BNSetVarsForWAMP
+ !insertmacro ConfigCheck
+ Return
+
+ ; PostgreSQL
+ Call BNSetVarsForWAPP
+ !insertmacro ConfigCheck
+ Return
+FunctionEnd
+
+Function BNSetVarsForWAMP
+ StrCpy $stack_type "WAMP"
+ StrCpy $stack_instdir "$wampstack_installed"
+ StrCpy $db_driver "mysql"
+ StrCpy $db_dbmsname "MySQL"
+ StrCpy $db_rootuser "root"
+ ReadINIStr $db_port "$stack_instdir\properties.ini" "MySQL" "mysql_port"
+
+ StrCpy $stack_portbit ""
+ ReadINIStr $0 "$stack_instdir\properties.ini" "Apache" "apache_server_port"
+ StrCmp $0 "80" +2
+ StrCpy $stack_portbit ":$0"
+FunctionEnd
+
+Function BNSetVarsForWAPP
+ StrCpy $stack_type "WAPP"
+ StrCpy $stack_instdir "$wappstack_installed"
+ StrCpy $db_driver "postgresql"
+ StrCpy $db_dbmsname "PostgreSQL"
+ StrCpy $db_rootuser "postgres"
+ ; NOTE: WAPPStack doesn't record the port of PostgreSQL - we have to assume the default
+ StrCpy $db_port 5432
+
+ StrCpy $stack_portbit ""
+ ReadINIStr $0 "$stack_instdir\properties.ini" "Apache" "apache_server_port"
+ StrCmp $0 "80" +2
+ StrCpy $stack_portbit ":$0"
+FunctionEnd
\ No newline at end of file