Issue #2342925 by tim.plunkett: Simplify url() in order for the installer to function without it.
parent
9b16aeb57b
commit
5baf8db0d3
|
@ -642,21 +642,7 @@ function _format_date_callback(array $matches = NULL, $new_langcode = NULL) {
|
||||||
* @see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromPath().
|
* @see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromPath().
|
||||||
*/
|
*/
|
||||||
function url($path = NULL, array $options = array()) {
|
function url($path = NULL, array $options = array()) {
|
||||||
$generator = \Drupal::urlGenerator();
|
return \Drupal::urlGenerator()->generateFromPath($path, $options);
|
||||||
try {
|
|
||||||
$url = $generator->generateFromPath($path, $options);
|
|
||||||
}
|
|
||||||
catch (GeneratorNotInitializedException $e) {
|
|
||||||
// Fallback to using globals.
|
|
||||||
// @todo Remove this once there is no code that calls url() when there is
|
|
||||||
// no request.
|
|
||||||
global $base_url, $base_path, $script_path;
|
|
||||||
$generator->setBasePath($base_path);
|
|
||||||
$generator->setBaseUrl($base_url . '/');
|
|
||||||
$generator->setScriptPath($script_path);
|
|
||||||
$url = $generator->generateFromPath($path, $options);
|
|
||||||
}
|
|
||||||
return $url;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -886,6 +886,9 @@ function install_display_output($output, $install_state) {
|
||||||
// reached in case of an early installer error.
|
// reached in case of an early installer error.
|
||||||
drupal_maintenance_theme();
|
drupal_maintenance_theme();
|
||||||
|
|
||||||
|
// Ensure the URL generator is initialized.
|
||||||
|
\Drupal::urlGenerator()->updateFromRequest();
|
||||||
|
|
||||||
drupal_page_header();
|
drupal_page_header();
|
||||||
|
|
||||||
// Prevent install.php from being indexed when installed in a sub folder.
|
// Prevent install.php from being indexed when installed in a sub folder.
|
||||||
|
|
|
@ -22,6 +22,16 @@ class NullGenerator extends UrlGenerator {
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function updateFromRequest() {
|
||||||
|
global $base_url, $base_path, $script_path;
|
||||||
|
$this->basePath = $base_path;
|
||||||
|
$this->baseUrl = $base_url . '/';
|
||||||
|
$this->scriptPath = $script_path;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue