Update install to generate config/local.config.php
This commit is contained in:
parent
d6eb1135e5
commit
98d90e131d
12 changed files with 168 additions and 89 deletions
|
@ -17,7 +17,7 @@ env:
|
||||||
install:
|
install:
|
||||||
- composer install
|
- composer install
|
||||||
before_script:
|
before_script:
|
||||||
- cp config/local-sample.ini.php config/local.ini.php
|
- cp config/local-sample.config.php config/local.config.php
|
||||||
- mysql -e 'CREATE DATABASE IF NOT EXISTS test;'
|
- mysql -e 'CREATE DATABASE IF NOT EXISTS test;'
|
||||||
- mysql -utravis test < database.sql
|
- mysql -utravis test < database.sql
|
||||||
- echo "extension=redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
- echo "extension=redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||||
|
|
29
INSTALL.txt
29
INSTALL.txt
|
@ -114,7 +114,7 @@ password, database name).
|
||||||
|
|
||||||
4. If you know in advance that it will be impossible for the web server to
|
4. If you know in advance that it will be impossible for the web server to
|
||||||
write or create files in the config/ subfolder, create an empty file called
|
write or create files in the config/ subfolder, create an empty file called
|
||||||
local.ini.php and make it writable by the web server.
|
local.config.php and make it writable by the web server.
|
||||||
|
|
||||||
5. Visit your website with a web browser and follow the instructions. Please
|
5. Visit your website with a web browser and follow the instructions. Please
|
||||||
note any error messages and correct these before continuing.
|
note any error messages and correct these before continuing.
|
||||||
|
@ -128,9 +128,9 @@ so in the host name setting for the database.
|
||||||
|
|
||||||
6. *If* the automated installation fails for any reason, check the following:
|
6. *If* the automated installation fails for any reason, check the following:
|
||||||
|
|
||||||
- "config/local.ini.php" exists
|
- "config/local.config.php" exists
|
||||||
If not, edit local-sample.ini.php and change system settings. Rename
|
If not, edit local-sample.config.php and change system settings. Rename
|
||||||
to local.ini.php
|
to local.config.php
|
||||||
- Database is populated.
|
- Database is populated.
|
||||||
If not, import the contents of "database.sql" with phpmyadmin
|
If not, import the contents of "database.sql" with phpmyadmin
|
||||||
or mysql command line
|
or mysql command line
|
||||||
|
@ -139,7 +139,7 @@ or mysql command line
|
||||||
Registration errors should all be recoverable automatically.
|
Registration errors should all be recoverable automatically.
|
||||||
If you get any *critical* failure at this point, it generally indicates the
|
If you get any *critical* failure at this point, it generally indicates the
|
||||||
database was not installed correctly. You might wish to move/rename
|
database was not installed correctly. You might wish to move/rename
|
||||||
local.ini.php to another name and empty (called 'dropping') the database
|
local.config.php to another name and empty (called 'dropping') the database
|
||||||
tables, so that you can start fresh.
|
tables, so that you can start fresh.
|
||||||
|
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
|
@ -184,7 +184,7 @@ Bad things will happen. Let there be a hardware failure, a corrupted
|
||||||
database or whatever you can think of. So once the installation of your
|
database or whatever you can think of. So once the installation of your
|
||||||
Friendica node is done, you should make yoursef a backup plan.
|
Friendica node is done, you should make yoursef a backup plan.
|
||||||
|
|
||||||
The most important file is the `config/local.ini.php` file in the base directory.
|
The most important file is the `config/local.config.php` file in the base directory.
|
||||||
As it stores all your data, you should also have a recent dump of your
|
As it stores all your data, you should also have a recent dump of your
|
||||||
Friendica database at hand, should you have to recover your node.
|
Friendica database at hand, should you have to recover your node.
|
||||||
|
|
||||||
|
@ -281,21 +281,21 @@ Windows).
|
||||||
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
- If you are unable to write the file config/local.ini.php during installation
|
- If you are unable to write the file config/local.config.php during installation
|
||||||
due to permissions issues:
|
due to permissions issues:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
create an empty file with that name and give it world-write permission.
|
create an empty file with that name and give it world-write permission.
|
||||||
For Linux:
|
For Linux:
|
||||||
|
|
||||||
% touch config/local.ini.php
|
% touch config/local.config.php
|
||||||
% chmod 664 config/local.ini.php
|
% chmod 664 config/local.config.php
|
||||||
|
|
||||||
Retry the installation. As soon as the database has been created,
|
Retry the installation. As soon as the database has been created,
|
||||||
|
|
||||||
******* this is important *********
|
******* this is important *********
|
||||||
|
|
||||||
% chmod 644 config/local.ini.php
|
% chmod 644 config/local.config.php
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
- Some configurations with "suhosin" security are configured without
|
- Some configurations with "suhosin" security are configured without
|
||||||
|
@ -334,11 +334,12 @@ After a while I noticed, that bin/worker.php calls further php script via
|
||||||
proc_open. These scripts themselves also use proc_open and fail, because they
|
proc_open. These scripts themselves also use proc_open and fail, because they
|
||||||
are NOT called with -d suhosin.executor.func.blacklist=none.
|
are NOT called with -d suhosin.executor.func.blacklist=none.
|
||||||
|
|
||||||
So the simple solution is to put the correct parameters into config/local.ini.php:
|
So the simple solution is to put the correct parameters into config/local.config.php:
|
||||||
|
|
||||||
[config]
|
'config' => [
|
||||||
; Location of PHP command line processor
|
//Location of PHP command line processor
|
||||||
php_path = "/usr/bin/php -d suhosin.executor.func.blacklist=none -d suhosin.executor.eval.blacklist=none"
|
'php_path' => '/usr/bin/php -d suhosin.executor.func.blacklist=none -d suhosin.executor.eval.blacklist=none',
|
||||||
|
],
|
||||||
|
|
||||||
This is obvious as soon as you notice that the friendica-cron uses proc_open to
|
This is obvious as soon as you notice that the friendica-cron uses proc_open to
|
||||||
execute php-scripts that also use proc_open, but it took me quite some time to
|
execute php-scripts that also use proc_open, but it took me quite some time to
|
||||||
|
|
|
@ -86,8 +86,7 @@ cd /var/www
|
||||||
php bin/composer.phar install
|
php bin/composer.phar install
|
||||||
|
|
||||||
# initial config file for friendica in vagrant
|
# initial config file for friendica in vagrant
|
||||||
#cp /vagrant/util/htconfig.vagrant.php /vagrant/.htconfig.php
|
cp /vagrant/util/local.config.vagrant.php /vagrant/config/local.config.php
|
||||||
cp /vagrant/util/local.ini.vagrant.php /vagrant/config/local.ini.php
|
|
||||||
|
|
||||||
# copy the .htaccess-dist file to .htaccess so that rewrite rules work
|
# copy the .htaccess-dist file to .htaccess so that rewrite rules work
|
||||||
cp /vagrant/.htaccess-dist /vagrant/.htaccess
|
cp /vagrant/.htaccess-dist /vagrant/.htaccess
|
||||||
|
|
|
@ -52,8 +52,9 @@ class Mode
|
||||||
|
|
||||||
$this->mode = 0;
|
$this->mode = 0;
|
||||||
|
|
||||||
if (!file_exists($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php')
|
if (!file_exists($this->basepath . '/config/local.config.php')
|
||||||
&& !file_exists($this->basepath . DIRECTORY_SEPARATOR . '.htconfig.php')) {
|
&& !file_exists($this->basepath . '/config/local.ini.php')
|
||||||
|
&& !file_exists($this->basepath . '/.htconfig.php')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ Synopsis
|
||||||
bin/console autoinstall [-h|--help|-?] [-v] [-a] [-f]
|
bin/console autoinstall [-h|--help|-?] [-v] [-a] [-f]
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Installs Friendica with data based on the local.ini.php file or environment variables
|
Installs Friendica with data based on the local.config.php file or environment variables
|
||||||
|
|
||||||
Notes
|
Notes
|
||||||
Not checking .htaccess/URL-Rewrite during CLI installation.
|
Not checking .htaccess/URL-Rewrite during CLI installation.
|
||||||
|
@ -32,7 +32,7 @@ Options
|
||||||
-h|--help|-? Show help information
|
-h|--help|-? Show help information
|
||||||
-v Show more debug information.
|
-v Show more debug information.
|
||||||
-a All setup checks are required (except .htaccess)
|
-a All setup checks are required (except .htaccess)
|
||||||
-f|--file <config> prepared config file (e.g. "config/local.ini.php" itself) which will override every other config option - except the environment variables)
|
-f|--file <config> prepared config file (e.g. "config/local.config.php" itself) which will override every other config option - except the environment variables)
|
||||||
-s|--savedb Save the DB credentials to the file (if environment variables is used)
|
-s|--savedb Save the DB credentials to the file (if environment variables is used)
|
||||||
-H|--dbhost <host> The host of the mysql/mariadb database (env MYSQL_HOST)
|
-H|--dbhost <host> The host of the mysql/mariadb database (env MYSQL_HOST)
|
||||||
-p|--dbport <port> The port of the mysql/mariadb database (env MYSQL_PORT)
|
-p|--dbport <port> The port of the mysql/mariadb database (env MYSQL_PORT)
|
||||||
|
@ -58,11 +58,11 @@ Environment variables
|
||||||
FRIENDICA_LANG The langauge of Friendica
|
FRIENDICA_LANG The langauge of Friendica
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
bin/console autoinstall -f 'input.ini.php
|
bin/console autoinstall -f 'input.config.php
|
||||||
Installs Friendica with the prepared 'input.ini.php' file
|
Installs Friendica with the prepared 'input.config.php' file
|
||||||
|
|
||||||
bin/console autoinstall --savedb
|
bin/console autoinstall --savedb
|
||||||
Installs Friendica with environment variables and saves them to the 'config/local.ini.php' file
|
Installs Friendica with environment variables and saves them to the 'config/local.config.php' file
|
||||||
|
|
||||||
bin/console autoinstall -h localhost -p 3365 -U user -P passwort1234 -d friendica
|
bin/console autoinstall -h localhost -p 3365 -U user -P passwort1234 -d friendica
|
||||||
Installs Friendica with a local mysql database with credentials
|
Installs Friendica with a local mysql database with credentials
|
||||||
|
@ -96,11 +96,11 @@ HELP;
|
||||||
$config_file = $this->getOption(['f', 'file']);
|
$config_file = $this->getOption(['f', 'file']);
|
||||||
|
|
||||||
if (!empty($config_file)) {
|
if (!empty($config_file)) {
|
||||||
if ($config_file != 'config' . DIRECTORY_SEPARATOR . 'local.ini.php') {
|
if ($config_file != 'config' . DIRECTORY_SEPARATOR . 'local.config.php') {
|
||||||
// Copy config file
|
// Copy config file
|
||||||
$this->out("Copying config file...\n");
|
$this->out("Copying config file...\n");
|
||||||
if (!copy($a->getBasePath() . DIRECTORY_SEPARATOR . $config_file, $a->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php')) {
|
if (!copy($a->getBasePath() . DIRECTORY_SEPARATOR . $config_file, $a->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.config.php')) {
|
||||||
throw new RuntimeException("ERROR: Saving config file failed. Please copy '$config_file' to '" . $a->getBasePath() . "'" . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "local.ini.php' manually.\n");
|
throw new RuntimeException("ERROR: Saving config file failed. Please copy '$config_file' to '" . $a->getBasePath() . "'" . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "local.config.php' manually.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ HELP;
|
||||||
Theme::install(Config::get('system', 'theme'));
|
Theme::install(Config::get('system', 'theme'));
|
||||||
$this->out(" Complete\n\n");
|
$this->out(" Complete\n\n");
|
||||||
} else {
|
} else {
|
||||||
$this->out(" Theme setting is empty. Please check the file 'config/local.ini.php'\n\n");
|
$this->out(" Theme setting is empty. Please check the file 'config/local.config.php'\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->out("\nInstallation is finished\n");
|
$this->out("\nInstallation is finished\n");
|
||||||
|
|
|
@ -123,7 +123,7 @@ class Installer
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the installation of Friendica in the given environment.
|
* Executes the installation of Friendica in the given environment.
|
||||||
* - Creates `config/local.ini.php`
|
* - Creates `config/local.config.php`
|
||||||
* - Installs Database Structure
|
* - Installs Database Structure
|
||||||
*
|
*
|
||||||
* @param string $phppath Path to the PHP-Binary (optional, if not set e.g. 'php' or '/usr/bin/php')
|
* @param string $phppath Path to the PHP-Binary (optional, if not set e.g. 'php' or '/usr/bin/php')
|
||||||
|
@ -141,7 +141,7 @@ class Installer
|
||||||
*/
|
*/
|
||||||
public function createConfig($phppath, $urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $timezone, $language, $adminmail, $basepath)
|
public function createConfig($phppath, $urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $timezone, $language, $adminmail, $basepath)
|
||||||
{
|
{
|
||||||
$tpl = Renderer::getMarkupTemplate('local.ini.tpl');
|
$tpl = Renderer::getMarkupTemplate('local.config.tpl');
|
||||||
$txt = Renderer::replaceMacros($tpl, [
|
$txt = Renderer::replaceMacros($tpl, [
|
||||||
'$phpath' => $phppath,
|
'$phpath' => $phppath,
|
||||||
'$dbhost' => $dbhost,
|
'$dbhost' => $dbhost,
|
||||||
|
@ -154,10 +154,10 @@ class Installer
|
||||||
'$adminmail' => $adminmail,
|
'$adminmail' => $adminmail,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$result = file_put_contents($basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php', $txt);
|
$result = file_put_contents($basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.config.php', $txt);
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$this->addCheck(L10n::t('The database configuration file "config/local.ini.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.'), false, false, htmlentities($txt, ENT_COMPAT, 'UTF-8'));
|
$this->addCheck(L10n::t('The database configuration file "config/local.config.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.'), false, false, htmlentities($txt, ENT_COMPAT, 'UTF-8'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -444,9 +444,9 @@ class Installer
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "config/local.ini.php" - Check
|
* "config/local.config.php" - Check
|
||||||
*
|
*
|
||||||
* Checks if it's possible to create the "config/local.ini.php"
|
* Checks if it's possible to create the "config/local.config.php"
|
||||||
*
|
*
|
||||||
* @return bool false if something required failed
|
* @return bool false if something required failed
|
||||||
*/
|
*/
|
||||||
|
@ -454,17 +454,17 @@ class Installer
|
||||||
{
|
{
|
||||||
$status = true;
|
$status = true;
|
||||||
$help = "";
|
$help = "";
|
||||||
if ((file_exists('config/local.ini.php') && !is_writable('config/local.ini.php')) ||
|
if ((file_exists('config/local.config.php') && !is_writable('config/local.config.php')) ||
|
||||||
(!file_exists('config/local.ini.php') && !is_writable('.'))) {
|
(!file_exists('config/local.config.php') && !is_writable('.'))) {
|
||||||
|
|
||||||
$status = false;
|
$status = false;
|
||||||
$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('The web installer needs to be able to create a file called "local.config.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('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 local.ini.php in your Friendica "config" folder.') . EOL;
|
$help .= L10n::t('At the end of this procedure, we will give you a text to save in a file named local.config.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;
|
$help .= L10n::t('You can alternatively skip this procedure and perform a manual installation. Please see the file "INSTALL.txt" for instructions.') . EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->addCheck(L10n::t('config/local.ini.php is writable'), $status, false, $help);
|
$this->addCheck(L10n::t('config/local.config.php is writable'), $status, false, $help);
|
||||||
|
|
||||||
// Local INI File is not required
|
// Local INI File is not required
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -27,9 +27,9 @@ trait VFSTrait
|
||||||
// create a virtual directory and copy all needed files and folders to it
|
// create a virtual directory and copy all needed files and folders to it
|
||||||
$this->root = vfsStream::setup('friendica', null, $structure);
|
$this->root = vfsStream::setup('friendica', null, $structure);
|
||||||
|
|
||||||
$this->setConfigFile('config.ini.php');
|
$this->setConfigFile('defaults.config.php');
|
||||||
$this->setConfigFile('settings.ini.php');
|
$this->setConfigFile('settings.config.php');
|
||||||
$this->setConfigFile('local.ini.php');
|
$this->setConfigFile('local.config.php');
|
||||||
$this->setConfigFile('dbstructure.config.php');
|
$this->setConfigFile('dbstructure.config.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,11 +36,11 @@ class ModeTest extends MockedTest
|
||||||
{
|
{
|
||||||
$mode = new Mode($this->root->url());
|
$mode = new Mode($this->root->url());
|
||||||
|
|
||||||
$this->assertTrue($this->root->hasChild('config/local.ini.php'));
|
$this->assertTrue($this->root->hasChild('config/local.config.php'));
|
||||||
|
|
||||||
$this->delConfigFile('local.ini.php');
|
$this->delConfigFile('local.config.php');
|
||||||
|
|
||||||
$this->assertFalse($this->root->hasChild('config/local.ini.php'));
|
$this->assertFalse($this->root->hasChild('config/local.config.php'));
|
||||||
|
|
||||||
$mode->determine();
|
$mode->determine();
|
||||||
|
|
||||||
|
|
|
@ -41,9 +41,9 @@ class AutomaticInstallationConsoleTest extends ConsoleTest
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
if ($this->root->hasChild('config' . DIRECTORY_SEPARATOR . 'local.ini.php')) {
|
if ($this->root->hasChild('config' . DIRECTORY_SEPARATOR . 'local.config.php')) {
|
||||||
$this->root->getChild('config')
|
$this->root->getChild('config')
|
||||||
->removeChild('local.ini.php');
|
->removeChild('local.config.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db_host = getenv('MYSQL_HOST');
|
$this->db_host = getenv('MYSQL_HOST');
|
||||||
|
@ -58,7 +58,7 @@ class AutomaticInstallationConsoleTest extends ConsoleTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the arguments which is asserted to be passed to 'replaceMacros()' for creating the local.ini.php
|
* Creates the arguments which is asserted to be passed to 'replaceMacros()' for creating the local.config.php
|
||||||
*
|
*
|
||||||
* @param bool $withDb if true, DB will get saved too
|
* @param bool $withDb if true, DB will get saved too
|
||||||
*
|
*
|
||||||
|
@ -184,51 +184,53 @@ FIN;
|
||||||
$this->mockUpdate([false, true, true], null, 1);
|
$this->mockUpdate([false, true, true], null, 1);
|
||||||
|
|
||||||
$config = <<<CONF
|
$config = <<<CONF
|
||||||
<?php return <<<INI
|
<?php
|
||||||
|
|
||||||
[database]
|
// Local configuration
|
||||||
hostname =
|
|
||||||
username =
|
|
||||||
password =
|
|
||||||
database =
|
|
||||||
charset = utf8mb4
|
|
||||||
|
|
||||||
|
// If you're unsure about what any of the config keys below do, please check the config/defaults.config.php for detailed
|
||||||
|
// documentation of their data type and behavior.
|
||||||
|
|
||||||
; ****************************************************************
|
return [
|
||||||
; The configuration below will be overruled by the admin panel.
|
'database' => [
|
||||||
; Changes made below will only have an effect if the database does
|
'hostname' => '',
|
||||||
; not contain any configuration for the friendica system.
|
'username' => '',
|
||||||
; ****************************************************************
|
'password' => '',
|
||||||
|
'database' => '',
|
||||||
|
'charset' => 'utf8mb4',
|
||||||
|
],
|
||||||
|
|
||||||
[config]
|
// ****************************************************************
|
||||||
admin_email =
|
// The configuration below will be overruled by the admin panel.
|
||||||
|
// Changes made below will only have an effect if the database does
|
||||||
sitename = Friendica Social Network
|
// not contain any configuration for the friendica system.
|
||||||
|
// ****************************************************************
|
||||||
register_policy = REGISTER_OPEN
|
|
||||||
register_text =
|
|
||||||
|
|
||||||
[system]
|
|
||||||
default_timezone = UTC
|
|
||||||
|
|
||||||
language = en
|
|
||||||
INI;
|
|
||||||
// Keep this line
|
|
||||||
|
|
||||||
|
'config' => [
|
||||||
|
'admin_email' => '',
|
||||||
|
'sitename' => 'Friendica Social Network',
|
||||||
|
'register_policy' => 'REGISTER_OPEN',
|
||||||
|
'register_text' => '',
|
||||||
|
],
|
||||||
|
'system' => [
|
||||||
|
'default_timezone' => 'UTC',
|
||||||
|
'language' => 'en',
|
||||||
|
],
|
||||||
|
];
|
||||||
CONF;
|
CONF;
|
||||||
|
|
||||||
vfsStream::newFile('prepared.ini.php')
|
vfsStream::newFile('prepared.config.php')
|
||||||
->at($this->root)
|
->at($this->root)
|
||||||
->setContent($config);
|
->setContent($config);
|
||||||
|
|
||||||
$console = new AutomaticInstallation($this->consoleArgv);
|
$console = new AutomaticInstallation($this->consoleArgv);
|
||||||
$console->setOption('f', 'prepared.ini.php');
|
$console->setOption('f', 'prepared.config.php');
|
||||||
|
|
||||||
$txt = $this->dumpExecute($console);
|
$txt = $this->dumpExecute($console);
|
||||||
|
|
||||||
$this->assertFinished($txt, false, true);
|
$this->assertFinished($txt, false, true);
|
||||||
|
|
||||||
$this->assertTrue($this->root->hasChild('config' . DIRECTORY_SEPARATOR . 'local.ini.php'));
|
$this->assertTrue($this->root->hasChild('config' . DIRECTORY_SEPARATOR . 'local.config.php'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -241,7 +243,7 @@ CONF;
|
||||||
$this->mockExistsTable('user', false, 1);
|
$this->mockExistsTable('user', false, 1);
|
||||||
$this->mockUpdate([false, true, true], null, 1);
|
$this->mockUpdate([false, true, true], null, 1);
|
||||||
|
|
||||||
$this->mockGetMarkupTemplate('local.ini.tpl', 'testTemplate', 1);
|
$this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
|
||||||
$this->mockReplaceMacros('testTemplate', $this->createArgumentsForMacro(true), '', 1);
|
$this->mockReplaceMacros('testTemplate', $this->createArgumentsForMacro(true), '', 1);
|
||||||
|
|
||||||
$this->assertTrue(putenv('FRIENDICA_ADMIN_MAIL=admin@friendica.local'));
|
$this->assertTrue(putenv('FRIENDICA_ADMIN_MAIL=admin@friendica.local'));
|
||||||
|
@ -267,7 +269,7 @@ CONF;
|
||||||
$this->mockExistsTable('user', false, 1);
|
$this->mockExistsTable('user', false, 1);
|
||||||
$this->mockUpdate([false, true, true], null, 1);
|
$this->mockUpdate([false, true, true], null, 1);
|
||||||
|
|
||||||
$this->mockGetMarkupTemplate('local.ini.tpl', 'testTemplate', 1);
|
$this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
|
||||||
$this->mockReplaceMacros('testTemplate', $this->createArgumentsForMacro(false), '', 1);
|
$this->mockReplaceMacros('testTemplate', $this->createArgumentsForMacro(false), '', 1);
|
||||||
|
|
||||||
$this->assertTrue(putenv('FRIENDICA_ADMIN_MAIL=admin@friendica.local'));
|
$this->assertTrue(putenv('FRIENDICA_ADMIN_MAIL=admin@friendica.local'));
|
||||||
|
@ -292,7 +294,7 @@ CONF;
|
||||||
$this->mockExistsTable('user', false, 1);
|
$this->mockExistsTable('user', false, 1);
|
||||||
$this->mockUpdate([false, true, true], null, 1);
|
$this->mockUpdate([false, true, true], null, 1);
|
||||||
|
|
||||||
$this->mockGetMarkupTemplate('local.ini.tpl', 'testTemplate', 1);
|
$this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
|
||||||
$this->mockReplaceMacros('testTemplate', $this->createArgumentsForMacro(true), '', 1);
|
$this->mockReplaceMacros('testTemplate', $this->createArgumentsForMacro(true), '', 1);
|
||||||
|
|
||||||
$console = new AutomaticInstallation($this->consoleArgv);
|
$console = new AutomaticInstallation($this->consoleArgv);
|
||||||
|
@ -326,7 +328,7 @@ CONF;
|
||||||
{
|
{
|
||||||
$this->mockConnect(false, 1);
|
$this->mockConnect(false, 1);
|
||||||
|
|
||||||
$this->mockGetMarkupTemplate('local.ini.tpl', 'testTemplate', 1);
|
$this->mockGetMarkupTemplate('local.config.tpl', 'testTemplate', 1);
|
||||||
$this->mockReplaceMacros('testTemplate', $this->createArgumentsForMacro(false), '', 1);
|
$this->mockReplaceMacros('testTemplate', $this->createArgumentsForMacro(false), '', 1);
|
||||||
|
|
||||||
$this->assertTrue(putenv('FRIENDICA_ADMIN_MAIL=admin@friendica.local'));
|
$this->assertTrue(putenv('FRIENDICA_ADMIN_MAIL=admin@friendica.local'));
|
||||||
|
@ -350,7 +352,7 @@ Synopsis
|
||||||
bin/console autoinstall [-h|--help|-?] [-v] [-a] [-f]
|
bin/console autoinstall [-h|--help|-?] [-v] [-a] [-f]
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Installs Friendica with data based on the local.ini.php file or environment variables
|
Installs Friendica with data based on the local.config.php file or environment variables
|
||||||
|
|
||||||
Notes
|
Notes
|
||||||
Not checking .htaccess/URL-Rewrite during CLI installation.
|
Not checking .htaccess/URL-Rewrite during CLI installation.
|
||||||
|
@ -359,7 +361,7 @@ Options
|
||||||
-h|--help|-? Show help information
|
-h|--help|-? Show help information
|
||||||
-v Show more debug information.
|
-v Show more debug information.
|
||||||
-a All setup checks are required (except .htaccess)
|
-a All setup checks are required (except .htaccess)
|
||||||
-f|--file <config> prepared config file (e.g. "config/local.ini.php" itself) which will override every other config option - except the environment variables)
|
-f|--file <config> prepared config file (e.g. "config/local.config.php" itself) which will override every other config option - except the environment variables)
|
||||||
-s|--savedb Save the DB credentials to the file (if environment variables is used)
|
-s|--savedb Save the DB credentials to the file (if environment variables is used)
|
||||||
-H|--dbhost <host> The host of the mysql/mariadb database (env MYSQL_HOST)
|
-H|--dbhost <host> The host of the mysql/mariadb database (env MYSQL_HOST)
|
||||||
-p|--dbport <port> The port of the mysql/mariadb database (env MYSQL_PORT)
|
-p|--dbport <port> The port of the mysql/mariadb database (env MYSQL_PORT)
|
||||||
|
@ -385,11 +387,11 @@ Environment variables
|
||||||
FRIENDICA_LANG The langauge of Friendica
|
FRIENDICA_LANG The langauge of Friendica
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
bin/console autoinstall -f 'input.ini.php
|
bin/console autoinstall -f 'input.config.php
|
||||||
Installs Friendica with the prepared 'input.ini.php' file
|
Installs Friendica with the prepared 'input.config.php' file
|
||||||
|
|
||||||
bin/console autoinstall --savedb
|
bin/console autoinstall --savedb
|
||||||
Installs Friendica with environment variables and saves them to the 'config/local.ini.php' file
|
Installs Friendica with environment variables and saves them to the 'config/local.config.php' file
|
||||||
|
|
||||||
bin/console autoinstall -h localhost -p 3365 -U user -P passwort1234 -d friendica
|
bin/console autoinstall -h localhost -p 3365 -U user -P passwort1234 -d friendica
|
||||||
Installs Friendica with a local mysql database with credentials
|
Installs Friendica with a local mysql database with credentials
|
||||||
|
|
|
@ -195,14 +195,14 @@ class InstallerTest extends MockedTest
|
||||||
*/
|
*/
|
||||||
public function testCheckLocalIni()
|
public function testCheckLocalIni()
|
||||||
{
|
{
|
||||||
$this->assertTrue($this->root->hasChild('config/local.ini.php'));
|
$this->assertTrue($this->root->hasChild('config/local.config.php'));
|
||||||
|
|
||||||
$install = new Installer();
|
$install = new Installer();
|
||||||
$this->assertTrue($install->checkLocalIni());
|
$this->assertTrue($install->checkLocalIni());
|
||||||
|
|
||||||
$this->delConfigFile('local.ini.php');
|
$this->delConfigFile('local.config.php');
|
||||||
|
|
||||||
$this->assertFalse($this->root->hasChild('config/local.ini.php'));
|
$this->assertFalse($this->root->hasChild('config/local.config.php'));
|
||||||
|
|
||||||
$install = new Installer();
|
$install = new Installer();
|
||||||
$this->assertTrue($install->checkLocalIni());
|
$this->assertTrue($install->checkLocalIni());
|
||||||
|
|
41
util/local.config.vagrant.php
Normal file
41
util/local.config.vagrant.php
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Local configuration
|
||||||
|
|
||||||
|
/* If automatic system installation fails:
|
||||||
|
*
|
||||||
|
* Copy this file to local.config.php
|
||||||
|
*
|
||||||
|
* Why local.config.php? Because it contains sensitive information which could
|
||||||
|
* give somebody complete control of your database. Apache's default
|
||||||
|
* configuration will interpret any .php file as a script and won't show the values
|
||||||
|
*
|
||||||
|
* Then set the following for your MySQL installation
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [
|
||||||
|
'database' => [
|
||||||
|
'hostname' => 'localhost',
|
||||||
|
'username' => 'mysqlusername',
|
||||||
|
'password' => 'mysqlpassword',
|
||||||
|
'database' => 'mysqldatabasename',
|
||||||
|
'charset' => 'utf8mb4',
|
||||||
|
],
|
||||||
|
|
||||||
|
// ****************************************************************
|
||||||
|
// The configuration below will be overruled by the admin panel.
|
||||||
|
// Changes made below will only have an effect if the database does
|
||||||
|
// not contain any configuration for the friendica system.
|
||||||
|
// ****************************************************************
|
||||||
|
|
||||||
|
'config' => [
|
||||||
|
'admin_email' => 'admin@friendica.local',
|
||||||
|
'sitename' => 'Friendica Social Network',
|
||||||
|
'register_policy' => 'REGISTER_OPEN',
|
||||||
|
'register_text' => '',
|
||||||
|
],
|
||||||
|
'system' => [
|
||||||
|
'default_timezone' => 'UTC',
|
||||||
|
'language' => 'en',
|
||||||
|
],
|
||||||
|
];
|
35
view/templates/local.config.tpl
Normal file
35
view/templates/local.config.tpl
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Local configuration
|
||||||
|
|
||||||
|
// If you're unsure about what any of the config keys below do, please check the config/defaults.config.php for detailed
|
||||||
|
// documentation of their data type and behavior.
|
||||||
|
|
||||||
|
return [
|
||||||
|
'database' => [
|
||||||
|
'hostname' => '{{$dbhost}}',
|
||||||
|
'username' => '{{$dbuser}}',
|
||||||
|
'password' => '{{$dbpass}}',
|
||||||
|
'database' => '{{$dbdata}}',
|
||||||
|
'charset' => 'utf8mb4',
|
||||||
|
],
|
||||||
|
|
||||||
|
// ****************************************************************
|
||||||
|
// The configuration below will be overruled by the admin panel.
|
||||||
|
// Changes made below will only have an effect if the database does
|
||||||
|
// not contain any configuration for the friendica system.
|
||||||
|
// ****************************************************************
|
||||||
|
|
||||||
|
'config' => [
|
||||||
|
'php_path' => '{{$phpath}}',
|
||||||
|
'admin_email' => '{{$adminmail}}',
|
||||||
|
'sitename' => 'Friendica Social Network',
|
||||||
|
'register_policy' => 'REGISTER_OPEN',
|
||||||
|
'max_import_size' => 200000,
|
||||||
|
],
|
||||||
|
'system' => [
|
||||||
|
'urlpath' => '{{$urlpath}}',
|
||||||
|
'default_timezone' => '{{$timezone}}',
|
||||||
|
'language' => '{{$language}}',
|
||||||
|
],
|
||||||
|
];
|
Loading…
Reference in a new issue