Installer will now detect if you have an _ss_environment.php, and if so, use conf/ConfigureFromEnv.php

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/trunk@61633 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
sminnee 2008-08-27 10:52:53 +00:00
parent 9c15d0dae9
commit 00f94e8867
1 changed files with 35 additions and 6 deletions

View File

@ -10,10 +10,12 @@ ini_set('max_execution_time', 300);
session_start();
// Include environment files
$usingEnv = false;
$envFiles = array('_ss_environment.php', '../_ss_environment.php', '../../_ss_environment.php');
foreach($envFiles as $envFile) {
if(@file_exists($envFile)) {
include($envFile);
$usingEnv = true;
break;
}
}
@ -624,13 +626,39 @@ SSViewer::set_theme('blackcandy');
PHP;
}
echo "<li>Creating '$template/_config.php'...</li>";
flush();
$devServers = $this->var_export_array_nokeys(explode("\n", $_POST['devsites']));
global $usingEnv;
if($usingEnv) {
echo "<li>Creating '$template/_config.php' for use with _ss_environment.php...</li>\n";
flush();
$this->createFile("$template/_config.php", <<<PHP
<?php
global \$project;
\$project = '$template';
global \$database;
\$database = "{$config['mysql']['database']}";
require_once("conf/ConfigureFromEnv.php");
$theme
?>
PHP
);
} else {
echo "<li>Creating '$template/_config.php'...</li>\n";
flush();
$escapedPassword = addslashes($config['mysql']['password']);
$this->createFile("$template/_config.php", <<<PHP
$devServers = $this->var_export_array_nokeys(explode("\n", $_POST['devsites']));
$escapedPassword = addslashes($config['mysql']['password']);
$this->createFile("$template/_config.php", <<<PHP
<?php
global \$project;
@ -655,7 +683,8 @@ $theme
?>
PHP
);
);
}
echo "<li>Creating '.htaccess' file...</li>";
flush();