Add new INI config files

- Add new local.ini.tpl template
- Change all references from .htconfig.php to config/local.ini.php
This commit is contained in:
Hypolite Petovan 2018-06-24 20:26:00 -04:00
parent 7c17d2026f
commit 2503660f97
10 changed files with 585 additions and 36 deletions

View file

@ -66,7 +66,7 @@ class Install extends BaseObject
/**
* Executes the installation of Friendica in the given environment.
* - Creates `.htconfig.php`
* - Creates `config/local.ini.php`
* - Installs Database Structure
*
* @param string $urlpath Path based on the URL of Friendica (e.g. '/friendica')
@ -82,7 +82,7 @@ class Install extends BaseObject
*/
public static function install($urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $phpath, $timezone, $language, $adminmail, $rino = 1)
{
$tpl = get_markup_template('htconfig.tpl');
$tpl = get_markup_template('local.ini.tpl');
$txt = replace_macros($tpl,[
'$dbhost' => $dbhost,
'$dbuser' => $dbuser,
@ -96,7 +96,7 @@ class Install extends BaseObject
'$rino' => $rino
]);
$result = file_put_contents('.htconfig.php', $txt);
$result = file_put_contents('config/local.ini.php', $txt);
if (! $result) {
self::getApp()->data['txt'] = $txt;
}
@ -303,9 +303,9 @@ class Install extends BaseObject
}
/**
* ".htconfig.php" - Check
* "config/local.ini.php" - Check
*
* Checks if it's possible to create the ".htconfig.php"
* Checks if it's possible to create the "config/local.ini.php"
*
* @param array $checks The list of all checks (by-ref parameter!)
*/
@ -313,17 +313,17 @@ class Install extends BaseObject
{
$status = true;
$help = "";
if ((file_exists('.htconfig.php') && !is_writable('.htconfig.php')) ||
(!file_exists('.htconfig.php') && !is_writable('.'))) {
if ((file_exists('config/local.ini.php') && !is_writable('config/local.ini.php')) ||
(!file_exists('config/local.ini.php') && !is_writable('.'))) {
$status = false;
$help = L10n::t('The web installer needs to be able to create a file called ".htconfig.php" in the top folder of your web server and it is unable to do so.') . EOL;
$help = L10n::t('The web installer needs to be able to create a file called "local.ini.php" in the "config" folder of your web server and it is unable to do so.') . EOL;
$help .= L10n::t('This is most often a permission setting, as the web server may not be able to write files in your folder - even if you can.') . EOL;
$help .= L10n::t('At the end of this procedure, we will give you a text to save in a file named .htconfig.php in your Friendica top folder.') . EOL;
$help .= L10n::t('At the end of this procedure, we will give you a text to save in a file named local.ini.php in your Friendica "config" folder.') . EOL;
$help .= L10n::t('You can alternatively skip this procedure and perform a manual installation. Please see the file "INSTALL.txt" for instructions.') . EOL;
}
self::addCheck($checks, L10n::t('.htconfig.php is writable'), $status, false, $help);
self::addCheck($checks, L10n::t('config/local.ini.php is writable'), $status, false, $help);
}