Editing config file

SDK Docs: http://installatron.com/developer/apps
SDK GUI Editor: http://installatron.com/editor
Sdesigns
Posts: 11
Joined: Mon Dec 03, 2012 7:32 am

Editing config file

Postby Sdesigns » Mon Dec 03, 2012 8:13 am

Hi,

My confi file is locate at

application/config/database.php

and looks like

Code: Select all

$db['default']['username'] = "user_username";
$db['default']['password'] = "password";
$db['default']['database'] = "user_dbname";


Can someone please tell me what I need to do to get the installer to insert the correct database info into the necessary fields. I have tried just about everything and just cannot get it to work :(

Thanks

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

Re: Editing config file

Postby Phil » Mon Dec 03, 2012 11:16 am

Hello,

You could do something like this:

Code: Select all

$this->sr("application/config/database.php",array(
'#"user_username"#' => $this->preg_var_export($this->db_user),
'#"password"#' => $this->preg_var_export($this->db_pass),
'#"user_dbname"#' => $this->preg_var_export($this->db_name),
));


Thank you,
Phil
Phillip Stier
Installatron Co-Founder

Sdesigns
Posts: 11
Joined: Mon Dec 03, 2012 7:32 am

Re: Editing config file

Postby Sdesigns » Mon Dec 03, 2012 12:24 pm

Hi Phil,

The code you posted almost works :)

It removed the old values but is not writing new ones, so I end up with

Code: Select all

$db['default']['username'] = "";
$db['default']['password'] = "";
$db['default']['database'] = "";

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

Re: Editing config file

Postby Phil » Mon Dec 03, 2012 12:31 pm

Hello,

In the XML is the "database" requirement should be set to "1" for those values to be populated. Is that set correctly?

Thank you,
Phil
Phillip Stier
Installatron Co-Founder

Sdesigns
Posts: 11
Joined: Mon Dec 03, 2012 7:32 am

Re: Editing config file

Postby Sdesigns » Mon Dec 03, 2012 12:55 pm

Hi,

The database is being populated now, but not the config file.

There is no such value in my XML file, this is all I have in it.

Code: Select all

<installer>
   <id>project name</id>
   <build>9</build>
   <url>http://path/to/file.tar.gz</url>
   <md5>7836b8e58db87eb2817125dfffe82d42</md5>
</installer>

Sdesigns
Posts: 11
Joined: Mon Dec 03, 2012 7:32 am

Re: Editing config file

Postby Sdesigns » Mon Dec 03, 2012 2:40 pm

Hi,
I just found the DB line in the GUI.

Yes it is set to "1"

Code: Select all

<requirement id="database" value="1"/>


Any other ideas why installatron would be removing the old values but not writing the new ones?

Josh
Staff
Posts: 131
Joined: Wed Jul 07, 2010 3:53 pm
Location: USA

Re: Editing config file

Postby Josh » Mon Dec 03, 2012 8:10 pm

Greetings,

As long as "database" is set in the XML this should be working. Note that the XML is cached and only updated when file timestamps change, so make sure you're seeing the "Database" section when installing the app. If you aren't seeing it, try deleting the /var/installatron/installers/APPID/ directory from your server and recopying the app package files.

Best regards,
Josh

Sdesigns
Posts: 11
Joined: Mon Dec 03, 2012 7:32 am

Re: Editing config file

Postby Sdesigns » Tue Dec 04, 2012 5:04 am

Hi,

I am seeing the database section during installation.
Here is what is currently happening.

Archive is extracted correctly
Database is added correctly
Database is populated from .sql file correctly
Application Admin user/pass are imported into database correctly
config file is edited (old values removed but no new values inserted)

Currently my step 3 of installation looks like this

Code: Select all

//==========================================================================
// STEP III: CONFIGURING INSTALL
//==========================================================================
   
public function step3_init()
{
   $this->setStepLabel("_step_progress_processing");
}
   
public function step3_process()
{
{
   
   $this->db_import("install/assets/install.sql");
$this->sr("application/config/database.php",array(
'#"user_username"#' => var_export($this->db_user,true),
'#"password"#' => var_export($this->db_pass,true),
'#"user_dbname"#' => var_export($this->db_name,true),
));
}
}

Sdesigns
Posts: 11
Joined: Mon Dec 03, 2012 7:32 am

Re: Editing config file

Postby Sdesigns » Tue Dec 04, 2012 6:59 am

OK, I got it working.
I made a new config file which edited just fine, and then move it to the required directory.
Still unsure why it would not edit the original file though, but at least it is working.


Return to “Application Packaging SDK and Application Customizations”

Who is online

Users browsing this forum: No registered users and 3 guests