Fixing .htconfig
This commit is contained in:
parent
1acd5c7d22
commit
8c6e6b5dea
|
@ -106,8 +106,27 @@ class ConfigCacheLoader
|
||||||
$config = [];
|
$config = [];
|
||||||
|
|
||||||
if (file_exists($filePath)) {
|
if (file_exists($filePath)) {
|
||||||
|
$a = new \stdClass();
|
||||||
|
$a->config = [];
|
||||||
include $filePath;
|
include $filePath;
|
||||||
|
|
||||||
|
$htconfigAr = array_keys($a->config);
|
||||||
|
|
||||||
|
// map the legacy configuration structure to the current structure
|
||||||
|
foreach ($htconfigAr as $htconfig) {
|
||||||
|
if (isset($a->config[$htconfig]) && is_array($a->config[$htconfig])) {
|
||||||
|
$keys = array_keys($a->config[$htconfig]);
|
||||||
|
|
||||||
|
foreach ($keys as $key) {
|
||||||
|
$config[$htconfig][$key] = $a->config[$htconfig][$key];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$config['config'][$htconfig] = $a->config[$htconfig];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($a);
|
||||||
|
|
||||||
if (isset($db_host)) {
|
if (isset($db_host)) {
|
||||||
$config['database']['hostname'] = $db_host;
|
$config['database']['hostname'] = $db_host;
|
||||||
unset($db_host);
|
unset($db_host);
|
||||||
|
@ -124,8 +143,8 @@ class ConfigCacheLoader
|
||||||
$config['database']['database'] = $db_data;
|
$config['database']['database'] = $db_data;
|
||||||
unset($db_data);
|
unset($db_data);
|
||||||
}
|
}
|
||||||
if (isset($a->config['system']['db_charset'])) {
|
if (isset($config['system']['db_charset'])) {
|
||||||
$a->config['database']['charset'] = $config['system']['charset'];
|
$config['database']['charset'] = $config['system']['db_charset'];
|
||||||
}
|
}
|
||||||
if (isset($pidfile)) {
|
if (isset($pidfile)) {
|
||||||
$config['system']['pidfile'] = $pidfile;
|
$config['system']['pidfile'] = $pidfile;
|
||||||
|
@ -139,22 +158,6 @@ class ConfigCacheLoader
|
||||||
$config['system']['language'] = $lang;
|
$config['system']['language'] = $lang;
|
||||||
unset($lang);
|
unset($lang);
|
||||||
}
|
}
|
||||||
if (isset($admin_email)) {
|
|
||||||
$config['config']['admin_email'] = $admin_email;
|
|
||||||
unset($admin_email);
|
|
||||||
}
|
|
||||||
if (isset($admin_nickname)) {
|
|
||||||
$config['config']['admin_nickname'] = $admin_nickname;
|
|
||||||
unset($admin_nickname);
|
|
||||||
}
|
|
||||||
if (isset($php_path)) {
|
|
||||||
$config['config']['php_path'] = $php_path;
|
|
||||||
unset($php_path);
|
|
||||||
}
|
|
||||||
if (isset($max_import_size)) {
|
|
||||||
$config['config']['max_import_size'] = $max_import_size;
|
|
||||||
unset($max_import_size);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
|
|
|
@ -8,12 +8,56 @@ $db_user = 'testuser';
|
||||||
$db_pass = 'testpw';
|
$db_pass = 'testpw';
|
||||||
$db_data = 'testdb';
|
$db_data = 'testdb';
|
||||||
|
|
||||||
$admin_email = 'admin@friendica.local';
|
|
||||||
$admin_nickname = 'Friendly admin';
|
|
||||||
|
|
||||||
$pidfile = '/var/run/friendica.pid';
|
$pidfile = '/var/run/friendica.pid';
|
||||||
|
|
||||||
|
// Set the database connection charset to UTF8.
|
||||||
|
// Changing this value will likely corrupt the special characters.
|
||||||
|
// You have been warned.
|
||||||
|
$a->config['system']['db_charset'] = "anotherCharset";
|
||||||
|
|
||||||
|
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
|
||||||
|
// It can be changed later and only applies to timestamps for anonymous viewers.
|
||||||
$default_timezone = 'Europe/Berlin';
|
$default_timezone = 'Europe/Berlin';
|
||||||
$lang = 'fr';
|
$lang = 'fr';
|
||||||
|
|
||||||
$php_path = '/another/php';
|
// What is your site name?
|
||||||
$max_import_size = 999;
|
$a->config['sitename'] = "Friendica My Network";
|
||||||
|
|
||||||
|
// Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED.
|
||||||
|
// Be certain to create your own personal account before setting
|
||||||
|
// REGISTER_CLOSED. 'register_text' (if set) will be displayed prominently on
|
||||||
|
// the registration page. REGISTER_APPROVE requires you set 'admin_email'
|
||||||
|
// to the email address of an already registered person who can authorise
|
||||||
|
// and/or approve/deny the request.
|
||||||
|
// In order to perform system administration via the admin panel, admin_email
|
||||||
|
// must precisely match the email address of the person logged in.
|
||||||
|
$a->config['register_policy'] = REGISTER_OPEN;
|
||||||
|
$a->config['register_text'] = 'A register text';
|
||||||
|
$a->config['admin_email'] = 'admin@friendica.local';
|
||||||
|
$a->config['admin_nickname'] = 'Friendly admin';
|
||||||
|
|
||||||
|
// Maximum size of an imported message, 0 is unlimited
|
||||||
|
$a->config['max_import_size'] = 999;
|
||||||
|
|
||||||
|
// maximum size of uploaded photos
|
||||||
|
$a->config['system']['maximagesize'] = 666;
|
||||||
|
|
||||||
|
// Location of PHP command line processor
|
||||||
|
$a->config['php_path'] = '/another/php';
|
||||||
|
|
||||||
|
// PuSH - aka pubsubhubbub URL. This makes delivery of public posts as fast as private posts
|
||||||
|
$a->config['system']['huburl'] = '[internal]';
|
||||||
|
|
||||||
|
// allowed themes (change this from admin panel after installation)
|
||||||
|
$a->config['system']['allowed_themes'] = 'quattro,vier,duepuntozero';
|
||||||
|
|
||||||
|
// default system theme
|
||||||
|
$a->config['system']['theme'] = 'duepuntozero';
|
||||||
|
|
||||||
|
// By default allow pseudonyms
|
||||||
|
$a->config['system']['no_regfullname'] = true;
|
||||||
|
|
||||||
|
//Deny public access to the local directory
|
||||||
|
//$a->config['system']['block_local_dir'] = false;
|
||||||
|
// Location of the global directory
|
||||||
|
$a->config['system']['directory'] = 'http://another.url';
|
||||||
|
|
|
@ -131,6 +131,7 @@ class ConfigCacheLoaderTest extends MockedTest
|
||||||
$this->assertEquals('testuser', $configCache->get('database', 'username'));
|
$this->assertEquals('testuser', $configCache->get('database', 'username'));
|
||||||
$this->assertEquals('testpw', $configCache->get('database', 'password'));
|
$this->assertEquals('testpw', $configCache->get('database', 'password'));
|
||||||
$this->assertEquals('testdb', $configCache->get('database', 'database'));
|
$this->assertEquals('testdb', $configCache->get('database', 'database'));
|
||||||
|
$this->assertEquals('anotherCharset', $configCache->get('database', 'charset'));
|
||||||
|
|
||||||
$this->assertEquals('/var/run/friendica.pid', $configCache->get('system', 'pidfile'));
|
$this->assertEquals('/var/run/friendica.pid', $configCache->get('system', 'pidfile'));
|
||||||
$this->assertEquals('Europe/Berlin', $configCache->get('system', 'default_timezone'));
|
$this->assertEquals('Europe/Berlin', $configCache->get('system', 'default_timezone'));
|
||||||
|
@ -141,6 +142,10 @@ class ConfigCacheLoaderTest extends MockedTest
|
||||||
|
|
||||||
$this->assertEquals('/another/php', $configCache->get('config', 'php_path'));
|
$this->assertEquals('/another/php', $configCache->get('config', 'php_path'));
|
||||||
$this->assertEquals('999', $configCache->get('config', 'max_import_size'));
|
$this->assertEquals('999', $configCache->get('config', 'max_import_size'));
|
||||||
|
$this->assertEquals('666', $configCache->get('system', 'maximagesize'));
|
||||||
|
|
||||||
|
$this->assertEquals('quattro,vier,duepuntozero', $configCache->get('system', 'allowed_themes'));
|
||||||
|
$this->assertEquals('1', $configCache->get('system', 'no_regfullname'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLoadAddonConfig()
|
public function testLoadAddonConfig()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user