为什么SymfonyRequirements.php被排除在.gitignore之外? [英] Why is SymfonyRequirements.php excluded from .gitignore?

查看:79
本文介绍了为什么SymfonyRequirements.php被排除在.gitignore之外?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我理解正确,那么SymfonyRequirements.php文件(取决于Symfony版本位于/app/var下)将由Composer处理.因此,我认为任何版本控制系统都不应跟踪它.但是,我看到它已被排除在 Symfony标准版的.gitignore文件中:

/var/*
[...]
!var/SymfonyRequirements.php

编辑

Symfony核心开发人员@Stof在 Github问题中说:

鉴于其中一项检查是是否安装了供应商,它必须 在安装它们之前先到那里(即使我们有自动 更新需求,以便您接下来检查最新的需求 时间).

这对我来说不是很清楚.谁能提供有关此文件的更多详细信息,并解释为什么VCS应该或不应该跟踪该文件?

解决方案

该文件由 Symfony Check CLI脚本,以检查配置&的最低要求.运行Symfony应用.这是常见的部署后任务. /p>

它检查当前的PHP版本/配置(php.ini设置)和所需的PHP扩展.例如,它检查 date.timezone 的当前设置.

@stof试图说的是,甚至在使用composer install安装依赖项之前,您也应该能够运行检查.它甚至可以检查依赖项安装本身:检查是否存在vendor/composer目录中的a>.

它为您提供了良好的&有关Symfony应用程序是否具有需要基于当前PHP配置运行的足够的见识.

请注意,通过将此文件添加到VCS,您应该知道以后使用composer update更新依赖关系后,此文件可能会有更改.因此,您还应该记住也要提交此文件!.

请注意,这些检查还提供了一些需要设置的建议(非要求).例如,检查此建议:

在使用Symfony安全组件中的注销处理程序时,由于PHP错误#63379,您应该至少具有PHP 5.4.11(作为一种解决方法,您也可以在安全注销处理程序配置中将invalidate_session设置为false) >

其他一些使用Symfony的项目也通过扩展此文件来实现自己的检查,例如checkout Oro平台要求检查.

If I understand it correctly, the SymfonyRequirements.php file (which lives under /app or /var depending on Symfony version) is handled by Composer. I therefore suppose it should be not be tracked by any version control system. However, I see it is excluded from Symfony Standard Edition's .gitignore file:

/var/*
[...]
!var/SymfonyRequirements.php

Edit

Symfony core developer @Stof says in a Github issue:

given that one of the checks is whether you installed vendors, it must be there before installing them (even though we have an automatic update of the requirements so that you check the uptodate ones next time).

This is not very clear to me. Can anybody give any more details about this file and explain why it should or should not be tracked by a VCS?

解决方案

This file is used by Symfony Check CLI Script to check for minimum requirements of configuring & running a Symfony App. It's a Common Post-Deployment Task.

It checks for current PHP Version/Configurations(php.ini settings) and required PHP Extensions. For example it checks for current setting of date.timezone.

What @stof is trying to say is that you should be able to run the checks even before installing dependencies using composer install. It even checks for dependencies installation itself: checks for existence of vendor/composer directory.

It gives you a good & enough insight about whether the Symfony App has what it needs to be run based on Current PHP configuration.

Note that by adding this file to VCS, you should know there may be changes to this file after updating dependencies later using composer update. So you should remember to commit this file too!.

Please Note that these checks also provide some recommendations(not requirements) to be set. For Example check this recommendation out:

When using the logout handler from the Symfony Security Component, you should have at least PHP 5.4.11 due to PHP bug #63379 (as a workaround, you can also set invalidate_session to false in the security logout handler configuration)

Some other Projects using Symfony also implement their own checks by extending this file, For example checkout Oro Platforms Requirements Check.

这篇关于为什么SymfonyRequirements.php被排除在.gitignore之外?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆