Update to Drupal 8.1.2. For more information, see https://www.drupal.org/project/drupal/releases/8.1.2
This commit is contained in:
parent
9eae24d844
commit
28556d630e
1322 changed files with 6699 additions and 2064 deletions
|
|
@ -33,4 +33,5 @@ class ConfigSubscriber extends ConfigImportValidateEventSubscriberBase {
|
|||
$events[ConfigEvents::IMPORT_VALIDATE][] = array('onConfigImporterValidate', 20);
|
||||
return $events;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,4 +160,5 @@ class ConfigController implements ContainerInjectionInterface {
|
|||
|
||||
return $build;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,13 +67,16 @@ class ConfigImportForm extends FormBase {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function validateForm(array &$form, FormStateInterface $form_state) {
|
||||
$file_upload = $this->getRequest()->files->get('files[import_tarball]', NULL, TRUE);
|
||||
if ($file_upload && $file_upload->isValid()) {
|
||||
$form_state->setValue('import_tarball', $file_upload->getRealPath());
|
||||
}
|
||||
else {
|
||||
$form_state->setErrorByName('import_tarball', $this->t('The file could not be uploaded.'));
|
||||
$all_files = $this->getRequest()->files->get('files', []);
|
||||
if (!empty($all_files['import_tarball'])) {
|
||||
$file_upload = $all_files['import_tarball'];
|
||||
if ($file_upload->isValid()) {
|
||||
$form_state->setValue('import_tarball', $file_upload->getRealPath());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$form_state->setErrorByName('import_tarball', $this->t('The file could not be uploaded.'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Drupal\config\Form;
|
||||
|
||||
use Drupal\Component\Serialization\Exception\InvalidDataTypeException;
|
||||
use Drupal\Component\Serialization\Yaml;
|
||||
use Drupal\config\StorageReplaceDataWrapper;
|
||||
use Drupal\Core\Config\ConfigImporter;
|
||||
|
|
@ -281,8 +282,13 @@ class ConfigSingleImportForm extends ConfirmFormBase {
|
|||
return;
|
||||
}
|
||||
|
||||
// Decode the submitted import.
|
||||
$data = Yaml::decode($form_state->getValue('import'));
|
||||
try {
|
||||
// Decode the submitted import.
|
||||
$data = Yaml::decode($form_state->getValue('import'));
|
||||
}
|
||||
catch (InvalidDataTypeException $e) {
|
||||
$form_state->setErrorByName('import', $this->t('The import failed with the following message: %message', ['%message' => $e->getMessage()]));
|
||||
}
|
||||
|
||||
// Validate for config entities.
|
||||
if ($form_state->getValue('config_type') !== 'system.simple') {
|
||||
|
|
@ -388,7 +394,7 @@ class ConfigSingleImportForm extends ConfirmFormBase {
|
|||
if ($config_importer->alreadyImporting()) {
|
||||
drupal_set_message($this->t('Another request may be importing configuration already.'), 'error');
|
||||
}
|
||||
else{
|
||||
else {
|
||||
try {
|
||||
$sync_steps = $config_importer->initialize();
|
||||
$batch = [
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ class ConfigSync extends FormBase {
|
|||
if ($config_importer->alreadyImporting()) {
|
||||
drupal_set_message($this->t('Another request may be synchronizing configuration already.'));
|
||||
}
|
||||
else{
|
||||
else {
|
||||
try {
|
||||
$sync_steps = $config_importer->initialize();
|
||||
$batch = array(
|
||||
|
|
@ -411,5 +411,4 @@ class ConfigSync extends FormBase {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,4 +196,5 @@ class StorageReplaceDataWrapper implements StorageInterface {
|
|||
$this->replacementData[$this->collection][$name] = $data;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,7 +195,8 @@ class ConfigEntityTest extends WebTestBase {
|
|||
try {
|
||||
$same_id->save();
|
||||
$this->fail('Not possible to overwrite an entity entity.');
|
||||
} catch (EntityStorageException $e) {
|
||||
}
|
||||
catch (EntityStorageException $e) {
|
||||
$this->pass('Not possible to overwrite an entity entity.');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ class ConfigExportImportUITest extends WebTestBase {
|
|||
// Export the configuration.
|
||||
$this->drupalPostForm('admin/config/development/configuration/full/export', array(), 'Export');
|
||||
$this->tarball = $this->getRawContent();
|
||||
$filename = file_directory_temp() .'/' . $this->randomMachineName();
|
||||
$filename = file_directory_temp() . '/' . $this->randomMachineName();
|
||||
file_put_contents($filename, $this->tarball);
|
||||
|
||||
// Set up the active storage collections to test import.
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class ConfigImportAllTest extends ModuleTestBase {
|
|||
\Drupal::service('module_installer')->install(array_keys($all_modules));
|
||||
|
||||
$this->assertModules(array_keys($all_modules), TRUE);
|
||||
foreach($all_modules as $module => $info) {
|
||||
foreach ($all_modules as $module => $info) {
|
||||
$this->assertModuleConfig($module);
|
||||
$this->assertModuleTablesExist($module);
|
||||
}
|
||||
|
|
@ -118,7 +118,7 @@ class ConfigImportAllTest extends ModuleTestBase {
|
|||
\Drupal::service('module_installer')->uninstall(array_keys($modules_to_uninstall));
|
||||
|
||||
$this->assertModules(array_keys($modules_to_uninstall), FALSE);
|
||||
foreach($modules_to_uninstall as $module => $info) {
|
||||
foreach ($modules_to_uninstall as $module => $info) {
|
||||
$this->assertNoModuleConfig($module);
|
||||
$this->assertModuleTablesDoNotExist($module);
|
||||
}
|
||||
|
|
@ -133,7 +133,7 @@ class ConfigImportAllTest extends ModuleTestBase {
|
|||
|
||||
// Check that all modules that were uninstalled are now reinstalled.
|
||||
$this->assertModules(array_keys($modules_to_uninstall), TRUE);
|
||||
foreach($modules_to_uninstall as $module => $info) {
|
||||
foreach ($modules_to_uninstall as $module => $info) {
|
||||
$this->assertModuleConfig($module);
|
||||
$this->assertModuleTablesExist($module);
|
||||
}
|
||||
|
|
@ -157,4 +157,5 @@ class ConfigImportAllTest extends ModuleTestBase {
|
|||
$this->assertConfigSchema($typed_config, $name, $config->get());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class ConfigInstallProfileOverrideTest extends WebTestBase {
|
|||
// Verify that the original data matches. We have to read the module config
|
||||
// file directly, because the install profile default system.cron.yml
|
||||
// configuration file was used to create the active configuration.
|
||||
$config_dir = drupal_get_path('module', 'system') . '/'. InstallStorage::CONFIG_INSTALL_DIRECTORY;
|
||||
$config_dir = drupal_get_path('module', 'system') . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY;
|
||||
$this->assertTrue(is_dir($config_dir));
|
||||
$source_storage = new FileStorage($config_dir);
|
||||
$data = $source_storage->read($config_name);
|
||||
|
|
|
|||
|
|
@ -187,4 +187,5 @@ class ConfigInstallWebTest extends WebTestBase {
|
|||
$this->rebuildContainer();
|
||||
$this->assertTrue(entity_load('config_test', 'other_module_test_with_dependency'), 'The config_test.dynamic.other_module_test_with_dependency configuration has been created during install.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,16 @@ class ConfigSingleImportExportTest extends WebTestBase {
|
|||
$uuid = \Drupal::service('uuid');
|
||||
|
||||
$this->drupalLogin($this->drupalCreateUser(array('import configuration')));
|
||||
|
||||
// Attempt an import with invalid YAML.
|
||||
$edit = [
|
||||
'config_type' => 'action',
|
||||
'import' => '{{{',
|
||||
];
|
||||
|
||||
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import'));
|
||||
$this->assertText('The import failed with the following message: Malformed inline YAML string ({{{) at line 1 (near "{{{")');
|
||||
|
||||
$import = <<<EOD
|
||||
label: First
|
||||
weight: 0
|
||||
|
|
|
|||
Reference in a new issue