- last update
over 1 year ago Patch Failed to Apply - last update
over 1 year ago Patch Failed to Apply - π¦πΊAustralia purencool
The attached patch serves as a proof of concept to extend the functionality of the installer's SiteConfigureForm.php class. It enables the site installer to easily add domains to the trusted_host_patterns found in the settings.php file. The idea came from comment #22 which is mentioned below.
Advanced solution
Let the installer show a form element, where a user can define which hosts should be trusted.
This should be pre-filled with the host from the current request.
It could be a textarea, where each line is a host.
Initially, this will not use regular expressions, but the plain host as-is. So it would say "example.com", not "^example\.com$".There could be a checkbox or something to switch this to regular expression mode.
But maybe this is not even needed. People who need those could do it in settings.php directly.Add a description / help text, explaining that this will be converted into a regular expression in the settings.php, allowing to add additional trusted hosts later.
Initial Criteria
In order to ensure a developer-friendly experience while maintaining usability for first-time Drupal installation, I have compiled the following criteria for consideration:
- The installation input text area is not required.
- Multiple trusted host patterns could be added on install.
- Some initial testing to see if the domain is relevant.
- Allow domains like localhost could be added.
- Noncomplex patterns can be added see these examples β .
- Automate characters like ^,$,/.
Current solution
The installation screen
Results in the settings.php
$settings['trusted_host_patterns'] = array ( 0 => '^localhost$', 1 => '^testing\\.domain\\.com$', 2 => '^domain\\.com$', );
Know Issues
I'm currently experiencing difficulty in finding a solution to prevent two "\\" from being written into the settings.php in the trusted_host_patterns array. It appears that the SettingsEditor::rewrite applies a regular expression and adds an another forward slash. However, it is not clear to me how this happens.
https://git.drupalcode.org/project/drupal/-/blob/11.x/core/lib/Drupal/Co...SettingsEditor::rewrite($settings_path, $settings);
The second main issue relates to the permission settings of the settings.php file. During the installation process, the code requires write permissions to be granted. However, it is necessary to overwrite the existing permissions using PHP and then reset them again so that the trusted_host_patterns array can write to the file. I can't seem to find another solution to resolve this without changing the permissions and don't know if it's good practice.
$settings_path = $this->sitePath . '/settings.php'; chmod($settings_path, 0744); SettingsEditor::rewrite($settings_path, $settings); chmod($settings_path, 0444);
- last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - π¦πΊAustralia purencool
The bot didn't recognize "recognise" in the translation strings.
- last update
over 1 year ago 30,136 pass - last update
over 1 year ago 30,136 pass - last update
over 1 year ago 30,136 pass - last update
over 1 year ago 30,136 pass - last update
over 1 year ago 30,136 pass 48:37 45:38 Running- last update
over 1 year ago 30,124 pass, 2 fail - last update
over 1 year ago 30,136 pass 52:03 48:27 Running