diff --git a/core/modules/config/config.admin.inc b/core/modules/config/config.admin.inc deleted file mode 100644 index 87a1463..0000000 --- a/core/modules/config/config.admin.inc +++ /dev/null @@ -1,132 +0,0 @@ - t('There are no configuration changes.'), - ); - return $form; - } - - foreach ($config_changes as $config_change_type => $config_files) { - if (empty($config_files)) { - continue; - } - $form[$config_change_type] = array( - '#type' => 'fieldset', - '#title' => $config_change_type . ' (' . count($config_files) . ')', - '#collapsible' => TRUE, - ); - $form[$config_change_type]['config_files'] = array( - '#theme' => 'table', - '#header' => array('Name'), - ); - foreach ($config_files as $config_file) { - $form[$config_change_type]['config_files']['#rows'][] = array($config_file); - } - } -} - -/** - * Form constructor for configuration import form. - * - * @see config_admin_import_form_submit() - */ -function config_admin_import_form($form, &$form_state) { - // Retrieve a list of differences between FileStorage and DatabaseStorage. - // @todo Leverage DI + config.storage.info. - $source_storage = new FileStorage(); - $target_storage = new DatabaseStorage(); - - // Prevent users from deleting all configuration. - // If the source storage is empty, that signals the unique condition of not - // having exported anything at all, and thus no valid storage to compare the - // active storage against. - // @todo StorageInterface::listAll() can easily yield hundreds or even - // thousands of entries; consider to add a dedicated isEmpty() method for - // storage controllers. - $all = $source_storage->listAll(); - if (empty($all)) { - form_set_error('', t('There is no base configuration. Export it first.', array( - '@export-url' => url('admin/config/development/sync/export'), - ))); - return $form; - } - - config_admin_sync_form($form, $form_state, $source_storage, $target_storage); - - $form['actions'] = array('#type' => 'actions'); - $form['actions']['submit'] = array( - '#type' => 'submit', - '#value' => t('Import'), - ); - return $form; -} - -/** - * Form submission handler for config_admin_import_form(). - */ -function config_admin_import_form_submit($form, &$form_state) { - if (config_import()) { - drupal_set_message(t('The configuration was imported successfully.')); - } - else { - // Another request may be synchronizing configuration already. Wait for it - // to complete before returning the error, so already synchronized changes - // do not appear again. - lock_wait(__FUNCTION__); - drupal_set_message(t('The import failed due to an error. Any errors have been logged.'), 'error'); - } -} - -/** - * Form constructor for configuration export form. - * - * @see config_admin_export_form_submit() - */ -function config_admin_export_form($form, &$form_state) { - // Retrieve a list of differences between DatabaseStorage and FileStorage. - // @todo Leverage DI + config.storage.info. - $source_storage = new DatabaseStorage(); - $target_storage = new FileStorage(); - - config_admin_sync_form($form, $form_state, $source_storage, $target_storage); - - $form['actions'] = array('#type' => 'actions'); - $form['actions']['submit'] = array( - '#type' => 'submit', - '#value' => t('Export'), - ); - return $form; -} - -/** - * Form submission handler for config_admin_export_form(). - */ -function config_admin_export_form_submit($form, &$form_state) { - config_export(); - drupal_set_message(t('The configuration was exported successfully.')); -} - diff --git a/core/modules/config/config.info b/core/modules/config/config.info index efab7a1..380f17e 100644 --- a/core/modules/config/config.info +++ b/core/modules/config/config.info @@ -3,4 +3,3 @@ description = Allows administrators to manage configuration changes. package = Core version = VERSION core = 8.x -configure = admin/config/development/sync diff --git a/core/modules/config/config.module b/core/modules/config/config.module index fd38fd2..b3d9bbc 100644 --- a/core/modules/config/config.module +++ b/core/modules/config/config.module @@ -1,46 +1 @@ t('Synchronize configuration'), - 'restrict access' => TRUE, - ); - return $permissions; -} - -/** - * Implements hook_menu(). - */ -function config_menu() { - $items['admin/config/development/sync'] = array( - 'title' => 'Synchronize configuration', - 'description' => 'Synchronize configuration changes.', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('config_admin_import_form'), - 'access arguments' => array('synchronize configuration'), - 'file' => 'config.admin.inc', - ); - $items['admin/config/development/sync/import'] = array( - 'title' => 'Import', - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, - ); - $items['admin/config/development/sync/export'] = array( - 'title' => 'Export', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('config_admin_export_form'), - 'access arguments' => array('synchronize configuration'), - 'file' => 'config.admin.inc', - 'type' => MENU_LOCAL_TASK, - ); - return $items; -} - diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php deleted file mode 100644 index cdd2704..0000000 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php +++ /dev/null @@ -1,144 +0,0 @@ - 'Import/Export UI', - 'description' => 'Tests the user interface for importing/exporting configuration.', - 'group' => 'Configuration', - ); - } - - function setUp() { - parent::setUp(array('config', 'config_test')); - - $this->web_user = $this->drupalCreateUser(array('synchronize configuration')); - $this->drupalLogin($this->web_user); - } - - /** - * Tests exporting configuration. - */ - function testExport() { - $name = 'config_test.system'; - $dynamic_name = 'config_test.dynamic.default'; - - // Verify the default configuration values exist. - $config = config($name); - $this->assertIdentical($config->get('foo'), 'bar'); - $config = config($dynamic_name); - $this->assertIdentical($config->get('id'), 'default'); - - // Verify that both appear as deleted by default. - $this->drupalGet('admin/config/development/sync/export'); - $this->assertText($name); - $this->assertText($dynamic_name); - - // Export and verify that both do not appear anymore. - $this->drupalPost(NULL, array(), t('Export')); - $this->assertUrl('admin/config/development/sync/export'); - $this->assertNoText($name); - $this->assertNoText($dynamic_name); - - // Verify that there are no further changes to export. - $this->assertText(t('There are no configuration changes.')); - - // Verify that the import screen shows no changes either. - $this->drupalGet('admin/config/development/sync'); - $this->assertText(t('There are no configuration changes.')); - } - - /** - * Tests importing configuration. - */ - function testImport() { - $name = 'config_test.new'; - $dynamic_name = 'config_test.dynamic.new'; - - // Verify the configuration to create does not exist yet. - $file_storage = new FileStorage(); - $this->assertIdentical($file_storage->exists($name), FALSE, $name . ' not found.'); - $this->assertIdentical($file_storage->exists($dynamic_name), FALSE, $dynamic_name . ' not found.'); - - // Verify that the import UI does not allow to import without exported - // configuration. - $this->drupalGet('admin/config/development/sync'); - $this->assertText('There is no base configuration.'); - - // Verify that the Export link yields to the export UI page, and export. - $this->clickLink('Export'); - $this->drupalPost(NULL, array(), t('Export')); - - // Create new configuration objects. - $file_storage->write($name, array( - 'add_me' => 'new value', - )); - $file_storage->write($dynamic_name, array( - 'id' => 'new', - 'label' => 'New', - )); - $this->assertIdentical($file_storage->exists($name), TRUE, $name . ' found.'); - $this->assertIdentical($file_storage->exists($dynamic_name), TRUE, $dynamic_name . ' found.'); - - // Verify that both appear as new. - $this->drupalGet('admin/config/development/sync'); - $this->assertText($name); - $this->assertText($dynamic_name); - - // Import and verify that both do not appear anymore. - $this->drupalPost(NULL, array(), t('Import')); - $this->assertUrl('admin/config/development/sync'); - $this->assertNoText($name); - $this->assertNoText($dynamic_name); - - // Verify that there are no further changes to import. - $this->assertText(t('There are no configuration changes.')); - - // Verify that the export screen shows no changes either. - $this->drupalGet('admin/config/development/sync/export'); - $this->assertText(t('There are no configuration changes.')); - } - - /** - * Tests concurrent importing of configuration. - */ - function testImportLock() { - $name = 'config_test.new'; - - // Write a configuration object to import. - $file_storage = new FileStorage(); - $file_storage->write($name, array( - 'add_me' => 'new value', - )); - - // Verify that there are configuration differences to import. - $this->drupalGet('admin/config/development/sync'); - $this->assertNoText(t('There are no configuration changes.')); - - // Acquire a fake-lock on the import mechanism. - $lock_name = 'config_import'; - lock_acquire($lock_name); - - // Attempt to import configuration and verify that an error message appears. - $this->drupalPost(NULL, array(), t('Import')); - $this->assertUrl('admin/config/development/sync'); - $this->assertText(t('The import failed due to an error. Any errors have been logged.')); - - // Release the lock, just to keep testing sane. - lock_release($lock_name); - } -} diff --git a/core/modules/config/tests/config_test/config/config_test.delete.yml b/core/modules/config/tests/config_test/config/config_test.delete.yml deleted file mode 100644 index b8ccb67..0000000 --- a/core/modules/config/tests/config_test/config/config_test.delete.yml +++ /dev/null @@ -1 +0,0 @@ -delete_me: bar diff --git a/profiles/standard/standard.info b/profiles/standard/standard.info index c5240dd..8b8a33b 100644 --- a/profiles/standard/standard.info +++ b/profiles/standard/standard.info @@ -6,7 +6,6 @@ dependencies[] = node dependencies[] = block dependencies[] = color dependencies[] = comment -dependencies[] = config dependencies[] = contextual dependencies[] = help dependencies[] = image