Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Installer\Exception\AlreadyInstalledException.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Installer\Exception;
|
||||
|
||||
use Drupal\Core\StringTranslation\TranslationInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Installer\Exception\InstallerException.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Installer\Exception;
|
||||
|
||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Installer\Exception\NoProfilesException.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Installer\Exception;
|
||||
|
||||
use Drupal\Core\StringTranslation\TranslationInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Installer\Form\SelectLanguageForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Installer\Form;
|
||||
|
||||
use Drupal\Component\Utility\UserAgent;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Installer\Form\SelectProfileForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Installer\Form;
|
||||
|
||||
use Drupal\Core\Form\FormBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Installer\Form\SiteConfigureForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Installer\Form;
|
||||
|
||||
use Drupal\Core\Extension\ModuleInstallerInterface;
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Installer\Form\SiteSettingsForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Installer\Form;
|
||||
|
||||
use Drupal\Component\Utility\Crypt;
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\Core\Form\FormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Render\RendererInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
|
@ -25,14 +21,22 @@ class SiteSettingsForm extends FormBase {
|
|||
*/
|
||||
protected $sitePath;
|
||||
|
||||
/**
|
||||
* The renderer.
|
||||
*
|
||||
* @var \Drupal\Core\Render\RendererInterface
|
||||
*/
|
||||
protected $renderer;
|
||||
|
||||
/**
|
||||
* Constructs a new SiteSettingsForm.
|
||||
*
|
||||
* @param string $site_path
|
||||
* The site path.
|
||||
*/
|
||||
public function __construct($site_path) {
|
||||
public function __construct($site_path, RendererInterface $renderer) {
|
||||
$this->sitePath = $site_path;
|
||||
$this->renderer = $renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,7 +44,8 @@ class SiteSettingsForm extends FormBase {
|
|||
*/
|
||||
public static function create(ContainerInterface $container) {
|
||||
return new static(
|
||||
$container->get('site.path')
|
||||
$container->get('site.path'),
|
||||
$container->get('renderer')
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -153,12 +158,54 @@ class SiteSettingsForm extends FormBase {
|
|||
$database['driver'] = $driver;
|
||||
|
||||
$form_state->set('database', $database);
|
||||
$errors = install_database_errors($database, $form_state->getValue('settings_file'));
|
||||
foreach ($errors as $name => $message) {
|
||||
foreach ($this->getDatabaseErrors($database, $form_state->getValue('settings_file')) as $name => $message) {
|
||||
$form_state->setErrorByName($name, $message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get any database errors and links them to a form element.
|
||||
*
|
||||
* @param array $database
|
||||
* An array of database settings.
|
||||
* @param string $settings_file
|
||||
* The settings file that contains the database settings.
|
||||
*
|
||||
* @return array
|
||||
* An array of form errors keyed by the element name and parents.
|
||||
*/
|
||||
protected function getDatabaseErrors(array $database, $settings_file) {
|
||||
$errors = install_database_errors($database, $settings_file);
|
||||
$form_errors = array_filter($errors, function($value) {
|
||||
// Errors keyed by something other than an integer already are linked to
|
||||
// form elements.
|
||||
return is_int($value);
|
||||
});
|
||||
|
||||
// Find the generic errors.
|
||||
$errors = array_diff_key($errors, $form_errors);
|
||||
|
||||
if (count($errors)) {
|
||||
$error_message = [
|
||||
'#type' => 'inline_template',
|
||||
'#template' => '{% trans %}Resolve all issues below to continue the installation. For help configuring your database server, see the <a href="https://www.drupal.org/getting-started/install">installation handbook</a>, or contact your hosting provider.{% endtrans%}{{ errors }}',
|
||||
'#context' => [
|
||||
'errors' => [
|
||||
'#theme' => 'item_list',
|
||||
'#items' => $errors,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// These are generic errors, so we do not have any specific key of the
|
||||
// database connection array to attach them to; therefore, we just put
|
||||
// them in the error array with standard numeric keys.
|
||||
$form_errors[$database['driver'] . '][0'] = $this->renderer->renderPlain($error_message);
|
||||
}
|
||||
|
||||
return $form_errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Installer\InstallerKernel.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Installer;
|
||||
|
||||
use Drupal\Core\DrupalKernel;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Installer\InstallerRouteBuilder.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Installer;
|
||||
|
||||
use Drupal\Core\Routing\RouteBuilder;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Installer\InstallerServiceProvider.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Installer;
|
||||
|
||||
use Drupal\Core\DependencyInjection\ContainerBuilder;
|
||||
|
|
Reference in a new issue