comparison core/modules/config/config.module @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
3 /** 3 /**
4 * @file 4 * @file
5 * Allows site administrators to modify configuration. 5 * Allows site administrators to modify configuration.
6 */ 6 */
7 7
8 use Drupal\Core\Url;
8 use Drupal\Core\Routing\RouteMatchInterface; 9 use Drupal\Core\Routing\RouteMatchInterface;
9 10
10 /** 11 /**
11 * Implements hook_help(). 12 * Implements hook_help().
12 */ 13 */
17 $output .= '<h3>' . t('About') . '</h3>'; 18 $output .= '<h3>' . t('About') . '</h3>';
18 $output .= '<p>' . t('The Configuration Manager module provides a user interface for importing and exporting configuration changes between installations of your website in different environments. Configuration is stored in YAML format. For more information, see the <a href=":url">online documentation for the Configuration Manager module</a>.', [':url' => 'https://www.drupal.org/documentation/administer/config']) . '</p>'; 19 $output .= '<p>' . t('The Configuration Manager module provides a user interface for importing and exporting configuration changes between installations of your website in different environments. Configuration is stored in YAML format. For more information, see the <a href=":url">online documentation for the Configuration Manager module</a>.', [':url' => 'https://www.drupal.org/documentation/administer/config']) . '</p>';
19 $output .= '<h3>' . t('Uses') . '</h3>'; 20 $output .= '<h3>' . t('Uses') . '</h3>';
20 $output .= '<dl>'; 21 $output .= '<dl>';
21 $output .= '<dt>' . t('Exporting the full configuration') . '</dt>'; 22 $output .= '<dt>' . t('Exporting the full configuration') . '</dt>';
22 $output .= '<dd>' . t('You can create and download an archive consisting of all your site\'s configuration exported as <em>*.yml</em> files on the <a href=":url">Export</a> page.', [':url' => \Drupal::url('config.export_full')]) . '</dd>'; 23 $output .= '<dd>' . t('You can create and download an archive consisting of all your site\'s configuration exported as <em>*.yml</em> files on the <a href=":url">Export</a> page.', [':url' => Url::fromRoute('config.export_full')->toString()]) . '</dd>';
23 $output .= '<dt>' . t('Importing a full configuration') . '</dt>'; 24 $output .= '<dt>' . t('Importing a full configuration') . '</dt>';
24 $output .= '<dd>' . t('You can upload a full site configuration from an archive file on the <a href=":url">Import</a> page. When importing data from a different environment, the site and import files must have matching configuration values for UUID in the <em>system.site</em> configuration item. That means that your other environments should initially be set up as clones of the target site. Migrations are not supported.', [':url' => \Drupal::url('config.import_full')]) . '</dd>'; 25 $output .= '<dd>' . t('You can upload a full site configuration from an archive file on the <a href=":url">Import</a> page. When importing data from a different environment, the site and import files must have matching configuration values for UUID in the <em>system.site</em> configuration item. That means that your other environments should initially be set up as clones of the target site. Migrations are not supported.', [':url' => Url::fromRoute('config.import_full')->toString()]) . '</dd>';
25 $output .= '<dt>' . t('Synchronizing configuration') . '</dt>'; 26 $output .= '<dt>' . t('Synchronizing configuration') . '</dt>';
26 $output .= '<dd>' . t('You can review differences between the active configuration and an imported configuration archive on the <a href=":synchronize">Synchronize</a> page to ensure that the changes are as expected, before finalizing the import. The Synchronize page also shows configuration items that would be added or removed.', [':synchronize' => \Drupal::url('config.sync')]) . '</dd>'; 27 $output .= '<dd>' . t('You can review differences between the active configuration and an imported configuration archive on the <a href=":synchronize">Synchronize</a> page to ensure that the changes are as expected, before finalizing the import. The Synchronize page also shows configuration items that would be added or removed.', [':synchronize' => Url::fromRoute('config.sync')->toString()]) . '</dd>';
27 $output .= '<dt>' . t('Exporting a single configuration item') . '</dt>'; 28 $output .= '<dt>' . t('Exporting a single configuration item') . '</dt>';
28 $output .= '<dd>' . t('You can export a single configuration item by selecting a <em>Configuration type</em> and <em>Configuration name</em> on the <a href=":single-export">Single export</a> page. The configuration and its corresponding <em>*.yml file name</em> are then displayed on the page for you to copy.', [':single-export' => \Drupal::url('config.export_single')]) . '</dd>'; 29 $output .= '<dd>' . t('You can export a single configuration item by selecting a <em>Configuration type</em> and <em>Configuration name</em> on the <a href=":single-export">Single export</a> page. The configuration and its corresponding <em>*.yml file name</em> are then displayed on the page for you to copy.', [':single-export' => Url::fromRoute('config.export_single')->toString()]) . '</dd>';
29 $output .= '<dt>' . t('Importing a single configuration item') . '</dt>'; 30 $output .= '<dt>' . t('Importing a single configuration item') . '</dt>';
30 $output .= '<dd>' . t('You can import a single configuration item by pasting it in YAML format into the form on the <a href=":single-import">Single import</a> page.', [':single-import' => \Drupal::url('config.import_single')]) . '</dd>'; 31 $output .= '<dd>' . t('You can import a single configuration item by pasting it in YAML format into the form on the <a href=":single-import">Single import</a> page.', [':single-import' => Url::fromRoute('config.import_single')->toString()]) . '</dd>';
31 $output .= '</dl>'; 32 $output .= '</dl>';
32 return $output; 33 return $output;
33 34
34 case 'config.sync': 35 case 'config.sync':
35 $output = ''; 36 $output = '';
68 if (\Drupal::currentUser()->hasPermission('export configuration')) { 69 if (\Drupal::currentUser()->hasPermission('export configuration')) {
69 $request = \Drupal::request(); 70 $request = \Drupal::request();
70 $date = DateTime::createFromFormat('U', $request->server->get('REQUEST_TIME')); 71 $date = DateTime::createFromFormat('U', $request->server->get('REQUEST_TIME'));
71 $date_string = $date->format('Y-m-d-H-i'); 72 $date_string = $date->format('Y-m-d-H-i');
72 $hostname = str_replace('.', '-', $request->getHttpHost()); 73 $hostname = str_replace('.', '-', $request->getHttpHost());
73 $filename = 'config' . '-' . $hostname . '-' . $date_string . '.tar.gz'; 74 $filename = 'config-' . $hostname . '-' . $date_string . '.tar.gz';
74 $disposition = 'attachment; filename="' . $filename . '"'; 75 $disposition = 'attachment; filename="' . $filename . '"';
75 return [ 76 return [
76 'Content-disposition' => $disposition, 77 'Content-disposition' => $disposition,
77 ]; 78 ];
78 } 79 }