Syntax for installatron variables in config files

SDK Docs: http://installatron.com/developer/apps
SDK GUI Editor: http://installatron.com/editor
ZeeBOB
Posts: 3
Joined: Fri Oct 28, 2011 4:58 am

Syntax for installatron variables in config files

Postby ZeeBOB » Sun Oct 30, 2011 2:20 am

Hi,

Could someone confirm for me exactly what I should be putting in my config files for installatron.

The config file is:

define('DB_HOST', 'localhost'); // The host/ip to your SQL server
define('DB_USER', 'user'); // The username to connect with
define('DB_PASS', 'pass'); // The password
define('DB_NAME', 'name'); // Database name
define('DB_PREFIX', 'prefix'); // The table prefix
define('DB_PORT','3306'); // The SQL port (Default: 3306)


And I'm using the code provided in your SDK documentation

// use regex to edit a file:
// - insert the Installatron-generated database values into the config file
// - insert the path and url into the config file
$this->sr("CONFIG_FILE.php", array(
"#DB_VAR_HOST = '.*?'#" => "DB_VAR_HOST = ".var_export($this->db_host,true),
"#DB_VAR_NAME = '.*?'#" => "DB_VAR_NAME = ".var_export($this->db_name,true),
"#DB_VAR_USER = '.*?'#" => "DB_VAR_USER = ".var_export($this->db_user,true),
"#DB_VAR_PASS = '.*?'#" => "DB_VAR_PASS = ".var_export($this->db_pass,true),
"#DB_VAR_PREF = '.*?'#" => "DB_VAR_PREF = ".var_export($this->db_prefix,true),

"#SCRIPT_PATH_VAR = '.*?'#" => "SCRIPT_PATH_VAR = ".var_export($this->path,true),
"#SCRIPT_URL_VAR = '.*?'#" => "SCRIPT_URL_VAR = ".var_export($this->url,true),
));


So what do I replace the parts in red with?

Phil
Staff
Posts: 488
Joined: Tue Jun 19, 2007 6:06 am

Re: Syntax for installatron variables in config files

Postby Phil » Tue Nov 01, 2011 1:39 am

Hello,

This would replace each of the red values with the correct installation values:

Code: Select all

foreach ( array(   "DB_HOST"   => $this->db_host,
               "DB_NAME"   => $this->db_name,
               "DB_USER"   => $this->db_user,
               "DB_PASS"   => $this->db_pass,
               "DB_PREFIX"   => $this->db_prefix ) as $k => $v )
{
   $sr["#'$k', '[^']+'#"] = "'$k', ".var_export($v,true);
}

$this->sr("CONFIG_FILE.php", $sr);

If there are any questions let us know.

Thank you,
Phil.
Phillip Stier
Installatron Co-Founder


Return to “Application Packaging SDK and Application Customizations”

Who is online

Users browsing this forum: No registered users and 3 guests