Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app/config/local.php gets removed by composer update #3

Closed
dennisameling opened this issue Jan 29, 2023 · 1 comment
Closed

app/config/local.php gets removed by composer update #3

dennisameling opened this issue Jan 29, 2023 · 1 comment

Comments

@dennisameling
Copy link
Member

Consider a Mautic installation created as follows:

composer create-project mautic/recommended-project:^4 some-dir --no-interaction

In the root directory, I have a .gitignore which is the default but with the following lines added:

/docroot/app/*
/docroot/plugins/*
/docroot/themes/*

This is based on this recommendation to not check those files into Git (as I haven't modified them):

The Mautic Composer Scaffold plugin can download the scaffold files (like index.php, .htaccess, …) to the docroot/ directory of your project. If you have not customized those files you could choose to not check them into your version control system (e.g. git)

This is problematic when updating Mautic to the latest version (composer update). It removes /docroot/app/config/local.php.

Before composer update, the local.php file in the folder tree below:

After running composer update to update Mautic, the file is gone:

I fixed it by storing local.php in config/local.php (in the root of my Mautic installation) and pointing Mautic to that file through paths_local.php as follows:

 "extra": {
    "mautic-scaffold": {
      "locations": {
        "web-root": "docroot/",
      },
      "file-mapping": {
        "[web-root]/app/config/paths_local.php": "scaffold-files/paths_local.php"
      }
    },

The contents of scaffold-files/paths_local.php are as follows:

<?php

$paths['local_config'] = '%kernel.root_dir%/../../config/local.php';

This basically means that I can just store local.php in the config folder in the root directory of my Mautic instance.

Just wanted to report this here in case someone is running into the same issue. Curious to hear from others whether they have a better approach to this 👍🏼

@dennisameling dennisameling changed the title app/config/local.php gets removed by composer mautic:scaffold app/config/local.php gets removed by composer update Jan 29, 2023
@dennisameling
Copy link
Member Author

The mautic/recommended-project repo seems to be a better place for this. Let's create an issue there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant