cvs: php4 /win32/installer setini.php
| From: | Wez Furlong | Date: | Sun, 16 Feb 2003 23:46:45 +0000 |
| Subject: | cvs: php4 /win32/installer setini.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-18893@lists.php.net to get a copy of this message | ||
wez Sun Feb 16 18:46:45 2003 EDT
Modified files:
/php4/win32/installer setini.php
Log:
Some additional sanity.
Index: php4/win32/installer/setini.php
diff -u php4/win32/installer/setini.php:1.2 php4/win32/installer/setini.php:1.3
--- php4/win32/installer/setini.php:1.2 Sun Feb 9 19:20:53 2003
+++ php4/win32/installer/setini.php Sun Feb 16 18:46:45 2003
@@ -1,5 +1,5 @@
<?php
-/* $Id: setini.php,v 1.2 2003/02/10 00:20:53 wez Exp $
+/* $Id: setini.php,v 1.3 2003/02/16 23:46:45 wez Exp $
* Wez Furlong <wez@thebrainroom.com>
*
* Set options in a php.ini file.
@@ -11,14 +11,32 @@
echo "Running post-installation script to configure php.ini\n";
+function fatal($msg)
+{
+ echo $msg;
+ sleep(5);
+ exit(1);
+}
+
$ini_name = $argv[1];
$option_file = $argv[2];
+if (!file_exists($option_file)) {
+ fatal("Option file $option_file does not exist");
+}
+
+if (!file_exists($ini_name)) {
+ fatal("inifile $ini_name does not exist");
+}
+
$options = explode("\n", file_get_contents($option_file));
$opts = array();
/* Parse the options */
foreach ($options as $line) {
+ if (strlen(trim($line)) == 0)
+ continue;
+
list($name, $value) = explode("=", $line);
if ($name == "extension") {
@@ -48,6 +66,7 @@
extract($optdata);
if (preg_match($pat, $line)) {
+ echo "Found $pat ; setting $name to $value\n";
$line = "$name=$value\r\n";
// No need to match again
unset($opts[$k]);
@@ -64,5 +83,5 @@
rename($new_name, $ini_name);
echo "All done!\n";
-
+sleep(1);
?>