diff --git a/.env.dist b/.env.dist index 53543f64112..b91d9d9b719 100644 --- a/.env.dist +++ b/.env.dist @@ -42,6 +42,7 @@ MAILER_DSN=null://null #ECCUBE_ADMIN_ALLOW_HOSTS=[] #ECCUBE_ADMIN_DENY_HOSTS=[] #ECCUBE_FORCE_SSL=false +#ECCUBE_PHPINFO_ENABLED=false #ECCUBE_TEMPLATE_CODE=default #ECCUBE_AUTH_MAGIC= #ECCUBE_COOKIE_NAME=eccube diff --git a/app/config/eccube/packages/eccube.yaml b/app/config/eccube/packages/eccube.yaml index 9e89a805bf2..b8303cb0ca3 100644 --- a/app/config/eccube/packages/eccube.yaml +++ b/app/config/eccube/packages/eccube.yaml @@ -7,6 +7,7 @@ parameters: env(ECCUBE_ADMIN_ALLOW_HOSTS): '[]' env(ECCUBE_ADMIN_DENY_HOSTS): '[]' env(ECCUBE_FORCE_SSL): '0' + env(ECCUBE_PHPINFO_ENABLED): '0' env(ECCUBE_TEMPLATE_CODE): 'default' env(ECCUBE_AUTH_MAGIC): '' env(ECCUBE_COOKIE_NAME): 'eccube' @@ -31,6 +32,7 @@ parameters: eccube_admin_allow_hosts: '%env(json:ECCUBE_ADMIN_ALLOW_HOSTS)%' eccube_admin_deny_hosts: '%env(json:ECCUBE_ADMIN_DENY_HOSTS)%' eccube_force_ssl: '%env(bool:ECCUBE_FORCE_SSL)%' + eccube_phpinfo_enabled: '%env(bool:ECCUBE_PHPINFO_ENABLED)%' eccube.theme: '%env(ECCUBE_TEMPLATE_CODE)%' eccube_theme_code: '%eccube.theme%' eccube_auth_magic: '%env(ECCUBE_AUTH_MAGIC)%' diff --git a/codeception/acceptance/EA08SysteminfoCest.php b/codeception/acceptance/EA08SysteminfoCest.php index 1b85f43bdac..cee43aa860f 100644 --- a/codeception/acceptance/EA08SysteminfoCest.php +++ b/codeception/acceptance/EA08SysteminfoCest.php @@ -55,8 +55,10 @@ public function systeminfo_システム情報(AcceptanceTester $I) $I->see('WEBサーバー', '#server_info_box__body_inner > div:nth-child(4) > div:first-child'); $I->see('PHP', '#server_info_box__body_inner > div:nth-child(5) > div:first-child'); $I->see('User Agent', '#server_info_box__body_inner > div:nth-child(6) > div:first-child'); - $I->see('PHP情報', '#php_info_box__header > div > span'); - + if ($config['eccube_phpinfo_enabled'] == 1) { + $I->see('PHP情報', '#php_info_box__header > div > span'); + } + $I->expect('session.save_path をチェックします'); $I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/system/phpinfo'); $I->scrollTo('a[name=module_session]'); diff --git a/docker-compose.yml b/docker-compose.yml index caa5344305b..3b81328da4b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,6 +48,7 @@ services: # ECCUBE_USER_DATA_ROUTE: "user_data" # ECCUBE_ADMIN_ALLOW_HOSTS: [] # ECCUBE_FORCE_SSL: false + # ECCUBE_PHPINFO_ENABLED=false # ECCUBE_TEMPLATE_CODE: "default" # ECCUBE_COOKIE_NAME: "eccube" # ECCUBE_COOKIE_PATH: "/" diff --git a/src/Eccube/Controller/Admin/Setting/System/SystemController.php b/src/Eccube/Controller/Admin/Setting/System/SystemController.php index e60d9a14f2d..95f03f7355d 100644 --- a/src/Eccube/Controller/Admin/Setting/System/SystemController.php +++ b/src/Eccube/Controller/Admin/Setting/System/SystemController.php @@ -13,6 +13,7 @@ namespace Eccube\Controller\Admin\Setting\System; +use Eccube\Common\EccubeConfig; use Eccube\Common\Constant; use Eccube\Service\SystemService; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; @@ -22,6 +23,11 @@ class SystemController { + /** + * @var EccubeConfig + */ + protected $eccubeConfig; + /** * @var SystemService */ @@ -30,10 +36,14 @@ class SystemController /** * SystemController constructor. * + * @param EccubeConfig $eccubeConfig * @param SystemService $systemService */ - public function __construct(SystemService $systemService) - { + public function __construct( + EccubeConfig $eccubeConfig, + SystemService $systemService + ){ + $this->eccubeConfig = $eccubeConfig; $this->systemService = $systemService; } @@ -55,6 +65,7 @@ public function index(Request $request) return [ 'info' => $info, + 'phpinfo_enabled' => $this->eccubeConfig->get('eccube_phpinfo_enabled'), ]; } diff --git a/src/Eccube/Resource/template/admin/Setting/System/system.twig b/src/Eccube/Resource/template/admin/Setting/System/system.twig index fc219215af6..a70027472f8 100644 --- a/src/Eccube/Resource/template/admin/Setting/System/system.twig +++ b/src/Eccube/Resource/template/admin/Setting/System/system.twig @@ -57,7 +57,8 @@ file that was distributed with this source code. - + + {% if phpinfo_enabled %}
@@ -76,6 +77,7 @@ file that was distributed with this source code.
+ {% endif %}