# HG changeset patch # User Dan Fuhry # Date 1282429198 14400 # Node ID 014d58335b6daeb3de9f855aeca3d90e930f90cd # Parent af10a4dbafb4f6a28dca836e262959c9717ae3c4 Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database. diff -r af10a4dbafb4 -r 014d58335b6d Makefile --- a/Makefile Fri Dec 18 19:16:05 2009 -0600 +++ b/Makefile Sat Aug 21 18:19:58 2010 -0400 @@ -1,8 +1,8 @@ EXPERIENCEUI=/public/exui/Contrib/ExperienceUI ENANOHG=/var/www/html/enano-1.1/repo # ONLY use n.n.n here! Leave prefixes like -hg for ENANO_VERSION_APPEND. -ENANO_VERSION=1.1.7 -ENANO_VERSION_APPEND= +ENANO_VERSION=1.1.8 +ENANO_VERSION_APPEND=-hg all: makensis "-DXPUI_SYSDIR=$(EXPERIENCEUI)" "-DENANO_ROOT=$(ENANOHG)" "-DPRODUCT_VERSION=$(ENANO_VERSION)" \ diff -r af10a4dbafb4 -r 014d58335b6d enano-bundle.nsi --- a/enano-bundle.nsi Fri Dec 18 19:16:05 2009 -0600 +++ b/enano-bundle.nsi Sat Aug 21 18:19:58 2010 -0400 @@ -143,18 +143,6 @@ Section "-pre" StrCpy $INSTDIR "$stack_instdir" - StrCpy $skip_install 0 - - StrCmp $db_needroot 0 0 SkipManualCheck - ; If we were given our own DB credentials and there's already a config, the installation needs to be skipped - IfFileExists "$INSTDIR\apps\${PRODUCT_SHORTNAME}\htdocs\config.php" 0 SkipManualCheck - StrCpy $skip_install 1 - Return - - SkipManualCheck: - - IfFileExists "$INSTDIR\apps\${PRODUCT_SHORTNAME}\htdocs\config.php" 0 +2 - Delete "$INSTDIR\apps\${PRODUCT_SHORTNAME}\htdocs\config.php" SectionEnd Section "-DatabaseSetup" @@ -196,7 +184,7 @@ MessageBox MB_OK|MB_ICONEXCLAMATION "GMP was not automatically enabled in PHP. Logins will be several seconds slower." SectionEnd -/* Plugins components commented out, we don't plan on enabling this until at least 1.2.0 RC1 +/* Plugins components commented out, we do not plan on enabling this until at least 1.2.0 RC1 Section "YubiKey auth plugin" SEC02 SectionEnd @@ -228,12 +216,19 @@ nsExec::Exec '"$SYSDIR\net.exe" start "$stack_typestackApache"' StrCmp $skip_install 1 0 +2 Return + + SetOutPath "$INSTDIR\apps\${PRODUCT_SHORTNAME}\scripts" + File "inst-resources\selfdestruct.php" + + IfFileExists "$INSTDIR\apps\${PRODUCT_SHORTNAME}\htdocs\config.php" "" SkipDestruct + IntCmp $db_needroot 1 JustDeleteTheConfig + nsExec::ExecToLog '"$INSTDIR\php\php.exe" "$INSTDIR\apps\${PRODUCT_SHORTNAME}\scripts\selfdestruct.php" --skip-revoke' + JustDeleteTheConfig: + Delete "$INSTDIR\apps\${PRODUCT_SHORTNAME}\htdocs\config.php" + SkipDestruct: Call enano_write_kickstart_script Call enano_run_kickstart_script - - SetOutPath "$INSTDIR\apps\${PRODUCT_SHORTNAME}\scripts" - File "inst-resources\selfdestruct.php" SectionEnd Section -InsertApplistEntry diff -r af10a4dbafb4 -r 014d58335b6d inst-resources/mysql.nsh --- a/inst-resources/mysql.nsh Fri Dec 18 19:16:05 2009 -0600 +++ b/inst-resources/mysql.nsh Sat Aug 21 18:19:58 2010 -0400 @@ -34,11 +34,11 @@ 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 + ; 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: + ; DatabaseDoesNotExist: SetOutPath $PLUGINSDIR File "inst-resources\mysqlutil.php" diff -r af10a4dbafb4 -r 014d58335b6d inst-resources/selfdestruct.php --- a/inst-resources/selfdestruct.php Fri Dec 18 19:16:05 2009 -0600 +++ b/inst-resources/selfdestruct.php Sat Aug 21 18:19:58 2010 -0400 @@ -5,19 +5,28 @@ $mydir = dirname(__FILE__); require($mydir . '/../htdocs/includes/common.php'); if ( !defined('ENANO_CLI') ) - die("Don't even try."); + die("Don't even try."); require(ENANO_ROOT . '/config.php'); -// one is mysql, one is postgresql -// too lazy to check right now -// FIXME this fails right now because we don't have root -$db->sql_query("DROP ROLE `$dbuser`;"); -$db->sql_query("REVOKE ALL PRIVILEGES ON `$dbname`.* FROM `$dbuser`@localhost;"); +if ( !in_array('--skip-revoke', $argv) ) +{ + $db->sql_query("DROP DATABASE `$dbname`;"); + // one is mysql, one is postgresql + // too lazy to check right now + // FIXME this fails right now because we don't have root + $db->sql_query("DROP ROLE `$dbuser`;"); + $db->sql_query("REVOKE ALL PRIVILEGES ON `$dbname`.* FROM `$dbuser`@localhost;"); +} +else +{ + foreach ( $system_table_list as $table ) + { + $q = "DROP TABLE `" . table_prefix . "$table`;"; + echo "$q\n"; + $db->sql_query($q); + } +} -$q = $db->sql_query("DROP DATABASE `$dbname`;"); -if ( $q ) - exit(0); +exit(0); -exit(1); - diff -r af10a4dbafb4 -r 014d58335b6d pages/DatabaseConfig.ini --- a/pages/DatabaseConfig.ini Fri Dec 18 19:16:05 2009 -0600 +++ b/pages/DatabaseConfig.ini Sat Aug 21 18:19:58 2010 -0400 @@ -1,10 +1,10 @@ ; Ini file generated by the HM NIS Edit IO designer. [Settings] -NumFields=14 +NumFields=16 [Field 1] Type=RadioButton -Text=Create a database for me +Text=Clean install: Create a database for me Left=16 Right=-1 Top=33 @@ -14,7 +14,7 @@ [Field 2] Type=RadioButton -Text=Use an existing database +Text=Clean install: Use an existing database Left=16 Right=-1 Top=73 @@ -27,7 +27,7 @@ Flags=NOTIFY Left=16 Right=-1 -Top=93 +Top=92 Bottom=104 [Field 4] @@ -42,7 +42,7 @@ Left=96 Right=176 Top=112 -Bottom=125 +Bottom=124 [Field 6] Type=Text @@ -113,3 +113,20 @@ Top=172 Bottom=180 +[Field 15] +Type=RadioButton +Text=Upgrade or configure database manually +Left=16 +Right=-1 +Top=189 +Bottom=200 +Flags=NOTIFY + +[Field 16] +Type=Label +Text=Use this option if you are upgrading an existing installation, or want to manually create your database and install Enano using the web interface. +Left=30 +Right=-1 +Top=203 +Bottom=220 + diff -r af10a4dbafb4 -r 014d58335b6d pages/DatabaseConfig.nsi --- a/pages/DatabaseConfig.nsi Fri Dec 18 19:16:05 2009 -0600 +++ b/pages/DatabaseConfig.nsi Sat Aug 21 18:19:58 2010 -0400 @@ -44,6 +44,16 @@ !insertmacro XPUI_INSTALLOPTIONS_INITDIALOG "DatabaseConfig.ini" Pop $XPUI_HWND + ; Our bold font + CreateFont $2 "$(^Font)" "$(^FontSize)" 700 + ; Paint controls + GetDlgItem $1 $XPUI_HWND 1200 + SendMessage $1 ${WM_SETFONT} $2 0 + GetDlgItem $1 $XPUI_HWND 1201 + SendMessage $1 ${WM_SETFONT} $2 0 + GetDlgItem $1 $XPUI_HWND 1214 + SendMessage $1 ${WM_SETFONT} $2 0 + IntCmp $R2 1 "" SkipHideManual ${ShowRange} $XPUI_HWND 1204 1207 ${SW_HIDE} @@ -76,11 +86,14 @@ ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Settings" "State" StrCmp $0 1 RadioButtonClicked StrCmp $0 2 RadioButtonClicked + StrCmp $0 15 RadioButtonClicked StrCmp $0 3 UseManualClicked Goto NextClicked RadioButtonClicked: LockWindow on + ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 15" "State" + IntCmp $0 1 SetBypass ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 1" "State" IntCmp $0 0 SetUseExisting @@ -113,6 +126,22 @@ ${ShowRange} $XPUI_HWND 1210 1213 ${SW_SHOW} LockWindow off Abort + + SetBypass: + + ; 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_UNCHECKED} 0 + EnableWindow $0 0 + ${ShowRange} $XPUI_HWND 1204 1207 ${SW_HIDE} + ${ShowRange} $XPUI_HWND 1210 1213 ${SW_HIDE} + LockWindow off + Abort UseManualClicked: ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 3" "State" @@ -125,6 +154,9 @@ ; Figure out how we want to go about this. StrCpy $db_needroot 0 + StrCpy $skip_install 0 + ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 15" "State" + IntCmp $0 1 BypassInstaller ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 1" "State" IntCmp $0 0 UseCustomLogin @@ -173,19 +205,26 @@ 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\ + MessageBox MB_YESNO|MB_ICONQUESTION "Are you sure you 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 + Without your database root password, Setup cannot change your existing database. If there is an Enano installation \ + in this database already, the installer will fail with this option; you should go back and choose the $\"Upgrade or \ + configure database manually$\" option." IDYES +2 Abort ; on No + */ LockWindow on Return + BypassInstaller: + + ; No validation - the user opted to configure everything manually. + StrCpy $skip_install 1 + GenerateRandomLogin: StrCpy $db_name "bn_enanocms" StrCpy $db_user "bn_enanocms" @@ -202,3 +241,4 @@ nsExec::ExecToStack '"$stack_instdir\php\php.exe" "$PLUGINSDIR\randompass.php"' Pop $R0 FunctionEnd + diff -r af10a4dbafb4 -r 014d58335b6d pages/Login.nsi --- a/pages/Login.nsi Fri Dec 18 19:16:05 2009 -0600 +++ b/pages/Login.nsi Sat Aug 21 18:19:58 2010 -0400 @@ -1,6 +1,9 @@ Page custom CredentialsCreate CredentialsLeave " - Admin login" Function CredentialsCreate + IntCmp $skip_install 0 +2 + Abort + !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" diff -r af10a4dbafb4 -r 014d58335b6d pages/SiteConfig.nsi --- a/pages/SiteConfig.nsi Fri Dec 18 19:16:05 2009 -0600 +++ b/pages/SiteConfig.nsi Sat Aug 21 18:19:58 2010 -0400 @@ -1,6 +1,9 @@ Page custom SiteConfigCreate SiteConfigLeave " - Configure site information" Function SiteConfigCreate + IntCmp $skip_install 0 +2 + Abort + !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" diff -r af10a4dbafb4 -r 014d58335b6d pages/StackSelect.nsi --- a/pages/StackSelect.nsi Fri Dec 18 19:16:05 2009 -0600 +++ b/pages/StackSelect.nsi Sat Aug 21 18:19:58 2010 -0400 @@ -25,7 +25,14 @@ !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 and you do not want to delete your existing site, you must provide the database information of the current installation on the next page. Otherwise, the existing installation's configuration file will be deleted and your existing website will be replaced with a fresh one.$\n$\nIf you are upgrading $(^Name), you can safely click Yes below, and enter the database information found in $stack_instdir\apps\${PRODUCT_SHORTNAME}\config.php on the next page.$\n$\nDo you want to continue?" IDYES +2 + MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2 \ + "Setup has found that $(^Name) is already installed on this stack. If you continue and you do not want to delete your existing site, \ + you must select $\"Upgrade or configure database manually$\" on the next page. Otherwise, the existing installation's configuration \ + file and database will be deleted and your existing website will be replaced with a fresh one.$\n\ + $\n\ + If you are upgrading $(^Name), you can safely click Yes below, and select $\"Upgrade or configure database manually.$\"$\n\ + $\n\ + Do you want to continue?" IDYES +2 Abort !macroend