'localhost',1=>'127.0.0.1')" # # The original file is MODIFIED in-place!!! # require($argv[1]); $config_var_name = $argv[2]; $configref = &$$config_var_name; $dry_run = false; function print_array($v, $level, $fp) { fwrite($fp, "array (\n"); if ((array) $v !== $v) { foreach($v as $kv) { fwrite($fp, $kv . ","); } } else { foreach($v as $key => $kv) { fwrite($fp,str_repeat(' ', $level)); if (is_string($key)) { fwrite($fp,"'" . $key . "' => "); } else { fwrite($fp,$key . " => "); } if (is_array($kv)) { print_array($kv, $level+1, $fp); } else if (is_string($kv)) { fwrite($fp,"'" . $kv . "',\n"); } else if (is_bool($kv)) { fwrite($fp, ($kv ? 'true' : 'false') . ",\n"); } else { fwrite($fp,$kv . ",\n"); } } } fwrite($fp,str_repeat(' ', $level-1)); fwrite($fp,")"); if ($level>1) fwrite($fp,",\n"); } for($i=3; $i\n"); fclose($fp); # ok - rename if (! $dry_run) { if (file_exists($argv[1] . ".old")) { unlink($argv[1] . ".old"); } rename($argv[1], $argv[1] . ".old"); rename($argv[1] . ".new", $argv[1]); } ?>