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 #33

Open
dennisameling opened this issue Jan 29, 2023 · 3 comments
Open

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

dennisameling opened this issue Jan 29, 2023 · 3 comments
Assignees

Comments

@dennisameling
Copy link
Member

dennisameling commented Jan 29, 2023

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 👍🏼


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@RCheesley
Copy link
Member

@mollux could you share your approach? Would be great if we can get this addressed!

@Moongazer
Copy link

I run into the same issue and tried to build a post-composer hook to symlink the local.php from a shared/ folder in project-root (similar to the approach which Deployer does):

project-root
  .ddev/
  packages/
  docroot/
    app/
      config/
        local.php -> ../../../shared/config/local.php
        media/ -> ../../../shared/media/
  shared/
    media/
    config/
      local.php

But because of lacking Composer insights, I was not able yet to bring this setup to life.

It would be great if this issue would be addressed in a generic/recommended way for every Mautic project-setup using composer.

@mollux
Copy link
Collaborator

mollux commented Jan 18, 2024

@dennisameling @Moongazer in Mautic 5 this was addressed by splitting up application and local config (see mautic/mautic#11561 for more details).

So in M5, when running composer commands, the ./config folder is not changed by default.

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

4 participants