Add base URL configuration field in installer and in sample configuration file
parent
74efd243c5
commit
f19dc454ee
|
@ -4,4 +4,4 @@ define('PSM_DB_USER', 'db_user');
|
|||
define('PSM_DB_PASS', 'db_pass');
|
||||
define('PSM_DB_NAME', 'db_name');
|
||||
define('PSM_DB_HOST', 'localhost');
|
||||
|
||||
define('PSM_BASE_URL', '');
|
||||
|
|
|
@ -120,11 +120,12 @@ class InstallController extends AbstractController {
|
|||
}
|
||||
|
||||
$config = array(
|
||||
'host' => 'localhost',
|
||||
'name' => '',
|
||||
'user' => '',
|
||||
'pass' => '',
|
||||
'prefix' => 'psm_',
|
||||
'db_host' => 'localhost',
|
||||
'db_name' => '',
|
||||
'db_user' => '',
|
||||
'db_pass' => '',
|
||||
'db_prefix' => 'psm_',
|
||||
'base_url' => '',
|
||||
);
|
||||
|
||||
$changed = false;
|
||||
|
@ -140,10 +141,10 @@ class InstallController extends AbstractController {
|
|||
if($changed) {
|
||||
// test db connection
|
||||
$this->db = new \psm\Service\Database(
|
||||
$config['host'],
|
||||
$config['user'],
|
||||
$config['pass'],
|
||||
$config['name']
|
||||
$config['db_host'],
|
||||
$config['db_user'],
|
||||
$config['db_pass'],
|
||||
$config['db_name']
|
||||
);
|
||||
|
||||
if($this->db->status()) {
|
||||
|
@ -275,11 +276,11 @@ class InstallController extends AbstractController {
|
|||
* @param array $db_vars prefix,user,pass,name,host
|
||||
* @return boolean|string TRUE on success, string with config otherwise
|
||||
*/
|
||||
protected function writeConfigFile($db_vars) {
|
||||
protected function writeConfigFile($array_config) {
|
||||
$config = "<?php".PHP_EOL;
|
||||
|
||||
foreach($db_vars as $key => $value) {
|
||||
$line = "define('PSM_DB_{key}', '{value}');".PHP_EOL;
|
||||
foreach($array_config as $key => $value) {
|
||||
$line = "define('PSM_{key}', '{value}');".PHP_EOL;
|
||||
$line = str_replace(
|
||||
array('{key}', '{value}'),
|
||||
array(strtoupper($key), $value),
|
||||
|
@ -308,7 +309,7 @@ class InstallController extends AbstractController {
|
|||
'name' => '',
|
||||
'host' => '',
|
||||
);
|
||||
$pattern = "/define\('SM_DB_{key}', '(.*?)'/u";
|
||||
$pattern = "/define\('SM_{key}', '(.*?)'/u";
|
||||
|
||||
foreach($vars as $key => $value) {
|
||||
$pattern_key = str_replace('{key}', strtoupper($key), $pattern);
|
||||
|
|
|
@ -10,35 +10,42 @@
|
|||
<div class="span6">
|
||||
<form id="psm_config" class="form-horizontal" action="install.php?action=config" method="post">
|
||||
{{ macro.csrf_input() }}
|
||||
<p>Please enter the application url:</p>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="base_url">Application base url</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="base_url" name="base_url" value="{{ base_url }}" />
|
||||
</div>
|
||||
</div>
|
||||
<p>Please enter your database info:</p>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="host">Database host</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="host" name="host" value="{{ host }}" />
|
||||
<input type="text" id="host" name="db_host" value="{{ db_host }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="name">Database name</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="name" name="name" value="{{ name }}" placeholder="db name" />
|
||||
<input type="text" id="name" name="db_name" value="{{ db_name }}" placeholder="db name" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="user">Database user</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="user" name="user" value="{{ user }}" placeholder="db user" />
|
||||
<input type="text" id="user" name="db_user" value="{{ db_user }}" placeholder="db user" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="pass">Database password</label>
|
||||
<div class="controls">
|
||||
<input type="password" id="pass" name="pass" value="{{ pass }}" placeholder="db password" />
|
||||
<input type="password" id="pass" name="db_pass" value="{{ db_pass }}" placeholder="db password" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="prefix">Table prefix</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="prefix" name="prefix" value="{{ prefix }}" />
|
||||
<input type="text" id="prefix" name="db_prefix" value="{{ db_prefix }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
|
@ -60,4 +67,4 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue