Help! - Custom Joomla Installer

1 post / 0 new
#1 Fri, 02/03/2017 - 11:18
KiXX

Help! - Custom Joomla Installer

I have written a custom joomla installer it all works fine except for setting up the configuration.php file with the database information below is my code:

if (!-r $cfile) {
        &run_as_domain_user($d, "cp ".quotemeta($cfileorig)." ".
                                      quotemeta($cfile));
        local $lref = &read_file_lines_as_domain_user($d, $cfile);
        local $l;
        foreach $l (@$lref) {
                if ($l =~ /^define\('$db',/) {
                        $l = "define('$db', '$dbname');";
                        }
                if ($l =~ /^define\('$user',/) {
                        $l = "define('$user', '$dbuser');";
                        }
                if ($l =~ /^define\('$host',/) {
                        $l = "define('$host', '$dbhost');";
                        }
                if ($l =~ /^define\('$password',/) {
                        $l = "define('$password', '".
                             &php_quotemeta($dbpass)."');";
                        }
                }
        &flush_file_lines_as_domain_user($d, $cfile);
        }

The joomla configuration.php looks like this:

/* Database Settings */
public $dbtype = 'mysqli';               // Normally mysqli
public $host = 'localhost';              // This is normally set to localhost
public $user = '';                       // DB username
public $password = '';                   // DB password
public $db = '';                         // DB database name
public $dbprefix = 'jos_';               // Do not change unless you need to!

Any help would be appreciated!