- Issue created by @grzegorz.bartman
- Merge request !2Resolve #3520974 "Documents change filesystem to private" → (Merged) created by k.wiktorowicz
- 🇵🇱Poland grzegorz.bartman
Suggestion: Instead of editing launch-intranet.sh, could we set the private file path in hook_install()?
Like this:
function openintranet_install() { if (!\Drupal::service('settings')->get('file_private_path')) { \Drupal::service('config.factory') ->getEditable('system.file') ->set('path.private', DRUPAL_ROOT . '/../private-files') ->save(); } }
This keeps everything Drupal-native, avoids cross-platform sed, and still lets sites override the path in settings.php.
Thanks for the suggestion — it’s a good idea to keep things Drupal-native. However, unfortunately, setting the private file path via hook_install() will not work unless it’s also defined in settings.php.
Here’s why:
- The file_private_path setting in settings.php is required for the private:// stream wrapper to be registered.
- The value in system.file config (path.private) is only respected once the stream wrapper is active, and that only happens if $settings['file_private_path'] is already defined.
- So, even if we set it via hook_install(), it won’t take effect unless the same path is also present in settings.php.
Source:
This is documented in default.settings.php:“Caches need to be cleared when this value is changed to make the private:// stream wrapper available to the system.”
Conclusion:
We still need to define the path in settings.php, or else the stream wrapper won’t exist, and the config won’t apply.- 🇵🇱Poland grzegorz.bartman
OK, please propose a solution that doesn’t rely on the launch-intranet.sh script.
That file will be removed soon - just like the old .sh script in Drupal CMS.
We want to follow the same development approach used in Drupal CMS. We could handle this similarly to how it’s done in the cms-launcher project:
https://github.com/drupal/cms-launcher/blob/main/drupal-cms.js“Create a local settings file so we can skip database set-up in the installer, which requires us to pre-generate the hash salt and the path of the config sync directory…”
The Drupal launcher stores a settings.local.php file in its repo:
https://github.com/drupal/cms-launcher/blob/main/settings.local.php
— and copies it during installation.In the drupal_cms repo, I don’t see anything equivalent yet. Recommended installation steps are listed in the README:
https://git.drupalcode.org/project/drupal_cms/-/blob/1.x/README.md
— and rely entirely on DDEV.My proposal:
Let’s add a settings.local.php file to the repo, just like in cms-launcher.
For now, we can copy it as part of launch-intranet.sh, and in the future (as we aim to remove that script), we could migrate this to a custom DDEV command.Alternative approach:
Instead of setting file_private_path automatically, we could show a status message after install, informing the user that it must be configured in settings.php for certain features to work correctly.Let me know which approach you’d prefer
- 🇵🇱Poland grzegorz.bartman
Let's add information about it in /welcome page in issue 📌 Add node /welcome - redirect user to this node after installation Active - add here section "Suggested steps after installation"
-
sebastian.langierowicz →
committed 4bba62cb on 1.x authored by
k.wiktorowicz →
Resolve #3520974 "Documents change filesystem to private"
-
sebastian.langierowicz →
committed 4bba62cb on 1.x authored by
k.wiktorowicz →