Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update install script to generate appropriate config.php file

  • Loading branch information...
commit 3def1c1a93c301c977aba2998fa7e3d0cebdbfa7 1 parent df5f5ec
@daris daris authored
Showing with 36 additions and 2 deletions.
  1. +35 −1 install.php
  2. +1 −1  modules/gettext
View
36 install.php
@@ -115,7 +115,41 @@ function generate_config_file()
{
global $db_type, $db_host, $db_name, $db_username, $db_password, $db_prefix, $cookie_name, $cookie_seed, $base_url;
- return '<?php'."\n\n".'$flux_config = array();'."\n\n".'$flux_config[\'db\'][\'type\'] = \''.$db_type."';\n".'$flux_config[\'db\'][\'host\'] = \''.$db_host."';\n".'$flux_config[\'db\'][\'dbname\'] = \''.addslashes($db_name)."';\n".'$flux_config[\'db\'][\'username\'] = \''.addslashes($db_username)."';\n".'$flux_config[\'db\'][\'password\'] = \''.addslashes($db_password)."';\n".'$flux_config[\'db\'][\'prefix\'] = \''.addslashes($db_prefix)."';\n\n".'$flux_config[\'cache\'][\'type\'] = '."'File';\n".'$flux_config[\'cache\'][\'dir\'] = PUN_ROOT.\'cache/\';'."\n\n".'$flux_config[\'cookie\'][\'name\'] = '."'".$cookie_name."';\n".'$flux_config[\'cookie\'][\'domain\'] = '."'';\n".'$flux_config[\'cookie\'][\'path\'] = '."'/';\n".'$flux_config[\'cookie\'][\'secure\'] = 0;'."\n".'$flux_config[\'cookie\'][\'seed\'] = \''.random_key(16, false, true).'\';'."\n\n".'$flux_config[\'base_url\'] = \''.$base_url.'\';'."\n\n".'define(\'PUN\', 1);'."\n";
+ $config = <<<EOT
+<?php
+
+define('PUN', 1);
+
+return array(
+ 'db' => array(
+ 'type' => '%s',
+ 'host' => '%s',
+ 'dbname' => '%s',
+ 'username' => '%s',
+ 'password' => '%s',
+ 'prefix' => '%s',
+ 'p_connect' => false,
+ ),
+ 'cache' => array(
+ 'type' => 'File',
+ 'dir' => PUN_ROOT.'cache/',
+ 'serializer' => array(
+ 'type' => 'VarExport',
+ ),
+ 'suffix' => '.php',
+ ),
+ 'cookie' => array(
+ 'name' => '%s',
+ 'domain' => '',
+ 'path' => '/',
+ 'secure' => 0,
+ 'seed' => '%s',
+ ),
+ 'base_url' => '%s',
+);
+EOT;
+
+ return sprintf($config, addslashes($db_type), addslashes($db_host), addslashes($db_name), addslashes($db_username), addslashes($db_password), addslashes($db_prefix), addslashes($cookie_name), addslashes($cookie_seed), addslashes($base_url));
}
2  modules/gettext
@@ -1 +1 @@
-Subproject commit c3b0d01f8657c3d6403c3b7d1bc00dd22214a784
+Subproject commit 5b635736a8a1f0cdf419f75e9d87ddd0d425a240

7 comments on commit 3def1c1

@taylorchu

it might be better if you just create config array normally, and use var_export.

@daris
Collaborator

I tried but it resolves PUN_ROOT constant to its value (changing it to full path)

@taylorchu

does it matter?

@daris
Collaborator

Yes, for example when you move fluxbb to another directory, the $config['cache']['dir'] will be incorrect

@taylorchu

but in that case PUN_ROOT has to be reset too

@daris
Collaborator

PUN_ROOT is automatically generated, look at the top of (almost) each file:
define('PUN_ROOT', dirname(__FILE__).'/');

@taylorchu

then this is good.

Please sign in to comment.
Something went wrong with that request. Please try again.