Ideally your git repository only contains code that you and your team wrote yourself by hand.
- 3rd party code should be included via a dependency manager (like composer)
- Generated files (like compiled stylesheets) should be excluded and be regenerated whenever needed (for example when you deploy your code to a server).
PackageStates.php contains the information which TYPO3 extensions are available and loaded in the system and is typically generated when you use the extension manager to (un)install extensions.
In the past we ran into problems when we locally used extensions which we didn't use in production (via composer's require-dev
). You always end up having a changed PackageStates.php file lying around which you have to care about not comitting it.
1. List all system extensions you need in your project's root composer.json
. You can look up the package keys in the PackageStates.php file.
{
"require": {
"typo3/cms": "7.6.*",
"helhum/typo3-console": "3.*",
// ...
"typo3/cms-core": "*",
"typo3/cms-extbase": "*",
"typo3/cms-fluid": "*",
"typo3/cms-info": "*",
"typo3/cms-info-pagetsconfig": "*",
"typo3/cms-extensionmanager": "*",
"typo3/cms-lang": "*",
"typo3/cms-setup": "*",
"typo3/cms-rtehtmlarea": "*",
"typo3/cms-taskcenter": "*",
"typo3/cms-sys-action": "*",
"typo3/cms-backend": "*",
"typo3/cms-belog": "*",
"typo3/cms-beuser": "*",
"typo3/cms-cshmanual": "*",
"typo3/cms-filelist": "*",
"typo3/cms-fluid-styled-content": "*",
"typo3/cms-frontend": "*",
"typo3/cms-indexed-search": "*",
"typo3/cms-install": "*",
"typo3/cms-lowlevel": "*",
"typo3/cms-recordlist": "*",
"typo3/cms-saltedpasswords": "*",
"typo3/cms-scheduler": "*",
"typo3/cms-sv": "*",
"typo3/cms-t3skin": "*",
"typo3/cms-tstemplate": "*",
"typo3/cms-viewpage": "*"
},
// ...
}
2. Remove the file using git rm typo3conf/PackageStates.php
and exclude it from git in your .gitignore
3. Call bin/typo3cms install:generatepackagestates
to generate the file again (locally or during deployment)
Credits:
- Helmut for creating
typo3_console
and the support. - Thomas for bringing my attention to the topic.