installer: do not create unneeded blank line at the end of config.php

This commit is contained in:
Andrew Dolgov 2013-03-30 10:14:47 +04:00
parent f0d7c1ac86
commit c93f98e123
1 changed files with 7 additions and 1 deletions

View File

@ -114,6 +114,8 @@
$rv = ""; $rv = "";
$finished = false;
foreach ($data as $line) { foreach ($data as $line) {
if (preg_match("/define\('DB_TYPE'/", $line)) { if (preg_match("/define\('DB_TYPE'/", $line)) {
$rv .= "\tdefine('DB_TYPE', '$DB_TYPE');\n"; $rv .= "\tdefine('DB_TYPE', '$DB_TYPE');\n";
@ -129,9 +131,13 @@
$rv .= "\tdefine('DB_PORT', '$DB_PORT');\n"; $rv .= "\tdefine('DB_PORT', '$DB_PORT');\n";
} else if (preg_match("/define\('SELF_URL_PATH'/", $line)) { } else if (preg_match("/define\('SELF_URL_PATH'/", $line)) {
$rv .= "\tdefine('SELF_URL_PATH', '$SELF_URL_PATH');\n"; $rv .= "\tdefine('SELF_URL_PATH', '$SELF_URL_PATH');\n";
} else { } else if (!$finished) {
$rv .= "$line\n"; $rv .= "$line\n";
} }
if (preg_match("/\?\>/", $line)) {
$finished = true;
}
} }
return $rv; return $rv;