-
Notifications
You must be signed in to change notification settings - Fork 21
Refactor: Change docroot to public to align with Symfony's best practice structure #101
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
base: 7.x
Are you sure you want to change the base?
Conversation
|
cc @mautic/education-team-leaders for when you've made the 6.x branch - let us know :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no issues from the code change perspecitve. Will this work for people upgrading from Mautic 5?
|
I guess we would have to do some magic in the upgrade process to move/rename the folder, and/or make it very clear about it being a breaking change? I don't know why it was called docroot in the first place, but I suspect it's because the whole composer process took a lot of inspiration from Drupal's implementation, which I believe uses docroot. |
|
I don’t see any reason why it wouldn’t work for users upgrading from Mautic 5. Users upgrading from Mautic 5 have two choices:
When a user upgrading from Mautic 5 replaces the entire composer.json file with the newer version, the web root will change from |
|
I could add a Composer script that updates the web root from |
|
That would be helpful. Is the docroot present also in |
|
Config parameters containing <?php
$parameters = array(
// ...
'upload_dir' => '/var/www/vhosts/test.example.com/docroot/media/files',
// ...
'form_upload_dir' => '/var/www/vhosts/test.example.com/docroot/media/files/form',
// ...
'contact_export_dir' => '/var/www/vhosts/test.example.com/docroot/media/files/temp',
// ...
'report_temp_dir' => '/var/www/vhosts/test.example.com/docroot/media/files/temp',
// ...
); |
3155248 to
37f1637
Compare
|
Is this OK to go now @escopecz from your side? |
|
Since M6 has already been released, I think it's better to rebase this PR onto 7.x and update the README.md file accordingly. |
|
Yes, I think that'd be a sensible approach as it'd be a breaking change, right? |
composer script for migrating web root Update README.md
|
I would like to get this PR merged, but I've started to think that the current solution isn't ideal. The escaped PHP code is hard to read and maintain (and I'm sure @escopecz doesn't like it either). To address this, I've created a Composer plugin instead, which is more readable and maintainable. At the moment the repository is under my GitHub account, but I can transfer it to the Mautic org and let Ruth set up the Packagist package. The plugin works in the same way as the Mautic scaffold Composer plugin. We would just need to add it to the @escopecz, do you prefer this approach? If so, can we move forward with it? https://github.com/matbcvo/mautic-migrate-webroot Testing steps: # Create test folder
mkdir test-webroot-migration
# Move into test folder
cd test-webroot-migration
# Download composer.json from mautic/recommended-project 7.x branch
wget https://raw.githubusercontent.com/mautic/recommended-project/refs/heads/7.x/composer.json
# Install the plugin
composer require matbcvo/mautic-migrate-webroot
# Check that the command is available
composer list
# Run the command
composer mautic:migrate-webroot
# Verify that:
# - composer.json has been patched (compare with composer.json.backup)
diff composer.json composer.json.backup
# - webroot has been renamed from docroot/ to public/
ls -al
|
|
Much better than debugging PHP in a JSON file. I'm thinking the new repo and composer package is quite an overhead. Could it be part of Mautic itself? Or even could it be a Doctrine migration? Similar to what we did when we were moving the local.php file? |
|
I'm not sure a Doctrine migration is the right fit here. I see this as an optional step: new installations would default to Since this only applies when Mautic is installed via Composer ( |
|
I'd like to avoid adding a dependency just to rename a folder. So perhaps a Mautic command then? That would check the name in the json file of this repo and if that's not right rename the folder? Do we even want to support multiple dir names? I think that if we want to rename in this project then everyone should follow. Because otherwise a year from now someone will make some change and won't test with the original folder name and users will get issues. TBH I'm not sure if it would be simpler to change the doc instead of this configuration. It seems it is way more complicated than useful. Or am I missing some good reason for the renaming? |

This PR updates the project structure to align with Symfony's best practices by renaming the
docrootdirectory topublic. This change ensures consistency with Symfony's default directory structure, as outlined in the Symfony Best Practices documentation.Fixes #6
Changes
composer.jsonto referencepublicinstead ofdocroot.README.mdto replace all references todocrootwithpublic.A PR needs to be created in the
mautic/user-documentationrepository to update the Composer installation steps related to the web root for the 6.x version.