Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to cleanly switch from composer back to the old ER2 in Contao

How to cleanly switch from composer back to the old ER2 in Contao

The information given here in the German Contao Wiki can lead to problems. If you want to cleanly switch back to the old ER2 in Contao, you need to follow these steps. But before doing so, you should note down all the extensions that you still need after switching back and you should make sure that these extensions are available in the ER2 and still compatible with your Contao version.

  1. remove all modules and assets from installed extensions (see below)
  2. go to System » Settings » Inactive extensions, check [!composer] and uncheck [repository]
  3. reinstall all needed extensions via the extension repository
  4. once you are sure that everything is working as expected, you can delete the folder /composer and /system/modules/!composer

##How to remove all installed modules and assets (and why?)

The original instructions skip this part and tell you to disable the [!composer] extension right away. This might incapacitate your Contao installation, depending on your installed extensions. By removing the [!composer] extension you also remove the vendor class loader. Some extensions use the class loader of composer instead of loading the Contao class loader. If these extensions are required to work when accessing the backend, you will get a fatal error saying that a class was not found. Thus you should disable all extensions before disabling the composer client.

For a clean switch, you should not just disable those extensions though. Otherwise there might be unused remnants from before you switched back. Also some extensions automatically install some assets into other places than /system/modules, e.g. into the /assets folder. In order to make a clean switch, you should remove those as well.

In order to remove every extension before switching back, you have two choices basically:

  • either remove all packages from the package management and then run a package update again (make sure that this was successful)
  • or if that is not an option, delete every extension and its assets manually

##Will I lose any data?

Your custom data is either stored in the database or may be some other place outside of /system/modules (e.g. your files are usually simply in your /files directory). If, during this process, you execute a database update (after deleting the extensions or while reinstalling the extensions from the extension repository) it is important that you do not drop any tables or fields!

There might be some instances where you can't reinstall the same version of an extension using the extension repository that you used before via composer (e.g. because the extension is not updated anymore in the extension repository). You might lose data in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.