wez Sun Feb 9 19:20:53 2003 EDT
Modified files:
/php4/win32/installer gen-nsis.php setini.php
Log:
Fix php.ini customization.
Apparently, it seems that running the php script with output captured to
the log prevented it from working correctly.
Also, deletes the php.ini when uninstalled.
TODO: The defaults install and activate all extensions. This is a problem
for those extension that require non-bundled .dlls (such as OCI).
Index: php4/win32/installer/gen-nsis.php
diff -u php4/win32/installer/gen-nsis.php:1.1 php4/win32/installer/gen-nsis.php:1.2
--- php4/win32/installer/gen-nsis.php:1.1 Wed Feb 5 02:32:22 2003
+++ php4/win32/installer/gen-nsis.php Sun Feb 9 19:20:53 2003
@@ -1,7 +1,7 @@
; PHP Installer for NSIS
; Based on Welcome/Finish Page Example Script (Written by Joost Verburg)
; Author: Wez Furlong <[EMAIL PROTECTED]>
-; $Id: gen-nsis.php,v 1.1 2003/02/05 07:32:22 wez Exp $
+; $Id: gen-nsis.php,v 1.2 2003/02/10 00:20:53 wez Exp $
<?php
define('PHPVERSION', phpversion());
@@ -314,7 +314,7 @@
!define MUI_PRODUCT "PHP - Hypertext Preprocessor"
!define MUI_VERSION "<?= PHPVERSION ?>"
; The second UI has a wider area for the component names
-!define MUI_UI "${NSISDIR}\Contrib\UIs\modern3.exe"
+!define MUI_UI "${NSISDIR}\Contrib\UIs\modern2.exe"
!include "${NSISDIR}\Contrib\Modern UI\System.nsh"
@@ -347,16 +347,19 @@
;Folder-selection page
InstallDir "C:\PHP-<?= PHPVERSION ?>"
-
+;define NSIS_CONFIG_LOG "install.log"
+;LogSet on
+
+!cd <?= SOURCEDIR ?>win32\installer
+
;Things that need to be extracted on startup (keep these lines before any File
command!)
;Only useful for BZIP2 compression
;Use ReserveFile for your own Install Options ini files too!
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
!insertmacro MUI_RESERVEFILE_SPECIALINI
!insertmacro MUI_RESERVEFILE_SPECIALBITMAP
-
-;--------------------------------
-;Modern UI System
+
+!cd <?= DISTDIR ?>
!insertmacro MUI_SYSTEM
@@ -380,9 +383,9 @@
; Extensions will call a function to activate their entry
; in the ini file as they are installed.
- ifFileExists "<?= $SYSDIR ?>\php.ini" "" +2
- Rename "<?= $SYSDIR ?>\php.ini" "<?= $SYSDIR ?>\php.ini.old"
- CopyFiles "$INSTDIR\php.ini-dist" "<?= $SYSDIR ?>\php.ini"
+ ifFileExists "$WINDIR\php.ini" "" +2
+ Rename "<?= $SYSDIR ?>\php.ini" "$WINDIR\php.ini.old"
+ CopyFiles "$INSTDIR\php.ini-dist" "$WINDIR\php.ini"
; For editing the ini, put the cli and the php4ts.dll in the same dir
; these files will be deleted during post-installation
@@ -403,8 +406,7 @@
; Perform final actions after everything has been installed
Section -post
; Merge ini settings
- nsExec::ExecToLog "$\"$INSTDIR\strap-php.exe$\" $\"$INSTDIR\setini.php$\"
$\"<?= $SYSDIR ?>\php.ini$\" $\"$INSTDIR\.ini-add$\""
-
+ ExecWait "$\"$INSTDIR\strap-php.exe$\" $\"$INSTDIR\setini.php$\"
+$\"$WINDIR\php.ini$\" $\"$INSTDIR\.ini-add$\""
Delete "$INSTDIR\.ini-add" ; Created by the AddIniSetting function
Delete "$INSTDIR\setini.php"
Delete "$INSTDIR\strap-php.exe"
@@ -431,6 +433,7 @@
<?= $UNINSTALL ?>
Delete "$INSTDIR\Uninstall.exe"
+ Delete "$WINDIR\php.ini"
RMDir "$INSTDIR"
; Remove from Add/Remove programs list
DeleteRegKey /ifempty HKLM
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\PHP-<?= PHPVERSION ?>"
Index: php4/win32/installer/setini.php
diff -u php4/win32/installer/setini.php:1.1 php4/win32/installer/setini.php:1.2
--- php4/win32/installer/setini.php:1.1 Wed Feb 5 02:32:22 2003
+++ php4/win32/installer/setini.php Sun Feb 9 19:20:53 2003
@@ -1,5 +1,5 @@
<?php
-/* $Id: setini.php,v 1.1 2003/02/05 07:32:22 wez Exp $
+/* $Id: setini.php,v 1.2 2003/02/10 00:20:53 wez Exp $
* Wez Furlong <[EMAIL PROTECTED]>
*
* Set options in a php.ini file.
@@ -9,6 +9,8 @@
* $argv[2] is the path to the option file
*/
+echo "Running post-installation script to configure php.ini\n";
+
$ini_name = $argv[1];
$option_file = $argv[2];
@@ -20,9 +22,9 @@
list($name, $value) = explode("=", $line);
if ($name == "extension") {
- $pat = "/^;?extension\s*=\s*" . $value . "/i";
+ $pat = "/^;?extension\s*=\s*" . preg_quote($value, '/') . "/i";
} else {
- $pat = "/^;?$name\s*=\s*/i";
+ $pat = "/^;?" . preg_quote($name, '/') . "\s*=\s*/i";
}
$opts[] = array('pat' => $pat, 'name' => $name, 'value' => $value);
@@ -32,6 +34,9 @@
$dest = fopen($new_name, "w");
if (!$dest) {
+ echo "Could not create temporary file! $new_name\n";
+ flush();
+ sleep(10);
die("Cannot create temporary file!");
}
@@ -43,10 +48,7 @@
extract($optdata);
if (preg_match($pat, $line)) {
- echo "Found: $line\n";
$line = "$name=$value\r\n";
- echo" New value: $line\n";
-
// No need to match again
unset($opts[$k]);
break;
@@ -60,5 +62,7 @@
unlink($ini_name);
rename($new_name, $ini_name);
+
+echo "All done!\n";
?>
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php