config changes. Added application/Espo/Core/defaults/systemConfig.php which merges with data/config.php
This commit is contained in:
@@ -32,6 +32,8 @@ class Config
|
||||
*/
|
||||
private $defaultConfigPath = 'application/Espo/Core/defaults/config.php';
|
||||
|
||||
private $systemConfigPath = 'application/Espo/Core/defaults/systemConfig.php';
|
||||
|
||||
protected $configPath = 'data/config.php';
|
||||
|
||||
private $cacheTimestamp = 'cacheTimestamp';
|
||||
@@ -153,6 +155,9 @@ class Config
|
||||
|
||||
$this->configData = $this->getFileManager()->getContents($configPath);
|
||||
|
||||
$systemConfig = $this->getFileManager()->getContents($this->systemConfigPath);
|
||||
$this->configData = Util::merge($systemConfig, $this->configData);
|
||||
|
||||
return $this->configData;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,18 +71,6 @@ return array (
|
||||
'isRotate' => true, /** rotate log files every day */
|
||||
'maxRotateFiles' => 30, /** max number of rotate files */
|
||||
),
|
||||
'defaultPermissions' =>
|
||||
array (
|
||||
'dir' => '0775',
|
||||
'file' => '0664',
|
||||
'user' => '',
|
||||
'group' => '',
|
||||
),
|
||||
'cron' => array(
|
||||
'maxJobNumber' => 15, /** Max number of jobs per one execution */
|
||||
'jobPeriod' => 7800, /** Period for jobs, ex. if cron executed at 15:35, it will execute all pending jobs for times from 14:05 to 15:35 */
|
||||
'minExecutionTime' => 50, /** to avoid too frequency execution **/
|
||||
),
|
||||
'globalSearchEntityList' =>
|
||||
array (
|
||||
0 => 'Account',
|
||||
@@ -93,46 +81,6 @@ return array (
|
||||
),
|
||||
"tabList" => array("Account", "Contact", "Lead", "Opportunity", "Calendar", "Meeting", "Call", "Task", "Case", "Prospect", "Email"),
|
||||
"quickCreateList" => array("Account", "Contact", "Lead", "Opportunity", "Meeting", "Call", "Task", "Case", "Prospect"),
|
||||
'crud' => array(
|
||||
'get' => 'read',
|
||||
'post' => 'create',
|
||||
'put' => 'update',
|
||||
'patch' => 'patch',
|
||||
'delete' => 'delete',
|
||||
),
|
||||
'systemUser' => array(
|
||||
'id' => 'system',
|
||||
'userName' => 'system',
|
||||
'firstName' => '',
|
||||
'lastName' => 'System',
|
||||
),
|
||||
'systemItems' =>
|
||||
array (
|
||||
'systemItems',
|
||||
'adminItems',
|
||||
'configPath',
|
||||
'cachePath',
|
||||
'database',
|
||||
'crud',
|
||||
'logger',
|
||||
'isInstalled',
|
||||
'defaultPermissions',
|
||||
'systemUser',
|
||||
),
|
||||
'adminItems' =>
|
||||
array (
|
||||
'devMode',
|
||||
'outboundEmailIsShared',
|
||||
'outboundEmailFromName',
|
||||
'outboundEmailFromAddress',
|
||||
'smtpServer',
|
||||
'smtpPort',
|
||||
'smtpAuth',
|
||||
'smtpSecurity',
|
||||
'smtpUsername',
|
||||
'smtpPassword',
|
||||
'cron',
|
||||
),
|
||||
'isInstalled' => false,
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
|
||||
return array (
|
||||
'defaultPermissions' =>
|
||||
array (
|
||||
'dir' => '0775',
|
||||
'file' => '0664',
|
||||
'user' => '',
|
||||
'group' => '',
|
||||
),
|
||||
'cron' => array(
|
||||
'maxJobNumber' => 15, /** Max number of jobs per one execution */
|
||||
'jobPeriod' => 7800, /** Period for jobs, ex. if cron executed at 15:35, it will execute all pending jobs for times from 14:05 to 15:35 */
|
||||
'minExecutionTime' => 50, /** to avoid too frequency execution **/
|
||||
),
|
||||
'crud' => array(
|
||||
'get' => 'read',
|
||||
'post' => 'create',
|
||||
'put' => 'update',
|
||||
'patch' => 'patch',
|
||||
'delete' => 'delete',
|
||||
),
|
||||
'systemUser' => array(
|
||||
'id' => 'system',
|
||||
'userName' => 'system',
|
||||
'firstName' => '',
|
||||
'lastName' => 'System',
|
||||
),
|
||||
'systemItems' =>
|
||||
array (
|
||||
'systemItems',
|
||||
'adminItems',
|
||||
'configPath',
|
||||
'cachePath',
|
||||
'database',
|
||||
'crud',
|
||||
'logger',
|
||||
'isInstalled',
|
||||
'defaultPermissions',
|
||||
'systemUser',
|
||||
),
|
||||
'adminItems' =>
|
||||
array (
|
||||
'devMode',
|
||||
'outboundEmailIsShared',
|
||||
'outboundEmailFromName',
|
||||
'outboundEmailFromAddress',
|
||||
'smtpServer',
|
||||
'smtpPort',
|
||||
'smtpAuth',
|
||||
'smtpSecurity',
|
||||
'smtpUsername',
|
||||
'smtpPassword',
|
||||
'cron',
|
||||
),
|
||||
'isInstalled' => false,
|
||||
);
|
||||
|
||||
@@ -13,6 +13,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected $configPath = 'tests/testData/Utils/Config/config.php';
|
||||
|
||||
protected $systemConfigPath = 'tests/testData/Utils/Config/systemConfig.php';
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->objects['fileManager'] = new \Espo\Core\Utils\File\Manager();
|
||||
@@ -20,7 +22,9 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
|
||||
$this->object = new \Espo\Core\Utils\Config($this->objects['fileManager']);
|
||||
|
||||
$this->reflection = new ReflectionHelper($this->object);
|
||||
|
||||
$this->reflection->setProperty('configPath', $this->configPath);
|
||||
$this->reflection->setProperty('systemConfigPath', $this->systemConfigPath);
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
@@ -29,14 +33,14 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
|
||||
function testLoadConfig()
|
||||
public function testLoadConfig()
|
||||
{
|
||||
$this->assertArrayHasKey('database', $this->reflection->invokeMethod('loadConfig', array()));
|
||||
|
||||
$this->assertArrayHasKey('dateFormat', $this->reflection->invokeMethod('loadConfig', array()));
|
||||
}
|
||||
|
||||
function testGet()
|
||||
public function testGet()
|
||||
{
|
||||
$result = array(
|
||||
'driver' => 'pdo_mysql',
|
||||
@@ -58,7 +62,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
|
||||
function testSet()
|
||||
public function testSet()
|
||||
{
|
||||
$setKey= 'testOption';
|
||||
$setValue= 'Test';
|
||||
@@ -69,7 +73,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertTrue($this->object->set($setKey, 'Another Wrong Value'));
|
||||
}
|
||||
|
||||
function testSetArray()
|
||||
public function testSetArray()
|
||||
{
|
||||
$values = array(
|
||||
'testOption' => 'Test',
|
||||
@@ -86,4 +90,16 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertTrue($this->object->set($wrongArray));
|
||||
}
|
||||
|
||||
public function testSystemConfigMerge()
|
||||
{
|
||||
$configDataWithoutSystem = $this->objects['fileManager']->getContents($this->configPath);
|
||||
$this->assertArrayNotHasKey('systemItems', $configDataWithoutSystem);
|
||||
$this->assertArrayNotHasKey('adminItems', $configDataWithoutSystem);
|
||||
|
||||
$configData = $this->reflection->invokeMethod('loadConfig', array());
|
||||
|
||||
$this->assertArrayHasKey('systemItems', $configData);
|
||||
$this->assertArrayHasKey('adminItems', $configData);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -116,35 +116,8 @@ return array (
|
||||
'firstName' => '',
|
||||
'lastName' => 'System',
|
||||
),
|
||||
'systemItems' =>
|
||||
array (
|
||||
0 => 'systemItems',
|
||||
1 => 'adminItems',
|
||||
2 => 'configPath',
|
||||
3 => 'cachePath',
|
||||
4 => 'database',
|
||||
5 => 'crud',
|
||||
6 => 'logger',
|
||||
7 => 'isInstalled',
|
||||
8 => 'defaultPermissions',
|
||||
9 => 'systemUser',
|
||||
),
|
||||
'adminItems' =>
|
||||
array (
|
||||
0 => 'devMode',
|
||||
1 => 'outboundEmailIsShared',
|
||||
2 => 'outboundEmailFromName',
|
||||
3 => 'outboundEmailFromAddress',
|
||||
4 => 'smtpServer',
|
||||
5 => 'smtpPort',
|
||||
6 => 'smtpAuth',
|
||||
7 => 'smtpSecurity',
|
||||
8 => 'smtpUsername',
|
||||
9 => 'smtpPassword',
|
||||
10 => 'cron',
|
||||
),
|
||||
'isInstalled' => true,
|
||||
'cacheTimestamp' => 1400160414,
|
||||
'cacheTimestamp' => 1401873639,
|
||||
'testOption' => 'Another Wrong Value',
|
||||
'testOption2' => 'Test2',
|
||||
);
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
|
||||
return array (
|
||||
'defaultPermissions' =>
|
||||
array (
|
||||
'dir' => '0775',
|
||||
'file' => '0664',
|
||||
'user' => '',
|
||||
'group' => '',
|
||||
),
|
||||
'cron' => array(
|
||||
'maxJobNumber' => 15, /** Max number of jobs per one execution */
|
||||
'jobPeriod' => 7800, /** Period for jobs, ex. if cron executed at 15:35, it will execute all pending jobs for times from 14:05 to 15:35 */
|
||||
'minExecutionTime' => 50, /** to avoid too frequency execution **/
|
||||
),
|
||||
'crud' => array(
|
||||
'get' => 'read',
|
||||
'post' => 'create',
|
||||
'put' => 'update',
|
||||
'patch' => 'patch',
|
||||
'delete' => 'delete',
|
||||
),
|
||||
'systemUser' => array(
|
||||
'id' => 'system',
|
||||
'userName' => 'system',
|
||||
'firstName' => '',
|
||||
'lastName' => 'System',
|
||||
),
|
||||
'systemItems' =>
|
||||
array (
|
||||
'systemItems',
|
||||
'adminItems',
|
||||
'configPath',
|
||||
'cachePath',
|
||||
'database',
|
||||
'crud',
|
||||
'logger',
|
||||
'isInstalled',
|
||||
'defaultPermissions',
|
||||
'systemUser',
|
||||
),
|
||||
'adminItems' =>
|
||||
array (
|
||||
'devMode',
|
||||
'outboundEmailIsShared',
|
||||
'outboundEmailFromName',
|
||||
'outboundEmailFromAddress',
|
||||
'smtpServer',
|
||||
'smtpPort',
|
||||
'smtpAuth',
|
||||
'smtpSecurity',
|
||||
'smtpUsername',
|
||||
'smtpPassword',
|
||||
'cron',
|
||||
),
|
||||
'isInstalled' => false,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user