updated core to 8.6.1 via composer

This commit is contained in:
2018-09-12 13:58:26 +02:00
parent a9a219f2ed
commit ea56b9fba3
4443 changed files with 112098 additions and 40708 deletions
@@ -18,6 +18,11 @@ class ConfigSubscriber extends ConfigImportValidateEventSubscriberBase {
* The config import event.
*/
public function onConfigImporterValidate(ConfigImporterEvent $event) {
// Make sure config syncs performed via the Config UI don't break, but
// don't worry about syncs initiated via the command line.
if (PHP_SAPI === 'cli') {
return;
}
$importer = $event->getConfigImporter();
$core_extension = $importer->getStorageComparer()->getSourceStorage()->read('core.extension');
if (!isset($core_extension['module']['config'])) {
@@ -55,7 +55,7 @@ class ConfigImportForm extends FormBase {
$directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY);
$directory_is_writable = is_writable($directory);
if (!$directory_is_writable) {
drupal_set_message($this->t('The directory %directory is not writable.', ['%directory' => $directory]), 'error');
$this->messenger()->addError($this->t('The directory %directory is not writable.', ['%directory' => $directory]));
}
$form['import_tarball'] = [
'#type' => 'file',
@@ -100,11 +100,11 @@ class ConfigImportForm extends FormBase {
$files[] = $file['filename'];
}
$archiver->extractList($files, config_get_config_directory(CONFIG_SYNC_DIRECTORY));
drupal_set_message($this->t('Your configuration files were successfully uploaded and are ready for import.'));
$this->messenger()->addStatus($this->t('Your configuration files were successfully uploaded and are ready for import.'));
$form_state->setRedirect('config.sync');
}
catch (\Exception $e) {
drupal_set_message($this->t('Could not extract the contents of the tar file. The error message is <em>@message</em>', ['@message' => $e->getMessage()]), 'error');
$this->messenger()->addError($this->t('Could not extract the contents of the tar file. The error message is <em>@message</em>', ['@message' => $e->getMessage()]));
}
drupal_unlink($path);
}
@@ -62,7 +62,7 @@ class ConfigSingleImportForm extends ConfirmFormBase {
/**
* The configuration manager.
*
* @var \Drupal\Core\Config\ConfigManagerInterface;
* @var \Drupal\Core\Config\ConfigManagerInterface
*/
protected $configManager;
@@ -395,7 +395,7 @@ class ConfigSingleImportForm extends ConfirmFormBase {
/** @var \Drupal\Core\Config\ConfigImporter $config_importer */
$config_importer = $form_state->get('config_importer');
if ($config_importer->alreadyImporting()) {
drupal_set_message($this->t('Another request may be importing configuration already.'), 'error');
$this->messenger()->addError($this->t('Another request may be importing configuration already.'));
}
else {
try {
@@ -416,9 +416,9 @@ class ConfigSingleImportForm extends ConfirmFormBase {
}
catch (ConfigImporterException $e) {
// There are validation errors.
drupal_set_message($this->t('The configuration import failed for the following reasons:'), 'error');
$this->messenger()->addError($this->t('The configuration import failed for the following reasons:'));
foreach ($config_importer->getErrors() as $message) {
drupal_set_message($message, 'error');
$this->messenger()->addError($message);
}
}
}
+26 -43
View File
@@ -4,6 +4,7 @@ namespace Drupal\config\Form;
use Drupal\Core\Config\ConfigImporterException;
use Drupal\Core\Config\ConfigImporter;
use Drupal\Core\Config\Importer\ConfigImporterBatch;
use Drupal\Core\Config\TypedConfigManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Extension\ModuleInstallerInterface;
@@ -64,7 +65,7 @@ class ConfigSync extends FormBase {
/**
* The configuration manager.
*
* @var \Drupal\Core\Config\ConfigManagerInterface;
* @var \Drupal\Core\Config\ConfigManagerInterface
*/
protected $configManager;
@@ -191,7 +192,7 @@ class ConfigSync extends FormBase {
return $form;
}
elseif (!$storage_comparer->validateSiteUuid()) {
drupal_set_message($this->t('The staged configuration cannot be imported, because it originates from a different site than this site. You can only synchronize configuration between cloned instances of this site.'), 'error');
$this->messenger()->addError($this->t('The staged configuration cannot be imported, because it originates from a different site than this site. You can only synchronize configuration between cloned instances of this site.'));
$form['actions']['#access'] = FALSE;
return $form;
}
@@ -214,14 +215,14 @@ class ConfigSync extends FormBase {
sort($change_list);
$message = [
[
'#markup' => $this->t('The following items in your active configuration have changes since the last import that may be lost on the next import.')
'#markup' => $this->t('The following items in your active configuration have changes since the last import that may be lost on the next import.'),
],
[
'#theme' => 'item_list',
'#items' => $change_list,
]
],
];
drupal_set_message($this->renderer->renderPlain($message), 'warning');
$this->messenger()->addWarning($this->renderer->renderPlain($message));
}
}
@@ -295,7 +296,7 @@ class ConfigSync extends FormBase {
'class' => ['use-ajax'],
'data-dialog-type' => 'modal',
'data-dialog-options' => json_encode([
'width' => 700
'width' => 700,
]),
],
];
@@ -330,31 +331,30 @@ class ConfigSync extends FormBase {
$this->getStringTranslation()
);
if ($config_importer->alreadyImporting()) {
drupal_set_message($this->t('Another request may be synchronizing configuration already.'));
$this->messenger()->addStatus($this->t('Another request may be synchronizing configuration already.'));
}
else {
try {
$sync_steps = $config_importer->initialize();
$batch = [
'operations' => [],
'finished' => [get_class($this), 'finishBatch'],
'finished' => [ConfigImporterBatch::class, 'finish'],
'title' => t('Synchronizing configuration'),
'init_message' => t('Starting configuration synchronization.'),
'progress_message' => t('Completed step @current of @total.'),
'error_message' => t('Configuration synchronization has encountered an error.'),
'file' => __DIR__ . '/../../config.admin.inc',
];
foreach ($sync_steps as $sync_step) {
$batch['operations'][] = [[get_class($this), 'processBatch'], [$config_importer, $sync_step]];
$batch['operations'][] = [[ConfigImporterBatch::class, 'process'], [$config_importer, $sync_step]];
}
batch_set($batch);
}
catch (ConfigImporterException $e) {
// There are validation errors.
drupal_set_message($this->t('The configuration cannot be imported because it failed validation for the following reasons:'), 'error');
$this->messenger()->addError($this->t('The configuration cannot be imported because it failed validation for the following reasons:'));
foreach ($config_importer->getErrors() as $message) {
drupal_set_message($message, 'error');
$this->messenger()->addError($message);
}
}
}
@@ -369,20 +369,15 @@ class ConfigSync extends FormBase {
* The synchronization step to do.
* @param array $context
* The batch context.
*
* @deprecated in Drupal 8.6.0 and will be removed before 9.0.0. Use
* \Drupal\Core\Config\Importer\ConfigImporterBatch::process() instead.
*
* @see https://www.drupal.org/node/2897299
*/
public static function processBatch(ConfigImporter $config_importer, $sync_step, &$context) {
if (!isset($context['sandbox']['config_importer'])) {
$context['sandbox']['config_importer'] = $config_importer;
}
$config_importer = $context['sandbox']['config_importer'];
$config_importer->doSyncStep($sync_step, $context);
if ($errors = $config_importer->getErrors()) {
if (!isset($context['results']['errors'])) {
$context['results']['errors'] = [];
}
$context['results']['errors'] += $errors;
}
@trigger_error('\Drupal\config\Form\ConfigSync::processBatch() deprecated in Drupal 8.6.0 and will be removed before 9.0.0. Use \Drupal\Core\Config\Importer\ConfigImporterBatch::process() instead. See https://www.drupal.org/node/2897299');
ConfigImporterBatch::process($config_importer, $sync_step, $context);
}
/**
@@ -390,27 +385,15 @@ class ConfigSync extends FormBase {
*
* This function is a static function to avoid serializing the ConfigSync
* object unnecessarily.
*
* @deprecated in Drupal 8.6.0 and will be removed before 9.0.0. Use
* \Drupal\Core\Config\Importer\ConfigImporterBatch::finish() instead.
*
* @see https://www.drupal.org/node/2897299
*/
public static function finishBatch($success, $results, $operations) {
if ($success) {
if (!empty($results['errors'])) {
foreach ($results['errors'] as $error) {
drupal_set_message($error, 'error');
\Drupal::logger('config_sync')->error($error);
}
drupal_set_message(\Drupal::translation()->translate('The configuration was imported with errors.'), 'warning');
}
else {
drupal_set_message(\Drupal::translation()->translate('The configuration was imported successfully.'));
}
}
else {
// An error occurred.
// $operations contains the operations that remained unprocessed.
$error_operation = reset($operations);
$message = \Drupal::translation()->translate('An error occurred while processing %error_operation with arguments: @arguments', ['%error_operation' => $error_operation[0], '@arguments' => print_r($error_operation[1], TRUE)]);
drupal_set_message($message, 'error');
}
@trigger_error('\Drupal\config\Form\ConfigSync::finishBatch() deprecated in Drupal 8.6.0 and will be removed before 9.0.0. Use \Drupal\Core\Config\Importer\ConfigImporterBatch::finish() instead. See https://www.drupal.org/node/2897299');
ConfigImporterBatch::finish($success, $results, $operations);
}
}
@@ -1,96 +0,0 @@
<?php
namespace Drupal\config\Tests;
use Drupal\Core\Config\InstallStorage;
use Drupal\Core\Serialization\Yaml;
use Drupal\simpletest\InstallerTestBase;
/**
* Tests install profile config overrides can not add unmet dependencies.
*
* @group Config
*/
class ConfigInstallProfileUnmetDependenciesTest extends InstallerTestBase {
/**
* The installation profile to install.
*
* @var string
*/
protected $profile = 'testing_config_overrides';
/**
* Set to TRUE if the expected exception is thrown.
*
* @var bool
*/
protected $expectedException = FALSE;
protected function setUp() {
// Copy the testing_config_overrides install profile so we can change the
// configuration to include a dependency that can not be met. File API
// functions are not available yet.
$dest = $this->siteDirectory . '/profiles/testing_config_overrides';
mkdir($dest, 0777, TRUE);
$source = DRUPAL_ROOT . '/core/profiles/testing_config_overrides';
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $item) {
if ($item->isDir()) {
mkdir($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
}
else {
copy($item, $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
}
}
// Add a dependency that can not be met because User is installed before
// Action.
$config_file = $dest . DIRECTORY_SEPARATOR . InstallStorage::CONFIG_INSTALL_DIRECTORY . DIRECTORY_SEPARATOR . 'system.action.user_block_user_action.yml';
$action = Yaml::decode(file_get_contents($config_file));
$action['dependencies']['module'][] = 'action';
file_put_contents($config_file, Yaml::encode($action));
parent::setUp();
}
/**
* {@inheritdoc}
*
* Override the error method so we can test for the expected exception.
*/
protected function error($message = '', $group = 'Other', array $caller = NULL) {
if ($group == 'User notice') {
// Since 'User notice' is set by trigger_error() which is used for debug
// set the message to a status of 'debug'.
return $this->assert('debug', $message, 'Debug', $caller);
}
if ($group == 'Drupal\Core\Config\UnmetDependenciesException') {
$this->expectedException = TRUE;
return FALSE;
}
return $this->assert('exception', $message, $group, $caller);
}
/**
* {@inheritdoc}
*/
protected function setUpSite() {
// This step is not reached due to the exception.
}
/**
* Confirms that the installation succeeded.
*/
public function testInstalled() {
if ($this->expectedException) {
$this->pass('Expected Drupal\Core\Config\UnmetDependenciesException exception thrown');
}
else {
$this->fail('Expected Drupal\Core\Config\UnmetDependenciesException exception thrown');
}
$this->assertErrorLogged('Configuration objects provided by <em class="placeholder">user</em> have unmet dependencies: <em class="placeholder">system.action.user_block_user_action (action)</em>');
}
}