Closed mglaman closed 1 week ago
Might be fixed by https://github.com/mglaman/wasm-drupal/issues/97
It still doesn't work. Once a profile is it, it kicks back during "Verify requirements"
"Select an installation profile" does a POST
to /cgi/drupal/core/install.php
and ignores the existing query param ?langcode=en
in its action
So \Drupal\Core\Form\FormBuilder::buildFormAction
is not noticing the query params
// @todo Remove this parsing once these are removed from the request in
// https://www.drupal.org/node/2504709.
$parsed = UrlHelper::parse($request_uri);
unset($parsed['query'][static::AJAX_FORM_REQUEST], $parsed['query'][MainContentViewSubscriber::WRAPPER_FORMAT]);
$action = $parsed['path'] . ($parsed['query'] ? ('?' . UrlHelper::buildQuery($parsed['query'])) : '');
return UrlHelper::filterBadProtocol($action);
Not sure if php-wasm or what
With https://github.com/seanmorris/php-wasm/pull/61 I got to SiteSettingsForm
and clicked "Save and continue". But it redirected me to http://localhost/install.php?langcode=en&profile=standard&id=1&op=start
which was missing /cgi/drupal
The SiteSettingsForm
action is action="/cgi/drupal/core/install.php?langcode=en&profile=standard"
which looks correct. So it's whatever is returning the URL for the batch
Between running install_settings_form
and submitting, the URL gets broke in one of these steps:
The URL makes it look like it's going to run the batch for install_profile_modules
, but the URL is broken.
Which install_run_tasks
runs until install state parameters change. install_drupal
is its caller.
\Drupal::request()->getSession()->save();
if ($state['parameters_changed']) {
// Redirect to the correct page if the URL parameters have changed.
install_goto(install_redirect_url($state));
}
Which
function install_redirect_url($install_state) {
return 'core/install.php?' . UrlHelper::buildQuery($install_state['parameters']);
}
\install_goto
has:
global $base_url;
$headers = [
// Not a permanent redirect.
'Cache-Control' => 'no-cache',
];
$response = new RedirectResponse($base_url . '/' . $path, 302, $headers);
$response->send();
So $base_url
is borked
\Drupal\Core\DrupalKernel::initializeRequestGlobals
sets $base_url
// Create base URL.
$base_root = $request->getSchemeAndHttpHost();
$base_url = $base_root;
So the bug is that install_goto
doesn't support subpaths
I didn't read far enough into \Drupal\Core\DrupalKernel::initializeRequestGlobals
It then does
// For a request URI of '/index.php/foo', $_SERVER['SCRIPT_NAME'] is
// '/index.php', whereas $_SERVER['PHP_SELF'] is '/index.php/foo'.
if ($dir = rtrim(dirname($request->server->get('SCRIPT_NAME')), '\/')) {
This should figure out the base path, and does when Drupal is installed.
TODO hack install-site-phpcode.test.js
to run a file which debugs
$dir = rtrim(dirname($request->server->get('SCRIPT_NAME')), '\/')
var_export($dir)
<?php
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
$autoloader = require_once 'autoload.php';
$request = Request::createFromGlobals();
$kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod');
$kernel->boot();
var_export($request->server->get('SCRIPT_NAME'));
print PHP_EOL;
$dir = rtrim(dirname($request->server->get('SCRIPT_NAME')), '\/');
var_export($dir);
print PHP_EOL;
'/cgi/drupal/index.php'
'/cgi/drupal'
worked as expected
When using the interactive installer, versus automated, the install form seems to reset after selecting the language and install profile.
I'm not sure if this is due to the system requirement errors thrown (32-bit ints and missing opcache)
Looks to be caused by https://github.com/seanmorris/php-wasm/issues/60
Then moving from
install_settings_form
toinstall_profile_modules
task for the batch loses the subdirectories in$base_url