Drush: commands/core/config.drush.inc Source File

  1. 7.x doxygen/html/config_8drush_8inc_source.html
  2. master doxygen/html/config_8drush_8inc_source.html
Go to the documentation of this file.
1 <?php
2 
3 /**
4  * @file
5  * Provides Configuration Management commands.
6  */
7 
8 use Drupal\config\StorageReplaceDataWrapper;
10 use Drupal\Core\Config\StorageComparer;
11 use Drupal\Core\Config\ConfigImporter;
12 use Drupal\Core\Config\ConfigException;
13 use Drupal\Core\Config\FileStorage;
14 use Drupal\Component\Utility\NestedArray;
17 use Symfony\Component\Yaml\Parser;
18 
19 /**
20  * Implementation of hook_drush_help().
21  */
22 function config_drush_help($section) {
23  switch ($section) {
24  case 'meta:config:title':
25  return dt('Config commands');
26  case 'meta:config:summary':
27  return dt('Interact with the configuration system.');
28  }
29 }
30 
31 /**
32  * Implementation of hook_drush_command().
33  */
35  $deps = array('drupal dependencies' => array('config'));
36  $items['config-get'] = array(
37  'description' => 'Display a config value, or a whole configuration object.',
38  'arguments' => array(
39  'config-name' => 'The config object name, for example "system.site".',
40  'key' => 'The config key, for example "page.front". Optional.',
41  ),
42  'required-arguments' => 1,
43  'options' => array(
44  'source' => array(
45  'description' => 'The config storage source to read. Additional labels may be defined in settings.php',
46  'example-value' => 'sync',
47  'value' => 'required',
48  ),
49  'include-overridden' => array(
50  'description' => 'Include overridden values.',
51  )
52  ),
53  'examples' => array(
54  'drush config-get system.site' => 'Displays the system.site config.',
55  'drush config-get system.site page.front' => 'gets system.site:page.front value.',
56  ),
57  'outputformat' => array(
58  'default' => 'yaml',
59  'pipe-format' => 'var_export',
60  ),
61  'aliases' => array('cget'),
62  'core' => array('8+'),
63  );
64 
65  $items['config-set'] = array(
66  'description' => 'Set config value directly. Does not perform a config import.',
67  'arguments' => array(
68  'config-name' => 'The config object name, for example "system.site".',
69  'key' => 'The config key, for example "page.front".',
70  'value' => 'The value to assign to the config key. Use \'-\' to read from STDIN.',
71  ),
72  'options' => array(
73  'format' => array(
74  'description' => 'Format to parse the object. Use "string" for string (default), and "yaml" for YAML.',
75  'example-value' => 'yaml',
76  'value' => 'required',
77  ),
78  // A convenient way to pass a multiline value within a backend request.
79  'value' => array(
80  'description' => 'The value to assign to the config key (if any).',
81  'hidden' => TRUE,
82  ),
83  ),
84  'examples' => array(
85  'drush config-set system.site page.front node' => 'Sets system.site:page.front to "node".',
86  ),
87  'aliases' => array('cset'),
88  'core' => array('8+'),
89  );
90 
91  $items['config-export'] = array(
92  'description' => 'Export configuration to a directory.',
93  'core' => array('8+'),
94  'aliases' => array('cex'),
95  'arguments' => array(
96  'label' => "A config directory label (i.e. a key in \$config_directories array in settings.php). Defaults to 'sync'",
97  ),
98  'options' => array(
99  'add' => 'Run `git add -p` after exporting. This lets you choose which config changes to sync for commit.',
100  'commit' => 'Run `git add -A` and `git commit` after exporting. This commits everything that was exported without prompting.',
101  'message' => 'Commit comment for the exported configuration. Optional; may only be used with --commit or --push.',
102  'push' => 'Run `git push` after committing. Implies --commit.',
103  'remote' => array(
104  'description' => 'The remote git branch to use to push changes. Defaults to "origin".',
105  'example-value' => 'origin',
106  ),
107  'branch' => array(
108  'description' => 'Make commit on provided working branch. Ignored if used without --commit or --push.',
109  'example-value' => 'branchname',
110  ),
111  'destination' => 'An arbitrary directory that should receive the exported files. An alternative to label argument.',
112  'skip-modules' => 'A list of modules to ignore during export (e.g. to avoid listing dev-only modules in exported configuration).',
113  ),
114  'examples' => array(
115  'drush config-export --skip-modules=devel' => 'Export configuration; do not include the devel module in the exported configuration, regardless of whether or not it is enabled in the site.',
116  'drush config-export --destination' => 'Export configuration; Save files in a backup directory named config-export.',
117  ),
118  );
119 
120  $items['config-import'] = array(
121  'description' => 'Import config from a config directory.',
122  'arguments' => array(
123  'label' => "A config directory label (i.e. a key in \$config_directories array in settings.php). Defaults to 'sync'",
124  ),
125  'options' => array(
126  'preview' => array(
127  'description' => 'Format for displaying proposed changes. Recognized values: list, diff. Defaults to list.',
128  'example-value' => 'list',
129  ),
130  'source' => array(
131  'description' => 'An arbitrary directory that holds the configuration files. An alternative to label argument',
132  ),
133  'partial' => array(
134  'description' => 'Allows for partial config imports from the source directory. Only updates and new configs will be processed with this flag (missing configs will not be deleted).',
135  ),
136  'skip-modules' => 'A list of modules to ignore during import (e.g. to avoid disabling dev-only modules that are not enabled in the imported configuration).',
137  ),
138  'core' => array('8+'),
139  'examples' => array(
140  'drush config-import --skip-modules=devel' => 'Import configuration; do not enable or disable the devel module, regardless of whether or not it appears in the imported list of enabled modules.',
141  ),
142  'aliases' => array('cim'),
143  );
144 
145  $items['config-list'] = array(
146  'description' => 'List config names by prefix.',
147  'core' => array('8+'),
148  'aliases' => array('cli'),
149  'arguments' => array(
150  'prefix' => 'The config prefix. For example, "system". No prefix will return all names in the system.',
151  ),
152  'examples' => array(
153  'drush config-list system' => 'Return a list of all system config names.',
154  'drush config-list "image.style"' => 'Return a list of all image styles.',
155  'drush config-list --format="json"' => 'Return all config names as json.',
156  ),
157  'outputformat' => array(
158  'default' => 'list',
159  'pipe-format' => 'var_export',
160  'output-data-type' => 'format-list',
161  ),
162  );
163 
164  $items['config-edit'] = $deps + array(
165  'description' => 'Open a config file in a text editor. Edits are imported into active configuration after closing editor.',
166  'core' => array('8+'),
167  'aliases' => array('cedit'),
168  'arguments' => array(
169  'config-name' => 'The config object name, for example "system.site".',
170  ),
171  'global-options' => array('editor', 'bg'),
172  'allow-additional-options' => array('config-import'),
173  'examples' => array(
174  'drush config-edit image.style.large' => 'Edit the image style configurations.',
175  'drush config-edit' => 'Choose a config file to edit.',
176  'drush config-edit --choice=2' => 'Edit the second file in the choice list.',
177  'drush --bg config-edit image.style.large' => 'Return to shell prompt as soon as the editor window opens.',
178  ),
179  );
180 
181  $items['config-delete'] = array(
182  'description' => 'Delete a configuration object.',
183  'core' => array('8+'),
184  'aliases' => array('cdel'),
185  'arguments' => array(
186  'config-name' => 'The config object name, for example "system.site".',
187  ),
188  'required arguments'
189  );
190 
191  $items['config-pull'] = array(
192  'description' => 'Export and transfer config from one environment to another.',
193  // 'core' => array('8+'), Operates on remote sites so not possible to declare this locally.
194  'drush dependencies' => array('config', 'core'), // core-rsync, core-execute.
195  'bootstrap' => DRUSH_BOOTSTRAP_NONE,
196  'aliases' => array('cpull'),
197  'arguments' => array(
198  'source' => 'A site-alias or the name of a subdirectory within /sites whose config you want to copy from.',
199  'target' => 'A site-alias or the name of a subdirectory within /sites whose config you want to replace.',
200  ),
201  'required-arguments' => TRUE,
202  'allow-additional-options' => array(), // Most options from config-export and core-rsync unusable.
203  'examples' => array(
204  'drush config-pull @prod @stage' => "Export config from @prod and transfer to @stage.",
205  'drush config-pull @prod @self --label=vcs' => "Export config from @prod and transfer to the 'vcs' config directory of current site.",
206  ),
207  'options' => array(
208  'safe' => 'Validate that there are no git uncommitted changes before proceeding',
209  'label' => "A config directory label (i.e. a key in \$config_directories array in settings.php). Defaults to 'sync'",
210  'runner' => 'Where to run the rsync command; defaults to the local site. Can also be "source" or "destination".',
211  ),
212  'topics' => array('docs-aliases', 'docs-config-exporting'),
213  );
214 
215  return $items;
216 }
217 
218 /**
219  * Implements hook_drush_help_alter().
220  */
221 function config_drush_help_alter(&$command) {
222  // Hide additional-options which are for internal use only.
223  if ($command['command'] == 'config-edit') {
224  $command['options']['source']['hidden'] = TRUE;
225  $command['options']['partial']['hidden'] = TRUE;
226  }
227 }
228 
229 /**
230  * Config list command callback
231  *
232  * @param string $prefix
233  * The config prefix to retrieve, or empty to return all.
234  */
235 function drush_config_list($prefix = '') {
236  $names = \Drupal::configFactory()->listAll($prefix);
237 
238  if (empty($names)) {
239  // Just in case there is no config.
240  if (!$prefix) {
241  return drush_set_error(dt('No config storage names found.'));
242  }
243  else {
244  return drush_set_error(dt('No config storage names found matching @prefix', array('@prefix' => $prefix)));
245  }
246  }
247 
248  return $names;
249 }
250 
251 /**
252  * Config get command callback.
253  *
254  * @param $config_name
255  * The config name.
256  * @param $key
257  * The config key.
258  */
259 function drush_config_get($config_name, $key = NULL) {
260  if (!isset($key)) {
261  return drush_config_get_object($config_name);
262  }
263  else {
264  return drush_config_get_value($config_name, $key);
265  }
266 }
267 
268 /**
269  * Config delete command callback.
270  *
271  * @param $config_name
272  * The config name.
273  */
274 function drush_config_delete($config_name) {
275  $config =\Drupal::service('config.factory')->getEditable($config_name);
276  if ($config->isNew()) {
277  return drush_set_error('DRUSH_CONFIG_ERROR', 'Configuration name not recognized. Use config-list to see all names.');
278  }
279  else {
280  $config->delete();
281  }
282 }
283 
284 /**
285  * Config set command callback.
286  *
287  * @param $config_name
288  * The config name.
289  * @param $key
290  * The config key.
291  * @param $data
292  * The data to save to config.
293  */
294 function drush_config_set($config_name, $key = NULL, $data = NULL) {
295  // This hidden option is a convenient way to pass a value without passing a key.
296  $data = drush_get_option('value', $data);
297 
298  if (!isset($data)) {
299  return drush_set_error('DRUSH_CONFIG_ERROR', dt('No config value specified.'));
300  }
301 
302  $config = \Drupal::configFactory()->getEditable($config_name);
303  // Check to see if config key already exists.
304  if ($config->get($key) === NULL) {
305  $new_key = TRUE;
306  }
307  else {
308  $new_key = FALSE;
309  }
310 
311  // Special flag indicating that the value has been passed via STDIN.
312  if ($data === '-') {
313  $data = stream_get_contents(STDIN);
314  }
315 
316  // Now, we parse the value.
317  switch (drush_get_option('format', 'string')) {
318  case 'yaml':
319  $parser = new Parser();
320  $data = $parser->parse($data, TRUE);
321  }
322 
323  if (is_array($data) && drush_confirm(dt('Do you want to update or set multiple keys on !name config.', array('!name' => $config_name)))) {
324  foreach ($data as $key => $value) {
325  $config->set($key, $value);
326  }
327  return $config->save();
328  }
329  else {
330  $confirmed = FALSE;
331  if ($config->isNew() && drush_confirm(dt('!name config does not exist. Do you want to create a new config object?', array('!name' => $config_name)))) {
332  $confirmed = TRUE;
333  }
334  elseif ($new_key && drush_confirm(dt('!key key does not exist in !name config. Do you want to create a new config key?', array('!key' => $key, '!name' => $config_name)))) {
335  $confirmed = TRUE;
336  }
337  elseif (drush_confirm(dt('Do you want to update !key key in !name config?', array('!key' => $key, '!name' => $config_name)))) {
338  $confirmed = TRUE;
339  }
340  if ($confirmed && !drush_get_context('DRUSH_SIMULATE')) {
341  return $config->set($key, $data)->save();
342  }
343  }
344 }
345 
346 /*
347  * If provided $destination is not TRUE and not empty, make sure it is writable.
348  */
349 function drush_config_export_validate() {
350  $destination = drush_get_option('destination');
351  if ($destination === TRUE) {
352  // We create a dir in command callback. No need to validate.
353  return;
354  }
355 
356  if (!empty($destination)) {
357  $additional = array();
358  $values = drush_sitealias_evaluate_path($destination, $additional, TRUE);
359  if (!isset($values['path'])) {
360  return drush_set_error('config_export_target', 'The destination directory could not be evaluated.');
361  }
362  $destination = $values['path'];
363  drush_set_option('destination', $destination);
364  if (!file_exists($destination)) {
365  $parent = dirname($destination);
366  if (!is_dir($parent)) {
367  return drush_set_error('config_export_target', 'The destination parent directory does not exist.');
368  }
369  if (!is_writable($parent)) {
370  return drush_set_error('config_export_target', 'The destination parent directory is not writable.');
371  }
372  }
373  else {
374  if (!is_dir($destination)) {
375  return drush_set_error('config_export_target', 'The destination is not a directory.');
376  }
377  if (!is_writable($destination)) {
378  return drush_set_error('config_export_target', 'The destination directory is not writable.');
379  }
380  }
381  }
382 }
383 
384 /**
385  * Command callback: Export config to specified directory (usually sync).
386  */
387 function drush_config_export($destination = NULL) {
388  global $config_directories;
389 
390  // Determine which target directory to use.
391  if ($target = drush_get_option('destination')) {
392  if ($target === TRUE) {
393  // User did not pass a specific value for --destination. Make one.
394  /** @var drush_version_control_backup $backup */
395  $backup = drush_include_engine('version_control', 'backup');
396  $destination_dir = $backup->prepare_backup_dir('config-export');
397  }
398  else {
399  $destination_dir = $target;
400  // It is important to be able to specify a destination directory that
401  // does not exist yet, for exporting on remote systems
402  drush_mkdir($destination_dir);
403  }
404  }
405  else {
406  $choices = drush_map_assoc(array_keys($config_directories));
407  unset($choices[CONFIG_ACTIVE_DIRECTORY]);
408  if (!isset($destination) && count($choices) >= 2) {
409  $destination = drush_choice($choices, 'Choose a destination.');
410  if (empty($destination)) {
411  return drush_user_abort();
412  }
413  }
414  elseif (!isset($destination)) {
415  $destination = CONFIG_SYNC_DIRECTORY;
416  }
417  $destination_dir = config_get_config_directory($destination);
418  }
419 
420  // Prepare a new branch, if applicable
421  $remote = drush_get_option('push', FALSE);
422  $original_branch = FALSE;
423  $branch = FALSE;
424  if ($remote) {
425  // Get the branch that we're on at the moment
426  $result = drush_shell_cd_and_exec($destination_dir, 'git rev-parse --abbrev-ref HEAD');
427  if (!$result) {
428  return drush_set_error('DRUSH_CONFIG_EXPORT_NO_GIT', dt("The drush config-export command requires that the selected configuration directory !dir be under git revision control when using --commit or --push options.", array('!dir' => $destination_dir)));
429  }
430  $output = drush_shell_exec_output();
431  $original_branch = $output[0];
432  $branch = drush_get_option('branch', FALSE);
433  if (!$branch) {
434  $branch = $original_branch;
435  }
436  if ($branch != $original_branch) {
437  // Switch to the working branch; create it if it does not exist.
438  // We do NOT want to use -B here, as we do NOT want to reset the
439  // branch if it already exists.
440  $result = drush_shell_cd_and_exec($destination_dir, 'git checkout %s', $branch);
441  if (!$result) {
442  $result = drush_shell_cd_and_exec($destination_dir, 'git checkout -b %s', $branch);
443  }
444  }
445  }
446 
447  // Do the actual config export operation
448  $result = _drush_config_export($destination, $destination_dir, $branch);
449 
450  // Regardless of the result of the export, reset to our original branch.
451  if ($branch != $original_branch) {
452  drush_shell_cd_and_exec($destination_dir, 'git checkout %s', $original_branch);
453  }
454 
455  return $result;
456 }
457 
458 function _drush_config_export($destination, $destination_dir, $branch) {
459  $commit = drush_get_option('commit');
460  $comment = drush_get_option('message', 'Exported configuration.');
461  $storage_filters = drush_config_get_storage_filters();
462  if (count(glob($destination_dir . '/*')) > 0) {
463  // Retrieve a list of differences between the active and target configuration (if any).
464  $target_storage = new FileStorage($destination_dir);
465  /** @var \Drupal\Core\Config\StorageInterface $active_storage */
466  $active_storage = \Drupal::service('config.storage');
467  $comparison_source = $active_storage;
468 
469  // If the output is being filtered, then write a temporary copy before doing
470  // any comparison.
471  if (!empty($storage_filters)) {
472  $tmpdir = drush_tempdir();
473  drush_copy_dir($destination_dir, $tmpdir, FILE_EXISTS_OVERWRITE);
474  $comparison_source = new FileStorage($tmpdir);
475  $comparison_source_filtered = new StorageWrapper($comparison_source, $storage_filters);
476  foreach ($active_storage->listAll() as $name) {
477  // Copy active storage to our temporary active store.
478  if ($existing = $active_storage->read($name)) {
479  $comparison_source_filtered->write($name, $existing);
480  }
481  }
482  }
483 
484  $config_comparer = new StorageComparer($comparison_source, $target_storage, \Drupal::service('config.manager'));
485  if (!$config_comparer->createChangelist()->hasChanges()) {
486  return drush_log(dt('The active configuration is identical to the configuration in the export directory (!target).', array('!target' => $destination_dir)), LogLevel::OK);
487  }
488 
489  drush_print("Differences of the active config to the export directory:\n");
490  $change_list = array();
491  foreach ($config_comparer->getAllCollectionNames() as $collection) {
492  $change_list[$collection] = $config_comparer->getChangelist(NULL, $collection);
493  }
494  // Print a table with changes in color, then re-generate again without
495  // color to place in the commit comment.
496  _drush_print_config_changes_table($change_list);
497  $tbl = _drush_format_config_changes_table($change_list);
498  $output = $tbl->getTable();
499  if (!stristr(PHP_OS, 'WIN')) {
500  $output = str_replace("\r\n", PHP_EOL, $output);
501  }
502  $comment .= "\n\n$output";
503 
504  if (!$commit && !drush_confirm(dt('The .yml files in your export directory (!target) will be deleted and replaced with the active config.', array('!target' => $destination_dir)))) {
505  return drush_user_abort();
506  }
507  // Only delete .yml files, and not .htaccess or .git.
508  drush_scan_directory($destination_dir, '/\.yml$/', array('.', '..'), 'unlink');
509  }
510 
511  // Write all .yml files.
512  $source_storage = \Drupal::service('config.storage');
513  $destination_storage = new FileStorage($destination_dir);
514  // If there are any filters, then attach them to the destination storage
515  if (!empty($storage_filters)) {
516  $destination_storage = new StorageWrapper($destination_storage, $storage_filters);
517  }
518  foreach ($source_storage->listAll() as $name) {
519  $destination_storage->write($name, $source_storage->read($name));
520  }
521 
522  // Export configuration collections.
523  foreach (\Drupal::service('config.storage')->getAllCollectionNames() as $collection) {
524  $source_storage = $source_storage->createCollection($collection);
525  $destination_storage = $destination_storage->createCollection($collection);
526  foreach ($source_storage->listAll() as $name) {
527  $destination_storage->write($name, $source_storage->read($name));
528  }
529  }
530 
531  drush_log(dt('Configuration successfully exported to !target.', array('!target' => $destination_dir)), LogLevel::SUCCESS);
532  drush_backend_set_result($destination_dir);
533 
534  // Commit and push, or add exported configuration if requested.
535  $remote = drush_get_option('push', FALSE);
536  if ($commit || $remote) {
537  // There must be changed files at the destination dir; if there are not, then
538  // we will skip the commit-and-push step
539  $result = drush_shell_cd_and_exec($destination_dir, 'git status --porcelain .');
540  if (!$result) {
541  return drush_set_error('DRUSH_CONFIG_EXPORT_FAILURE', dt("`git status` failed."));
542  }
543  $uncommitted_changes = drush_shell_exec_output();
544  if (!empty($uncommitted_changes)) {
545  $result = drush_shell_cd_and_exec($destination_dir, 'git add -A .');
546  if (!$result) {
547  return drush_set_error('DRUSH_CONFIG_EXPORT_FAILURE', dt("`git add -A` failed."));
548  }
549  $comment_file = drush_save_data_to_temp_file($comment);
550  $result = drush_shell_cd_and_exec($destination_dir, 'git commit --file=%s', $comment_file);
551  if (!$result) {
552  return drush_set_error('DRUSH_CONFIG_EXPORT_FAILURE', dt("`git commit` failed. Output:\n\n!output", array('!output' => implode("\n", drush_shell_exec_output()))));
553  }
554  if ($remote) {
555  // Remote might be FALSE, if --push was not specified, or
556  // it might be TRUE if --push was not given a value.
557  if (!is_string($remote)) {
558  $remote = 'origin';
559  }
560  $result = drush_shell_cd_and_exec($destination_dir, 'git push --set-upstream %s %s', $remote, $branch);
561  if (!$result) {
562  return drush_set_error('DRUSH_CONFIG_EXPORT_FAILURE', dt("`git push` failed."));
563  }
564  }
565  }
566  }
567  elseif (drush_get_option('add')) {
568  drush_shell_exec_interactive('git add -p %s', $destination_dir);
569  }
570 
571  $values = array(
572  'destination' => $destination_dir,
573  );
574  return $values;
575 }
576 
577 function drush_config_import_validate() {
578  drush_include_engine('drupal', 'environment');
579  if (drush_get_option('partial') && !drush_module_exists('config')) {
580  return drush_set_error('config_import_partial', 'Enable the config module in order to use the --partial option.');
581  }
582 
583  if ($source = drush_get_option('source')) {
584  if (!file_exists($source)) {
585  return drush_set_error('config_import_target', 'The source directory does not exist.');
586  }
587  if (!is_dir($source)) {
588  return drush_set_error('config_import_target', 'The source is not a directory.');
589  }
590  }
591 }
592 
593 /**
594  * Presently, the only configuration storage filter that is supported
595  * is the 'CoreExtensionFilter'. If other use cases arise that are
596  * not supported by Drupal's configuration override system, then we
597  * could add a hook here via drush_command_invoke_all('drush_storage_filters');
598  *
600  */
602  $result = array();
603  $module_adjustments = drush_get_option('skip-modules');
604  if (!empty($module_adjustments)) {
605  if (is_string($module_adjustments)) {
606  $module_adjustments = explode(',', $module_adjustments);
607  }
608  $result[] = new CoreExtensionFilter($module_adjustments);
609  }
610  return $result;
611 }
612 
613 /**
614  * Command callback. Import from specified config directory (defaults to sync).
615  */
616 function drush_config_import($source = NULL) {
617  global $config_directories;
618 
619  // Determine source directory.
620  if ($target = drush_get_option('source')) {
621  $source_dir = $target;
622  }
623  else {
624  $choices = drush_map_assoc(array_keys($config_directories));
625  unset($choices[CONFIG_ACTIVE_DIRECTORY]);
626  if (!isset($source) && count($choices) >= 2) {
627  $source= drush_choice($choices, 'Choose a source.');
628  if (empty($source)) {
629  return drush_user_abort();
630  }
631  }
632  elseif (!isset($source)) {
633  $source = CONFIG_SYNC_DIRECTORY;
634  }
635  $source_dir = config_get_config_directory($source);
636  }
637 
638  // Determine $source_storage in partial and non-partial cases.
639  /** @var \Drupal\Core\Config\StorageInterface $active_storage */
640  $active_storage = \Drupal::service('config.storage');
641  if (drush_get_option('partial')) {
642  $source_storage = new StorageReplaceDataWrapper($active_storage);
643  $file_storage = new FileStorage($source_dir);
644  foreach ($file_storage->listAll() as $name) {
645  $data = $file_storage->read($name);
646  $source_storage->replaceData($name, $data);
647  }
648  }
649  else {
650  $source_storage = new FileStorage($source_dir);
651  }
652 
653  // If our configuration storage is being filtered, then attach all filters
654  // to the source storage object. We will use the filtered values uniformly
655  // for comparison, full imports, and partial imports.
656  $storage_filters = drush_config_get_storage_filters();
657  if (!empty($storage_filters)) {
658  $source_storage = new StorageWrapper($source_storage, $storage_filters);
659  }
660 
661  /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */
662  $config_manager = \Drupal::service('config.manager');
663  $storage_comparer = new StorageComparer($source_storage, $active_storage, $config_manager);
664 
665 
666  if (!$storage_comparer->createChangelist()->hasChanges()) {
667  return drush_log(dt('There are no changes to import.'), LogLevel::OK);
668  }
669 
670  if (drush_get_option('preview', 'list') == 'list') {
671  $change_list = array();
672  foreach ($storage_comparer->getAllCollectionNames() as $collection) {
673  $change_list[$collection] = $storage_comparer->getChangelist(NULL, $collection);
674  }
675  _drush_print_config_changes_table($change_list);
676  }
677  else {
678  // Copy active storage to the temporary directory.
679  $temp_dir = drush_tempdir();
680  $temp_storage = new FileStorage($temp_dir);
681  $source_dir_storage = new FileStorage($source_dir);
682  foreach ($source_dir_storage->listAll() as $name) {
683  if ($data = $active_storage->read($name)) {
684  $temp_storage->write($name, $data);
685  }
686  }
687  drush_shell_exec('diff -x %s -u %s %s', '*.git', $temp_dir, $source_dir);
688  $output = drush_shell_exec_output();
689  drush_print(implode("\n", $output));
690  }
691 
692  if (drush_confirm(dt('Import the listed configuration changes?'))) {
693  return drush_op('_drush_config_import', $storage_comparer);
694  }
695 }
696 
697 // Copied from submitForm() at /core/modules/config/src/Form/ConfigSync.php
698 function _drush_config_import(StorageComparer $storage_comparer) {
699  $config_importer = new ConfigImporter(
700  $storage_comparer,
701  \Drupal::service('event_dispatcher'),
702  \Drupal::service('config.manager'),
703  \Drupal::lock(),
704  \Drupal::service('config.typed'),
705  \Drupal::moduleHandler(),
706  \Drupal::service('module_installer'),
707  \Drupal::service('theme_handler'),
708  \Drupal::service('string_translation')
709  );
710  if ($config_importer->alreadyImporting()) {
711  drush_log('Another request may be synchronizing configuration already.', LogLevel::WARNING);
712  }
713  else{
714  try {
715  $config_importer->import();
716  drush_log('The configuration was imported successfully.', LogLevel::SUCCESS);
717  }
718  catch (ConfigException $e) {
719  // Return a negative result for UI purposes. We do not differentiate
720  // between an actual synchronization error and a failed lock, because
721  // concurrent synchronizations are an edge-case happening only when
722  // multiple developers or site builders attempt to do it without
723  // coordinating.
724  $message = 'The import failed due for the following reasons:' . "\n";
725  $message .= implode("\n", $config_importer->getErrors());
726 
727  watchdog_exception('config_import', $e);
728  return drush_set_error('config_import_fail', $message);
729  }
730  }
731 }
732 
733 /**
734  * Edit command callback.
735  */
736 function drush_config_edit($config_name = '') {
737  // Identify and validate input.
738  if ($config_name) {
739  $config = \Drupal::configFactory()->get($config_name);
740  if ($config->isNew()) {
741  return drush_set_error(dt('Config !name does not exist', array('!name' => $config_name)));
742  }
743  }
744  else {
745  $config_names = \Drupal::configFactory()->listAll();
746  $choice = drush_choice($config_names, 'Choose a configuration.');
747  if (empty($choice)) {
748  return drush_user_abort();
749  }
750  else {
751  $config_name = $config_names[$choice];
752  $config = \Drupal::configFactory()->get($config_name);
753  }
754  }
755 
756  $active_storage = $config->getStorage();
757  $contents = $active_storage->read($config_name);
758 
759  // Write tmp YAML file for editing
760  $temp_dir = drush_tempdir();
761  $temp_storage = new FileStorage($temp_dir);
762  $temp_storage->write($config_name, $contents);
763 
764  $exec = drush_get_editor();
765  drush_shell_exec_interactive($exec, $temp_storage->getFilePath($config_name));
766 
767  // Perform import operation if user did not immediately exit editor.
768  if (!drush_get_option('bg', FALSE)) {
769  $options = drush_redispatch_get_options() + array('partial' => TRUE, 'source' => $temp_dir);
770  $backend_options = array('interactive' => TRUE);
771  return (bool) drush_invoke_process('@self', 'config-import', array(), $options, $backend_options);
772  }
773 }
774 
775 /**
776  * Config pull validate callback
777  *
778  */
779 function drush_config_pull_validate($source, $destination) {
780  if (drush_get_option('safe')) {
781  $return = drush_invoke_process($destination, 'core-execute', array('git diff --quiet'), array('escape' => 0));
782  if ($return['error_status']) {
783  return drush_set_error('DRUSH_GIT_DIRTY', 'There are uncommitted changes in your git working copy.');
784  }
785  }
786 }
787 
788 /**
789  * Config pull command callback
790  *
791  * @param string $label
792  * The config label which receives the transferred files.
793  */
794 function drush_config_pull($source, $destination) {
795  // @todo drush_redispatch_get_options() assumes you will execute same command. Not good.
796  $global_options = drush_redispatch_get_options() + array(
797  'strict' => 0,
798  );
799 
800  // @todo If either call is made interactive, we don't get an $return['object'] back.
801  $backend_options = array('interactive' => FALSE);
802  if (drush_get_context('DRUSH_SIMULATE')) {
803  $backend_options['backend-simulate'] = TRUE;
804  }
805 
806  $export_options = array(
807  // Use the standard backup directory on Destination.
808  'destination' => TRUE,
809  );
810  drush_log(dt('Starting to export configuration on Target.'), LogLevel::OK);
811  $return = drush_invoke_process($source, 'config-export', array(), $global_options + $export_options, $backend_options);
812  if ($return['error_status']) {
813  return drush_set_error('DRUSH_CONFIG_PULL_EXPORT_FAILED', dt('Config-export failed.'));
814  }
815  else {
816  // Trailing slash assures that transfer files and not the containing dir.
817  $export_path = $return['object'] . '/';
818  }
819 
820  $rsync_options = array(
821  'remove-source-files' => TRUE,
822  'delete' => TRUE,
823  'exclude-paths' => '.htaccess',
824  'yes' => TRUE, // No need to prompt as destination is always the target config directory.
825  );
826  $label = drush_get_option('label', 'sync');
827  $runner = drush_get_runner($source, $destination, drush_get_option('runner', FALSE));
828  drush_log(dt('Starting to rsync configuration files from !source to !dest.', array('!source' => $source, '!dest' => $destination)), LogLevel::OK);
829  // This comment applies similarly to sql-sync's use of core-rsync.
830  // Since core-rsync is a strict-handling command and drush_invoke_process() puts options at end, we can't send along cli options to rsync.
831  // Alternatively, add options like --ssh-options to a site alias (usually on the machine that initiates the sql-sync).
832  $return = drush_invoke_process($runner, 'core-rsync', array("$source:$export_path", "$destination:%config-$label"), $rsync_options);
833  if ($return['error_status']) {
834  return drush_set_error('DRUSH_CONFIG_PULL_RSYNC_FAILED', dt('Config-pull rsync failed.'));
835  }
836 
837  drush_backend_set_result($return['object']);
838 }
839 
840 /**
841  * Show and return a config object
842  *
843  * @param $config_name
844  * The config object name.
845  */
846 function drush_config_get_object($config_name) {
847  $source = drush_get_option('source', 'active');
848  $include_overridden = drush_get_option('include-overridden', FALSE);
849 
850  if ($include_overridden) {
851  // Displaying overrides only applies to active storage.
852  $config = \Drupal::config($config_name);
853  $data = $config->get();
854  }
855  elseif ($source == 'active') {
856  $config = \Drupal::service('config.storage');
857  $data = $config->read($config_name);
858  }
859  elseif ($source == 'sync') {
860  $config = \Drupal::service('config.storage.sync');
861  $data = $config->read($config_name);
862  }
863  else {
864  return drush_set_error(dt('Unknown value !value for config source.', array('!value' => $source)));
865  }
866 
867  if ($data === FALSE) {
868  return drush_set_error(dt('Config !name does not exist in !source configuration.', array('!name' => $config_name, '!source' => $source)));
869  }
870  if (empty($data)) {
871  drush_log(dt('Config !name exists but has no data.', array('!name' => $config_name)), LogLevel::INFO);
872  return;
873  }
874  return $data;
875 }
876 
877 /**
878  * Show and return a value from config system.
879  *
880  * @param $config_name
881  * The config name.
882  * @param $key
883  * The config key.
884  */
885 function drush_config_get_value($config_name, $key) {
886  $data = drush_config_get_object($config_name);
887  $parts = explode('.', $key);
888  if (count($parts) == 1) {
889  $value = isset($data[$key]) ? $data[$key] : NULL;
890  }
891  else {
892  $value = NestedArray::getValue($data, $parts, $key_exists);
893  $value = $key_exists ? $value : NULL;
894  }
895 
896  $returns[$config_name . ':' . $key] = $value;
897 
898  if ($value === NULL) {
899  return drush_set_error('DRUSH_CONFIG_ERROR', dt('No matching key found in !name config.', array('!name' => $config_name)));
900  }
901  else {
902  return $returns;
903  }
904 }
905 
906 /**
907  * Print a table of config changes.
908  *
909  * @param array $config_changes
910  * An array of changes keyed by collection.
911  */
912 function _drush_format_config_changes_table(array $config_changes, $use_color = FALSE) {
913  if (!$use_color) {
914  $red = "%s";
915  $yellow = "%s";
916  $green = "%s";
917  }
918  else {
919  $red = "\033[31;40m\033[1m%s\033[0m";
920  $yellow = "\033[1;33;40m\033[1m%s\033[0m";
921  $green = "\033[1;32;40m\033[1m%s\033[0m";
922  }
923 
924  $rows = array();
925  $rows[] = array('Collection', 'Config', 'Operation');
926  foreach ($config_changes as $collection => $changes) {
927  foreach ($changes as $change => $configs) {
928  switch ($change) {
929  case 'delete':
930  $colour = $red;
931  break;
932  case 'update':
933  $colour = $yellow;
934  break;
935  case 'create':
936  $colour = $green;
937  break;
938  default:
939  $colour = "%s";
940  break;
941  }
942  foreach($configs as $config) {
943  $rows[] = array(
944  $collection,
945  $config,
946  sprintf($colour, $change)
947  );
948  }
949  }
950  }
951  $tbl = _drush_format_table($rows);
952  return $tbl;
953 }
954 
955 /**
956  * Print a table of config changes.
957  *
958  * @param array $config_changes
959  * An array of changes keyed by collection.
960  */
961 function _drush_print_config_changes_table(array $config_changes) {
962  $tbl = _drush_format_config_changes_table($config_changes, !drush_get_context('DRUSH_NOCOLOR'));
963 
964  $output = $tbl->getTable();
965  if (!stristr(PHP_OS, 'WIN')) {
966  $output = str_replace("\r\n", PHP_EOL, $output);
967  }
968 
969  drush_print(rtrim($output));
970  return $tbl;
971 }
972 
973 /**
974  * Command argument complete callback.
975  */
978 }
979 
980 /**
981  * Command argument complete callback.
982  */
985 }
986 
987 /**
988  * Command argument complete callback.
989  */
992 }
993 
994 /**
995  * Command argument complete callback.
996  */
999 }
1000 
1001 /**
1002  * Command argument complete callback.
1003  */
1006 }
1007 
1008 /**
1009  * Command argument complete callback.
1010  */
1013 }
1014 
1015 /**
1016  * Command argument complete callback.
1017  */
1019  return array('values' => array_keys(_drush_sitealias_all_list()));
1020 }
1021 
1022 /**
1023  * Helper function for command argument complete callback.
1024  *
1025  * @return
1026  * Array of available config directories.
1027  */
1030  global $config_directories;
1031  return array('values' => array_keys($config_directories));
1032 }
1033 
1034 /**
1035  * Helper function for command argument complete callback.
1036  *
1037  * @return
1038  * Array of available config names.
1039  */
1042  return array('values' => $storage = \Drupal::service('config.storage')->listAll());
1043 }

File

doxygen/html/config_8drush_8inc_source.html
View source
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Drush: commands/core/config.drush.inc Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Drush
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.2 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_afac61274991793aa7e9133a8f4f291e.html">commands</a></li><li class="navelem"><a class="el" href="dir_5762b63965e3a68a35f77c23b4dd4668.html">core</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">config.drush.inc</div>  </div>
</div><!--header-->
<div class="contents">
<a href="config_8drush_8inc.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;&lt;?php</div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * @file</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *   Provides Configuration Management commands.</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;</div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;use Drupal\config\StorageReplaceDataWrapper;</div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;use <a class="code" href="classDrush_1_1Log_1_1LogLevel.html">Drush\Log\LogLevel</a>;</div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;use Drupal\Core\Config\StorageComparer;</div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;use Drupal\Core\Config\ConfigImporter;</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;use Drupal\Core\Config\ConfigException;</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;use Drupal\Core\Config\FileStorage;</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;use Drupal\Component\Utility\NestedArray;</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;use <a class="code" href="classDrush_1_1Config_1_1StorageWrapper.html">Drush\Config\StorageWrapper</a>;</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;use <a class="code" href="classDrush_1_1Config_1_1CoreExtensionFilter.html">Drush\Config\CoreExtensionFilter</a>;</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;use Symfony\Component\Yaml\Parser;</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> * Implementation of hook_drush_help().</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#ac8c45e17bb7579f19b4d2eac73837a99">   22</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#ac8c45e17bb7579f19b4d2eac73837a99">config_drush_help</a>($section) {</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;  <span class="keywordflow">switch</span> ($section) {</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;    <span class="keywordflow">case</span> <span class="stringliteral">&#39;meta:config:title&#39;</span>:</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Config commands&#39;</span>);</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;    <span class="keywordflow">case</span> <span class="stringliteral">&#39;meta:config:summary&#39;</span>:</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Interact with the configuration system.&#39;</span>);</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;  }</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;}</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="comment"> * Implementation of hook_drush_command().</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#a197ee171a5b9a330734f3482f1cc7443">   34</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#a197ee171a5b9a330734f3482f1cc7443">config_drush_command</a>() {</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;  $deps = array(<span class="stringliteral">&#39;drupal dependencies&#39;</span> =&gt; array(<span class="stringliteral">&#39;config&#39;</span>));</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;  $items[<span class="stringliteral">&#39;config-get&#39;</span>] = array(</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;Display a config value, or a whole configuration object.&#39;</span>,</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    <span class="stringliteral">&#39;arguments&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;      <span class="stringliteral">&#39;config-name&#39;</span> =&gt; <span class="stringliteral">&#39;The config object name, for example &quot;system.site&quot;.&#39;</span>,</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;      <span class="stringliteral">&#39;key&#39;</span> =&gt; <span class="stringliteral">&#39;The config key, for example &quot;page.front&quot;. Optional.&#39;</span>,</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    ),</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <span class="stringliteral">&#39;required-arguments&#39;</span> =&gt; 1,</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    <span class="stringliteral">&#39;options&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;      <span class="stringliteral">&#39;source&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;        <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;The config storage source to read. Additional labels may be defined in settings.php&#39;</span>,</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;        <span class="stringliteral">&#39;example-value&#39;</span> =&gt; <span class="stringliteral">&#39;sync&#39;</span>,</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;        <span class="stringliteral">&#39;value&#39;</span> =&gt; <span class="stringliteral">&#39;required&#39;</span>,</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;      ),</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;      <span class="stringliteral">&#39;include-overridden&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;        <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;Include overridden values.&#39;</span>,</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;      )</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    ),</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;    <span class="stringliteral">&#39;examples&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;      <span class="stringliteral">&#39;drush config-get system.site&#39;</span> =&gt; <span class="stringliteral">&#39;Displays the system.site config.&#39;</span>,</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;      <span class="stringliteral">&#39;drush config-get system.site page.front&#39;</span> =&gt; <span class="stringliteral">&#39;gets system.site:page.front value.&#39;</span>,</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;    ),</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <span class="stringliteral">&#39;outputformat&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;      <span class="stringliteral">&#39;default&#39;</span> =&gt; <span class="stringliteral">&#39;yaml&#39;</span>,</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;      <span class="stringliteral">&#39;pipe-format&#39;</span> =&gt; <span class="stringliteral">&#39;var_export&#39;</span>,</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    ),</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    <span class="stringliteral">&#39;aliases&#39;</span> =&gt; array(<span class="stringliteral">&#39;cget&#39;</span>),</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <span class="stringliteral">&#39;core&#39;</span> =&gt; array(<span class="stringliteral">&#39;8+&#39;</span>),</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;  );</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;  $items[<span class="stringliteral">&#39;config-set&#39;</span>] = array(</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;Set config value directly. Does not perform a config import.&#39;</span>,</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    <span class="stringliteral">&#39;arguments&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;      <span class="stringliteral">&#39;config-name&#39;</span> =&gt; <span class="stringliteral">&#39;The config object name, for example &quot;system.site&quot;.&#39;</span>,</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;      <span class="stringliteral">&#39;key&#39;</span> =&gt; <span class="stringliteral">&#39;The config key, for example &quot;page.front&quot;.&#39;</span>,</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;      <span class="stringliteral">&#39;value&#39;</span> =&gt; <span class="stringliteral">&#39;The value to assign to the config key. Use \&#39;-\&#39; to read from STDIN.&#39;</span>,</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;    ),</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    <span class="stringliteral">&#39;options&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;      <span class="stringliteral">&#39;format&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;        <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;Format to parse the object. Use &quot;string&quot; for string (default), and &quot;yaml&quot; for YAML.&#39;</span>,</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;        <span class="stringliteral">&#39;example-value&#39;</span> =&gt; <span class="stringliteral">&#39;yaml&#39;</span>,</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;        <span class="stringliteral">&#39;value&#39;</span> =&gt; <span class="stringliteral">&#39;required&#39;</span>,</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;      ),</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;      <span class="comment">// A convenient way to pass a multiline value within a backend request.</span></div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;      <span class="stringliteral">&#39;value&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;        <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;The value to assign to the config key (if any).&#39;</span>,</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;        <span class="stringliteral">&#39;hidden&#39;</span> =&gt; TRUE,</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;      ),</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;    ),</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    <span class="stringliteral">&#39;examples&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;      <span class="stringliteral">&#39;drush config-set system.site page.front node&#39;</span> =&gt; <span class="stringliteral">&#39;Sets system.site:page.front to &quot;node&quot;.&#39;</span>,</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    ),</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    <span class="stringliteral">&#39;aliases&#39;</span> =&gt; array(<span class="stringliteral">&#39;cset&#39;</span>),</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    <span class="stringliteral">&#39;core&#39;</span> =&gt; array(<span class="stringliteral">&#39;8+&#39;</span>),</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;  );</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;  $items[<span class="stringliteral">&#39;config-export&#39;</span>] = array(</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;Export configuration to a directory.&#39;</span>,</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    <span class="stringliteral">&#39;core&#39;</span> =&gt; array(<span class="stringliteral">&#39;8+&#39;</span>),</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    <span class="stringliteral">&#39;aliases&#39;</span> =&gt; array(<span class="stringliteral">&#39;cex&#39;</span>),</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    <span class="stringliteral">&#39;arguments&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;      <span class="stringliteral">&#39;label&#39;</span> =&gt; <span class="stringliteral">&quot;A config directory label (i.e. a key in \$config_directories array in settings.php). Defaults to &#39;sync&#39;&quot;</span>,</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    ),</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    <span class="stringliteral">&#39;options&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;      <span class="stringliteral">&#39;add&#39;</span> =&gt; <span class="stringliteral">&#39;Run `git add -p` after exporting. This lets you choose which config changes to sync for commit.&#39;</span>,</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;      <span class="stringliteral">&#39;commit&#39;</span> =&gt; <span class="stringliteral">&#39;Run `git add -A` and `git commit` after exporting.  This commits everything that was exported without prompting.&#39;</span>,</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;      <span class="stringliteral">&#39;message&#39;</span> =&gt; <span class="stringliteral">&#39;Commit comment for the exported configuration.  Optional; may only be used with --commit or --push.&#39;</span>,</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;      <span class="stringliteral">&#39;push&#39;</span> =&gt; <span class="stringliteral">&#39;Run `git push` after committing.  Implies --commit.&#39;</span>,</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;      <span class="stringliteral">&#39;remote&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;        <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;The remote git branch to use to push changes.  Defaults to &quot;origin&quot;.&#39;</span>,</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;        <span class="stringliteral">&#39;example-value&#39;</span> =&gt; <span class="stringliteral">&#39;origin&#39;</span>,</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;      ),</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;      <span class="stringliteral">&#39;branch&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;        <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;Make commit on provided working branch. Ignored if used without --commit or --push.&#39;</span>,</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;        <span class="stringliteral">&#39;example-value&#39;</span> =&gt; <span class="stringliteral">&#39;branchname&#39;</span>,</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;      ),</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;      <span class="stringliteral">&#39;destination&#39;</span> =&gt; <span class="stringliteral">&#39;An arbitrary directory that should receive the exported files. An alternative to label argument.&#39;</span>,</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;      <span class="stringliteral">&#39;skip-modules&#39;</span> =&gt; <span class="stringliteral">&#39;A list of modules to ignore during export (e.g. to avoid listing dev-only modules in exported configuration).&#39;</span>,</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    ),</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    <span class="stringliteral">&#39;examples&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;      <span class="stringliteral">&#39;drush config-export --skip-modules=devel&#39;</span> =&gt; <span class="stringliteral">&#39;Export configuration; do not include the devel module in the exported configuration, regardless of whether or not it is enabled in the site.&#39;</span>,</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;      <span class="stringliteral">&#39;drush config-export --destination&#39;</span> =&gt; <span class="stringliteral">&#39;Export configuration; Save files in a backup directory named config-export.&#39;</span>,</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    ),</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;  );</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;  $items[<span class="stringliteral">&#39;config-import&#39;</span>] = array(</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;Import config from a config directory.&#39;</span>,</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    <span class="stringliteral">&#39;arguments&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;      <span class="stringliteral">&#39;label&#39;</span> =&gt; <span class="stringliteral">&quot;A config directory label (i.e. a key in \$config_directories array in settings.php). Defaults to &#39;sync&#39;&quot;</span>,</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    ),</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    <span class="stringliteral">&#39;options&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;      <span class="stringliteral">&#39;preview&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;        <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;Format for displaying proposed changes. Recognized values: list, diff. Defaults to list.&#39;</span>,</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;        <span class="stringliteral">&#39;example-value&#39;</span> =&gt; <span class="stringliteral">&#39;list&#39;</span>,</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;      ),</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;      <span class="stringliteral">&#39;source&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;        <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;An arbitrary directory that holds the configuration files. An alternative to label argument&#39;</span>,</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;      ),</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;      <span class="stringliteral">&#39;partial&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;        <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;Allows for partial config imports from the source directory. Only updates and new configs will be processed with this flag (missing configs will not be deleted).&#39;</span>,</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;      ),</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;      <span class="stringliteral">&#39;skip-modules&#39;</span> =&gt; <span class="stringliteral">&#39;A list of modules to ignore during import (e.g. to avoid disabling dev-only modules that are not enabled in the imported configuration).&#39;</span>,</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;    ),</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;    <span class="stringliteral">&#39;core&#39;</span> =&gt; array(<span class="stringliteral">&#39;8+&#39;</span>),</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;    <span class="stringliteral">&#39;examples&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;      <span class="stringliteral">&#39;drush config-import --skip-modules=devel&#39;</span> =&gt; <span class="stringliteral">&#39;Import configuration; do not enable or disable the devel module, regardless of whether or not it appears in the imported list of enabled modules.&#39;</span>,</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;    ),</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;    <span class="stringliteral">&#39;aliases&#39;</span> =&gt; array(<span class="stringliteral">&#39;cim&#39;</span>),</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;  );</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;  $items[<span class="stringliteral">&#39;config-list&#39;</span>] = array(</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;List config names by prefix.&#39;</span>,</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;    <span class="stringliteral">&#39;core&#39;</span> =&gt; array(<span class="stringliteral">&#39;8+&#39;</span>),</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;    <span class="stringliteral">&#39;aliases&#39;</span> =&gt; array(<span class="stringliteral">&#39;cli&#39;</span>),</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;    <span class="stringliteral">&#39;arguments&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;      <span class="stringliteral">&#39;prefix&#39;</span> =&gt; <span class="stringliteral">&#39;The config prefix. For example, &quot;system&quot;. No prefix will return all names in the system.&#39;</span>,</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;    ),</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;    <span class="stringliteral">&#39;examples&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;      <span class="stringliteral">&#39;drush config-list system&#39;</span> =&gt; <span class="stringliteral">&#39;Return a list of all system config names.&#39;</span>,</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;      <span class="stringliteral">&#39;drush config-list &quot;image.style&quot;&#39;</span> =&gt; <span class="stringliteral">&#39;Return a list of all image styles.&#39;</span>,</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;      <span class="stringliteral">&#39;drush config-list --format=&quot;json&quot;&#39;</span> =&gt; <span class="stringliteral">&#39;Return all config names as json.&#39;</span>,</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;    ),</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;    <span class="stringliteral">&#39;outputformat&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;      <span class="stringliteral">&#39;default&#39;</span> =&gt; <span class="stringliteral">&#39;list&#39;</span>,</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;      <span class="stringliteral">&#39;pipe-format&#39;</span> =&gt; <span class="stringliteral">&#39;var_export&#39;</span>,</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;      <span class="stringliteral">&#39;output-data-type&#39;</span> =&gt; <span class="stringliteral">&#39;format-list&#39;</span>,</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;    ),</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;  );</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;  $items[<span class="stringliteral">&#39;config-edit&#39;</span>] = $deps + array(</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;    <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;Open a config file in a text editor. Edits are imported into active configuration after closing editor.&#39;</span>,</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    <span class="stringliteral">&#39;core&#39;</span> =&gt; array(<span class="stringliteral">&#39;8+&#39;</span>),</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;    <span class="stringliteral">&#39;aliases&#39;</span> =&gt; array(<span class="stringliteral">&#39;cedit&#39;</span>),</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;    <span class="stringliteral">&#39;arguments&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;      <span class="stringliteral">&#39;config-name&#39;</span> =&gt; <span class="stringliteral">&#39;The config object name, for example &quot;system.site&quot;.&#39;</span>,</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;    ),</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;    <span class="stringliteral">&#39;global-options&#39;</span> =&gt; array(<span class="stringliteral">&#39;editor&#39;</span>, <span class="stringliteral">&#39;bg&#39;</span>),</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;    <span class="stringliteral">&#39;allow-additional-options&#39;</span> =&gt; array(<span class="stringliteral">&#39;config-import&#39;</span>),</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;    <span class="stringliteral">&#39;examples&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;      <span class="stringliteral">&#39;drush config-edit image.style.large&#39;</span> =&gt; <span class="stringliteral">&#39;Edit the image style configurations.&#39;</span>,</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;      <span class="stringliteral">&#39;drush config-edit&#39;</span> =&gt; <span class="stringliteral">&#39;Choose a config file to edit.&#39;</span>,</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;      <span class="stringliteral">&#39;drush config-edit --choice=2&#39;</span> =&gt; <span class="stringliteral">&#39;Edit the second file in the choice list.&#39;</span>,</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;      <span class="stringliteral">&#39;drush --bg config-edit image.style.large&#39;</span> =&gt; <span class="stringliteral">&#39;Return to shell prompt as soon as the editor window opens.&#39;</span>,</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;    ),</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;  );</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;  $items[<span class="stringliteral">&#39;config-delete&#39;</span>] = array(</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;    <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;Delete a configuration object.&#39;</span>,</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;    <span class="stringliteral">&#39;core&#39;</span> =&gt; array(<span class="stringliteral">&#39;8+&#39;</span>),</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;    <span class="stringliteral">&#39;aliases&#39;</span> =&gt; array(<span class="stringliteral">&#39;cdel&#39;</span>),</div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;    <span class="stringliteral">&#39;arguments&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;        <span class="stringliteral">&#39;config-name&#39;</span> =&gt; <span class="stringliteral">&#39;The config object name, for example &quot;system.site&quot;.&#39;</span>,</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;    ),</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;    <span class="stringliteral">&#39;required arguments&#39;</span></div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;  );</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;  $items[<span class="stringliteral">&#39;config-pull&#39;</span>] = array(</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;    <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;Export and transfer config from one environment to another.&#39;</span>,</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;    <span class="comment">// &#39;core&#39; =&gt; array(&#39;8+&#39;), Operates on remote sites so not possible to declare this locally.</span></div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;    <span class="stringliteral">&#39;drush dependencies&#39;</span> =&gt; array(<span class="stringliteral">&#39;config&#39;</span>, <span class="stringliteral">&#39;core&#39;</span>), <span class="comment">// core-rsync, core-execute.</span></div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;    <span class="stringliteral">&#39;bootstrap&#39;</span> =&gt; DRUSH_BOOTSTRAP_NONE,</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;    <span class="stringliteral">&#39;aliases&#39;</span> =&gt; array(<span class="stringliteral">&#39;cpull&#39;</span>),</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;    <span class="stringliteral">&#39;arguments&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;      <span class="stringliteral">&#39;source&#39;</span> =&gt; <span class="stringliteral">&#39;A site-alias or the name of a subdirectory within /sites whose config you want to copy from.&#39;</span>,</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;      <span class="stringliteral">&#39;target&#39;</span> =&gt; <span class="stringliteral">&#39;A site-alias or the name of a subdirectory within /sites whose config you want to replace.&#39;</span>,</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;    ),</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;    <span class="stringliteral">&#39;required-arguments&#39;</span> =&gt; TRUE,</div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;    <span class="stringliteral">&#39;allow-additional-options&#39;</span> =&gt; array(), <span class="comment">// Most options from config-export and core-rsync unusable.</span></div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;    <span class="stringliteral">&#39;examples&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;      <span class="stringliteral">&#39;drush config-pull @prod @stage&#39;</span> =&gt; <span class="stringliteral">&quot;Export config from @prod and transfer to @stage.&quot;</span>,</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;      <span class="stringliteral">&#39;drush config-pull @prod @self --label=vcs&#39;</span> =&gt; <span class="stringliteral">&quot;Export config from @prod and transfer to the &#39;vcs&#39; config directory of current site.&quot;</span>,</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;    ),</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;    <span class="stringliteral">&#39;options&#39;</span> =&gt; array(</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;      <span class="stringliteral">&#39;safe&#39;</span> =&gt; <span class="stringliteral">&#39;Validate that there are no git uncommitted changes before proceeding&#39;</span>,</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;      <span class="stringliteral">&#39;label&#39;</span> =&gt; <span class="stringliteral">&quot;A config directory label (i.e. a key in \$config_directories array in settings.php). Defaults to &#39;sync&#39;&quot;</span>,</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;      <span class="stringliteral">&#39;runner&#39;</span> =&gt; <span class="stringliteral">&#39;Where to run the rsync command; defaults to the local site. Can also be &quot;source&quot; or &quot;destination&quot;.&#39;</span>,</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;    ),</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;    <span class="stringliteral">&#39;topics&#39;</span> =&gt; array(<span class="stringliteral">&#39;docs-aliases&#39;</span>, <span class="stringliteral">&#39;docs-config-exporting&#39;</span>),</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;  );</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;  <span class="keywordflow">return</span> $items;</div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;}</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;<span class="comment"> * Implements hook_drush_help_alter().</span></div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00221"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#a3ac375fda5d08c5c59043d62996c25f6">  221</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#a3ac375fda5d08c5c59043d62996c25f6">config_drush_help_alter</a>(&amp;$command) {</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;  <span class="comment">// Hide additional-options which are for internal use only.</span></div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;  <span class="keywordflow">if</span> ($command[<span class="stringliteral">&#39;command&#39;</span>] == <span class="stringliteral">&#39;config-edit&#39;</span>) {</div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;    $command[<span class="stringliteral">&#39;options&#39;</span>][<span class="stringliteral">&#39;source&#39;</span>][<span class="stringliteral">&#39;hidden&#39;</span>] = TRUE;</div>
<div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;    $command[<span class="stringliteral">&#39;options&#39;</span>][<span class="stringliteral">&#39;partial&#39;</span>][<span class="stringliteral">&#39;hidden&#39;</span>] = TRUE;</div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;  }</div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;}</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;<span class="comment"> * Config list command callback</span></div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;<span class="comment"> * @param string $prefix</span></div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;<span class="comment"> *   The config prefix to retrieve, or empty to return all.</span></div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00235"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#a1ff3fe58ce20c0bc66bfa0a5657546f2">  235</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#a1ff3fe58ce20c0bc66bfa0a5657546f2">drush_config_list</a>($prefix = <span class="stringliteral">&#39;&#39;</span>) {</div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;  $names = \Drupal::configFactory()-&gt;listAll($prefix);</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;  <span class="keywordflow">if</span> (empty($names)) {</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;    <span class="comment">// Just in case there is no config.</span></div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;    <span class="keywordflow">if</span> (!$prefix) {</div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;No config storage names found.&#39;</span>));</div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;    }</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;No config storage names found matching @prefix&#39;</span>, array(<span class="stringliteral">&#39;@prefix&#39;</span> =&gt; $prefix)));</div>
<div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;    }</div>
<div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;  }</div>
<div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;</div>
<div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;  <span class="keywordflow">return</span> $names;</div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;}</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;<span class="comment"> * Config get command callback.</span></div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;<span class="comment"> * @param $config_name</span></div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;<span class="comment"> *   The config name.</span></div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;<span class="comment"> * @param $key</span></div>
<div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;<span class="comment"> *   The config key.</span></div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00259"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#a199f272e089d274cae1cd486b5911ee4">  259</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#a199f272e089d274cae1cd486b5911ee4">drush_config_get</a>($config_name, $key = NULL) {</div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;  <span class="keywordflow">if</span> (!isset($key)) {</div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="config_8drush_8inc.html#ac1bfb8fb33a150037b4151fc96fdd413">drush_config_get_object</a>($config_name);</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;  }</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="config_8drush_8inc.html#a94f2786e14faf36d88449bef68350678">drush_config_get_value</a>($config_name, $key);</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;  }</div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;}</div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;<span class="comment"> * Config delete command callback.</span></div>
<div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;<span class="comment"> * @param $config_name</span></div>
<div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;<span class="comment"> *   The config name.</span></div>
<div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00274"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#a301714a5275424cdd3d9b6bb8061a06b">  274</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#a301714a5275424cdd3d9b6bb8061a06b">drush_config_delete</a>($config_name) {</div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;  $config =\Drupal::service(<span class="stringliteral">&#39;config.factory&#39;</span>)-&gt;getEditable($config_name);</div>
<div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;  <span class="keywordflow">if</span> ($config-&gt;isNew()) {</div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;DRUSH_CONFIG_ERROR&#39;</span>, <span class="stringliteral">&#39;Configuration name not recognized. Use config-list to see all names.&#39;</span>);</div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;  }</div>
<div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;    $config-&gt;delete();</div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;  }</div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;}</div>
<div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;<span class="comment"> * Config set command callback.</span></div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;<span class="comment"> * @param $config_name</span></div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;<span class="comment"> *   The config name.</span></div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;<span class="comment"> * @param $key</span></div>
<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;<span class="comment"> *   The config key.</span></div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;<span class="comment"> * @param $data</span></div>
<div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;<span class="comment"> *    The data to save to config.</span></div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00294"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#a445c382afd7d7b9e7f6a7bad268c0d4d">  294</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#a445c382afd7d7b9e7f6a7bad268c0d4d">drush_config_set</a>($config_name, $key = NULL, $data = NULL) {</div>
<div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;  <span class="comment">// This hidden option is a convenient way to pass a value without passing a key.</span></div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;  $data = <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;value&#39;</span>, $data);</div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;</div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;  <span class="keywordflow">if</span> (!isset($data)) {</div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;DRUSH_CONFIG_ERROR&#39;</span>, <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;No config value specified.&#39;</span>));</div>
<div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;  }</div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;</div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;  $config = \Drupal::configFactory()-&gt;getEditable($config_name);</div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;  <span class="comment">// Check to see if config key already exists.</span></div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;  <span class="keywordflow">if</span> ($config-&gt;get($key) === NULL) {</div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;    $new_key = TRUE;</div>
<div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;  }</div>
<div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;    $new_key = FALSE;</div>
<div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;  }</div>
<div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;</div>
<div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;  <span class="comment">// Special flag indicating that the value has been passed via STDIN.</span></div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;  <span class="keywordflow">if</span> ($data === <span class="charliteral">&#39;-&#39;</span>) {</div>
<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;    $data = stream_get_contents(STDIN);</div>
<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;  }</div>
<div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;</div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;  <span class="comment">// Now, we parse the value.</span></div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;  <span class="keywordflow">switch</span> (<a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;format&#39;</span>, <span class="stringliteral">&#39;string&#39;</span>)) {</div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;    <span class="keywordflow">case</span> <span class="stringliteral">&#39;yaml&#39;</span>:</div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;      $parser = <span class="keyword">new</span> Parser();</div>
<div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;      $data = $parser-&gt;parse($data, TRUE);</div>
<div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;  }</div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;  <span class="keywordflow">if</span> (is_array($data) &amp;&amp; <a class="code" href="group__userinput.html#gaa4169b83ff9dc4222af95d376b21268b">drush_confirm</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Do you want to update or set multiple keys on !name config.&#39;</span>, array(<span class="stringliteral">&#39;!name&#39;</span> =&gt; $config_name)))) {</div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;    <span class="keywordflow">foreach</span> ($data as $key =&gt; $value) {</div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;      $config-&gt;set($key, $value);</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;    }</div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;    <span class="keywordflow">return</span> $config-&gt;save();</div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;  }</div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;    $confirmed = FALSE;</div>
<div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;    <span class="keywordflow">if</span> ($config-&gt;isNew() &amp;&amp; <a class="code" href="group__userinput.html#gaa4169b83ff9dc4222af95d376b21268b">drush_confirm</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;!name config does not exist. Do you want to create a new config object?&#39;</span>, array(<span class="stringliteral">&#39;!name&#39;</span> =&gt; $config_name)))) {</div>
<div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;      $confirmed = TRUE;</div>
<div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;    }</div>
<div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;    elseif ($new_key &amp;&amp; <a class="code" href="group__userinput.html#gaa4169b83ff9dc4222af95d376b21268b">drush_confirm</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;!key key does not exist in !name config. Do you want to create a new config key?&#39;</span>, array(<span class="stringliteral">&#39;!key&#39;</span> =&gt; $key, <span class="stringliteral">&#39;!name&#39;</span> =&gt; $config_name)))) {</div>
<div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;      $confirmed = TRUE;</div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;    }</div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;    elseif (<a class="code" href="group__userinput.html#gaa4169b83ff9dc4222af95d376b21268b">drush_confirm</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Do you want to update !key key in !name config?&#39;</span>, array(<span class="stringliteral">&#39;!key&#39;</span> =&gt; $key, <span class="stringliteral">&#39;!name&#39;</span> =&gt; $config_name)))) {</div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;      $confirmed = TRUE;</div>
<div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;    }</div>
<div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;    <span class="keywordflow">if</span> ($confirmed &amp;&amp; !<a class="code" href="context_8inc.html#ad25559f8d7d753f636fbeac347c29fc5">drush_get_context</a>(<span class="stringliteral">&#39;DRUSH_SIMULATE&#39;</span>)) {</div>
<div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160;      <span class="keywordflow">return</span> $config-&gt;set($key, $data)-&gt;save();</div>
<div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;    }</div>
<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;  }</div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;}</div>
<div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;</div>
<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;<span class="comment"> * If provided $destination is not TRUE and not empty, make sure it is writable.</span></div>
<div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160;<span class="keyword">function</span> drush_config_export_validate() {</div>
<div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;  $destination = <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;destination&#39;</span>);</div>
<div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160;  <span class="keywordflow">if</span> ($destination === TRUE) {</div>
<div class="line"><a name="l00352"></a><span class="lineno">  352</span>&#160;    <span class="comment">// We create a dir in command callback. No need to validate.</span></div>
<div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;    <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;  }</div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;</div>
<div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;  <span class="keywordflow">if</span> (!empty($destination)) {</div>
<div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;    $additional = array();</div>
<div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;    $values = <a class="code" href="sitealias_8inc.html#ad847d30de6caee61a30ebc2059f9ad5a">drush_sitealias_evaluate_path</a>($destination, $additional, TRUE);</div>
<div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160;    <span class="keywordflow">if</span> (!isset($values[<span class="stringliteral">&#39;path&#39;</span>])) {</div>
<div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;config_export_target&#39;</span>, <span class="stringliteral">&#39;The destination directory could not be evaluated.&#39;</span>);</div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;    }</div>
<div class="line"><a name="l00362"></a><span class="lineno">  362</span>&#160;    $destination = $values[<span class="stringliteral">&#39;path&#39;</span>];</div>
<div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;    <a class="code" href="context_8inc.html#aa4b55e2f6174c8b6efaa8f23a0f9e0af">drush_set_option</a>(<span class="stringliteral">&#39;destination&#39;</span>, $destination);</div>
<div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160;    <span class="keywordflow">if</span> (!file_exists($destination)) {</div>
<div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160;      $parent = dirname($destination);</div>
<div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;      <span class="keywordflow">if</span> (!is_dir($parent)) {</div>
<div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;config_export_target&#39;</span>, <span class="stringliteral">&#39;The destination parent directory does not exist.&#39;</span>);</div>
<div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;      }</div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;      <span class="keywordflow">if</span> (!is_writable($parent)) {</div>
<div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;config_export_target&#39;</span>, <span class="stringliteral">&#39;The destination parent directory is not writable.&#39;</span>);</div>
<div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160;      }</div>
<div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160;    }</div>
<div class="line"><a name="l00373"></a><span class="lineno">  373</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00374"></a><span class="lineno">  374</span>&#160;      <span class="keywordflow">if</span> (!is_dir($destination)) {</div>
<div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;config_export_target&#39;</span>, <span class="stringliteral">&#39;The destination is not a directory.&#39;</span>);</div>
<div class="line"><a name="l00376"></a><span class="lineno">  376</span>&#160;      }</div>
<div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;      <span class="keywordflow">if</span> (!is_writable($destination)) {</div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;config_export_target&#39;</span>, <span class="stringliteral">&#39;The destination directory is not writable.&#39;</span>);</div>
<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;      }</div>
<div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160;    }</div>
<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160;  }</div>
<div class="line"><a name="l00382"></a><span class="lineno">  382</span>&#160;}</div>
<div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160;<span class="comment"> * Command callback: Export config to specified directory (usually sync).</span></div>
<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160;<span class="keyword">function</span> drush_config_export($destination = NULL) {</div>
<div class="line"><a name="l00388"></a><span class="lineno">  388</span>&#160;  global $config_directories;</div>
<div class="line"><a name="l00389"></a><span class="lineno">  389</span>&#160;</div>
<div class="line"><a name="l00390"></a><span class="lineno">  390</span>&#160;  <span class="comment">// Determine which target directory to use.</span></div>
<div class="line"><a name="l00391"></a><span class="lineno">  391</span>&#160;  <span class="keywordflow">if</span> ($target = <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;destination&#39;</span>)) {</div>
<div class="line"><a name="l00392"></a><span class="lineno">  392</span>&#160;    <span class="keywordflow">if</span> ($target === TRUE) {</div>
<div class="line"><a name="l00393"></a><span class="lineno">  393</span>&#160;      <span class="comment">// User did not pass a specific value for --destination. Make one.</span><span class="comment"></span></div>
<div class="line"><a name="l00394"></a><span class="lineno">  394</span>&#160;<span class="comment">      /** @var drush_version_control_backup $backup */</span></div>
<div class="line"><a name="l00395"></a><span class="lineno">  395</span>&#160;      $backup = <a class="code" href="engines_8inc.html#a92390a2dd40c8ed5190be4af058813a8">drush_include_engine</a>(<span class="stringliteral">&#39;version_control&#39;</span>, <span class="stringliteral">&#39;backup&#39;</span>);</div>
<div class="line"><a name="l00396"></a><span class="lineno">  396</span>&#160;      $destination_dir = $backup-&gt;prepare_backup_dir(<span class="stringliteral">&#39;config-export&#39;</span>);</div>
<div class="line"><a name="l00397"></a><span class="lineno">  397</span>&#160;    }</div>
<div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160;      $destination_dir = $target;</div>
<div class="line"><a name="l00400"></a><span class="lineno">  400</span>&#160;      <span class="comment">// It is important to be able to specify a destination directory that</span></div>
<div class="line"><a name="l00401"></a><span class="lineno">  401</span>&#160;      <span class="comment">// does not exist yet, for exporting on remote systems</span></div>
<div class="line"><a name="l00402"></a><span class="lineno">  402</span>&#160;      <a class="code" href="group__filesystemfunctions.html#ga6027285d97028ad3299d3aa262be8c2f">drush_mkdir</a>($destination_dir);</div>
<div class="line"><a name="l00403"></a><span class="lineno">  403</span>&#160;    }</div>
<div class="line"><a name="l00404"></a><span class="lineno">  404</span>&#160;  }</div>
<div class="line"><a name="l00405"></a><span class="lineno">  405</span>&#160;  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00406"></a><span class="lineno">  406</span>&#160;    $choices = <a class="code" href="drush_8inc.html#ad847f03f1d1c046f9eb472aafa56137c">drush_map_assoc</a>(array_keys($config_directories));</div>
<div class="line"><a name="l00407"></a><span class="lineno">  407</span>&#160;    unset($choices[CONFIG_ACTIVE_DIRECTORY]);</div>
<div class="line"><a name="l00408"></a><span class="lineno">  408</span>&#160;    <span class="keywordflow">if</span> (!isset($destination) &amp;&amp; count($choices) &gt;= 2) {</div>
<div class="line"><a name="l00409"></a><span class="lineno">  409</span>&#160;      $destination = <a class="code" href="group__userinput.html#ga7e823bcd58051b17e6e5601340f0c784">drush_choice</a>($choices, <span class="stringliteral">&#39;Choose a destination.&#39;</span>);</div>
<div class="line"><a name="l00410"></a><span class="lineno">  410</span>&#160;      <span class="keywordflow">if</span> (empty($destination)) {</div>
<div class="line"><a name="l00411"></a><span class="lineno">  411</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga366aaafdf8c774a58653c64a65b6d91c">drush_user_abort</a>();</div>
<div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;      }</div>
<div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160;    }</div>
<div class="line"><a name="l00414"></a><span class="lineno">  414</span>&#160;    elseif (!isset($destination)) {</div>
<div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160;      $destination = CONFIG_SYNC_DIRECTORY;</div>
<div class="line"><a name="l00416"></a><span class="lineno">  416</span>&#160;    }</div>
<div class="line"><a name="l00417"></a><span class="lineno">  417</span>&#160;    $destination_dir = config_get_config_directory($destination);</div>
<div class="line"><a name="l00418"></a><span class="lineno">  418</span>&#160;  }</div>
<div class="line"><a name="l00419"></a><span class="lineno">  419</span>&#160;</div>
<div class="line"><a name="l00420"></a><span class="lineno">  420</span>&#160;  <span class="comment">// Prepare a new branch, if applicable</span></div>
<div class="line"><a name="l00421"></a><span class="lineno">  421</span>&#160;  $remote = <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;push&#39;</span>, FALSE);</div>
<div class="line"><a name="l00422"></a><span class="lineno">  422</span>&#160;  $original_branch = FALSE;</div>
<div class="line"><a name="l00423"></a><span class="lineno">  423</span>&#160;  $branch = FALSE;</div>
<div class="line"><a name="l00424"></a><span class="lineno">  424</span>&#160;  <span class="keywordflow">if</span> ($remote) {</div>
<div class="line"><a name="l00425"></a><span class="lineno">  425</span>&#160;    <span class="comment">// Get the branch that we&#39;re on at the moment</span></div>
<div class="line"><a name="l00426"></a><span class="lineno">  426</span>&#160;    $result = <a class="code" href="group__commandwrappers.html#ga59e8ee9f53442f2029080ac723ed008f">drush_shell_cd_and_exec</a>($destination_dir, <span class="stringliteral">&#39;git rev-parse --abbrev-ref HEAD&#39;</span>);</div>
<div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160;    <span class="keywordflow">if</span> (!$result) {</div>
<div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;DRUSH_CONFIG_EXPORT_NO_GIT&#39;</span>, <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&quot;The drush config-export command requires that the selected configuration directory !dir be under git revision control when using --commit or --push options.&quot;</span>, array(<span class="stringliteral">&#39;!dir&#39;</span> =&gt; $destination_dir)));</div>
<div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160;    }</div>
<div class="line"><a name="l00430"></a><span class="lineno">  430</span>&#160;    $output = <a class="code" href="group__commandwrappers.html#gadba8c59ba260dd39f615bc22ca78e1af">drush_shell_exec_output</a>();</div>
<div class="line"><a name="l00431"></a><span class="lineno">  431</span>&#160;    $original_branch = $output[0];</div>
<div class="line"><a name="l00432"></a><span class="lineno">  432</span>&#160;    $branch = <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;branch&#39;</span>, FALSE);</div>
<div class="line"><a name="l00433"></a><span class="lineno">  433</span>&#160;    <span class="keywordflow">if</span> (!$branch) {</div>
<div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160;      $branch = $original_branch;</div>
<div class="line"><a name="l00435"></a><span class="lineno">  435</span>&#160;    }</div>
<div class="line"><a name="l00436"></a><span class="lineno">  436</span>&#160;    <span class="keywordflow">if</span> ($branch != $original_branch) {</div>
<div class="line"><a name="l00437"></a><span class="lineno">  437</span>&#160;      <span class="comment">// Switch to the working branch; create it if it does not exist.</span></div>
<div class="line"><a name="l00438"></a><span class="lineno">  438</span>&#160;      <span class="comment">// We do NOT want to use -B here, as we do NOT want to reset the</span></div>
<div class="line"><a name="l00439"></a><span class="lineno">  439</span>&#160;      <span class="comment">// branch if it already exists.</span></div>
<div class="line"><a name="l00440"></a><span class="lineno">  440</span>&#160;      $result = <a class="code" href="group__commandwrappers.html#ga59e8ee9f53442f2029080ac723ed008f">drush_shell_cd_and_exec</a>($destination_dir, <span class="stringliteral">&#39;git checkout %s&#39;</span>, $branch);</div>
<div class="line"><a name="l00441"></a><span class="lineno">  441</span>&#160;      <span class="keywordflow">if</span> (!$result) {</div>
<div class="line"><a name="l00442"></a><span class="lineno">  442</span>&#160;        $result = <a class="code" href="group__commandwrappers.html#ga59e8ee9f53442f2029080ac723ed008f">drush_shell_cd_and_exec</a>($destination_dir, <span class="stringliteral">&#39;git checkout -b %s&#39;</span>, $branch);</div>
<div class="line"><a name="l00443"></a><span class="lineno">  443</span>&#160;      }</div>
<div class="line"><a name="l00444"></a><span class="lineno">  444</span>&#160;    }</div>
<div class="line"><a name="l00445"></a><span class="lineno">  445</span>&#160;  }</div>
<div class="line"><a name="l00446"></a><span class="lineno">  446</span>&#160;</div>
<div class="line"><a name="l00447"></a><span class="lineno">  447</span>&#160;  <span class="comment">// Do the actual config export operation</span></div>
<div class="line"><a name="l00448"></a><span class="lineno">  448</span>&#160;  $result = _drush_config_export($destination, $destination_dir, $branch);</div>
<div class="line"><a name="l00449"></a><span class="lineno">  449</span>&#160;</div>
<div class="line"><a name="l00450"></a><span class="lineno">  450</span>&#160;  <span class="comment">// Regardless of the result of the export, reset to our original branch.</span></div>
<div class="line"><a name="l00451"></a><span class="lineno">  451</span>&#160;  <span class="keywordflow">if</span> ($branch != $original_branch) {</div>
<div class="line"><a name="l00452"></a><span class="lineno">  452</span>&#160;    <a class="code" href="group__commandwrappers.html#ga59e8ee9f53442f2029080ac723ed008f">drush_shell_cd_and_exec</a>($destination_dir, <span class="stringliteral">&#39;git checkout %s&#39;</span>, $original_branch);</div>
<div class="line"><a name="l00453"></a><span class="lineno">  453</span>&#160;  }</div>
<div class="line"><a name="l00454"></a><span class="lineno">  454</span>&#160;</div>
<div class="line"><a name="l00455"></a><span class="lineno">  455</span>&#160;  <span class="keywordflow">return</span> $result;</div>
<div class="line"><a name="l00456"></a><span class="lineno">  456</span>&#160;}</div>
<div class="line"><a name="l00457"></a><span class="lineno">  457</span>&#160;</div>
<div class="line"><a name="l00458"></a><span class="lineno">  458</span>&#160;<span class="keyword">function</span> _drush_config_export($destination, $destination_dir, $branch) {</div>
<div class="line"><a name="l00459"></a><span class="lineno">  459</span>&#160;  $commit = <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;commit&#39;</span>);</div>
<div class="line"><a name="l00460"></a><span class="lineno">  460</span>&#160;  $comment = <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;message&#39;</span>, <span class="stringliteral">&#39;Exported configuration.&#39;</span>);</div>
<div class="line"><a name="l00461"></a><span class="lineno">  461</span>&#160;  $storage_filters = <a class="code" href="config_8drush_8inc.html#a86087713cd7d19b7a78e277dab06c694">drush_config_get_storage_filters</a>();</div>
<div class="line"><a name="l00462"></a><span class="lineno">  462</span>&#160;  <span class="keywordflow">if</span> (count(glob($destination_dir . <span class="stringliteral">&#39;/*&#39;</span>)) &gt; 0) {</div>
<div class="line"><a name="l00463"></a><span class="lineno">  463</span>&#160;    <span class="comment">// Retrieve a list of differences between the active and target configuration (if any).</span></div>
<div class="line"><a name="l00464"></a><span class="lineno">  464</span>&#160;    $target_storage = <span class="keyword">new</span> FileStorage($destination_dir);<span class="comment"></span></div>
<div class="line"><a name="l00465"></a><span class="lineno">  465</span>&#160;<span class="comment">    /** @var \Drupal\Core\Config\StorageInterface $active_storage */</span></div>
<div class="line"><a name="l00466"></a><span class="lineno">  466</span>&#160;    $active_storage = \Drupal::service(<span class="stringliteral">&#39;config.storage&#39;</span>);</div>
<div class="line"><a name="l00467"></a><span class="lineno">  467</span>&#160;    $comparison_source = $active_storage;</div>
<div class="line"><a name="l00468"></a><span class="lineno">  468</span>&#160;</div>
<div class="line"><a name="l00469"></a><span class="lineno">  469</span>&#160;    <span class="comment">// If the output is being filtered, then write a temporary copy before doing</span></div>
<div class="line"><a name="l00470"></a><span class="lineno">  470</span>&#160;    <span class="comment">// any comparison.</span></div>
<div class="line"><a name="l00471"></a><span class="lineno">  471</span>&#160;    <span class="keywordflow">if</span> (!empty($storage_filters)) {</div>
<div class="line"><a name="l00472"></a><span class="lineno">  472</span>&#160;      $tmpdir = <a class="code" href="group__filesystemfunctions.html#ga883d28ed54603b2d268902cec2379804">drush_tempdir</a>();</div>
<div class="line"><a name="l00473"></a><span class="lineno">  473</span>&#160;      <a class="code" href="group__filesystemfunctions.html#ga1d86ac8e2e56a75acb0abcdc8e0dcf09">drush_copy_dir</a>($destination_dir, $tmpdir, FILE_EXISTS_OVERWRITE);</div>
<div class="line"><a name="l00474"></a><span class="lineno">  474</span>&#160;      $comparison_source = <span class="keyword">new</span> FileStorage($tmpdir);</div>
<div class="line"><a name="l00475"></a><span class="lineno">  475</span>&#160;      $comparison_source_filtered = <span class="keyword">new</span> <a class="code" href="classDrush_1_1Config_1_1StorageWrapper.html">StorageWrapper</a>($comparison_source, $storage_filters);</div>
<div class="line"><a name="l00476"></a><span class="lineno">  476</span>&#160;      <span class="keywordflow">foreach</span> ($active_storage-&gt;listAll() as $name) {</div>
<div class="line"><a name="l00477"></a><span class="lineno">  477</span>&#160;        <span class="comment">// Copy active storage to our temporary active store.</span></div>
<div class="line"><a name="l00478"></a><span class="lineno">  478</span>&#160;        <span class="keywordflow">if</span> ($existing = $active_storage-&gt;read($name)) {</div>
<div class="line"><a name="l00479"></a><span class="lineno">  479</span>&#160;          $comparison_source_filtered-&gt;write($name, $existing);</div>
<div class="line"><a name="l00480"></a><span class="lineno">  480</span>&#160;        }</div>
<div class="line"><a name="l00481"></a><span class="lineno">  481</span>&#160;      }</div>
<div class="line"><a name="l00482"></a><span class="lineno">  482</span>&#160;    }</div>
<div class="line"><a name="l00483"></a><span class="lineno">  483</span>&#160;</div>
<div class="line"><a name="l00484"></a><span class="lineno">  484</span>&#160;    $config_comparer = <span class="keyword">new</span> StorageComparer($comparison_source, $target_storage, \Drupal::service(<span class="stringliteral">&#39;config.manager&#39;</span>));</div>
<div class="line"><a name="l00485"></a><span class="lineno">  485</span>&#160;    <span class="keywordflow">if</span> (!$config_comparer-&gt;createChangelist()-&gt;hasChanges()) {</div>
<div class="line"><a name="l00486"></a><span class="lineno">  486</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__logging.html#ga47324b65808524558a488916b150dd51">drush_log</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;The active configuration is identical to the configuration in the export directory (!target).&#39;</span>, array(<span class="stringliteral">&#39;!target&#39;</span> =&gt; $destination_dir)), LogLevel::OK);</div>
<div class="line"><a name="l00487"></a><span class="lineno">  487</span>&#160;    }</div>
<div class="line"><a name="l00488"></a><span class="lineno">  488</span>&#160;</div>
<div class="line"><a name="l00489"></a><span class="lineno">  489</span>&#160;    <a class="code" href="group__outputfunctions.html#ga63acbb94925d6d2693e235e966bba740">drush_print</a>(<span class="stringliteral">&quot;Differences of the active config to the export directory:\n&quot;</span>);</div>
<div class="line"><a name="l00490"></a><span class="lineno">  490</span>&#160;    $change_list = array();</div>
<div class="line"><a name="l00491"></a><span class="lineno">  491</span>&#160;    <span class="keywordflow">foreach</span> ($config_comparer-&gt;getAllCollectionNames() as $collection) {</div>
<div class="line"><a name="l00492"></a><span class="lineno">  492</span>&#160;      $change_list[$collection] = $config_comparer-&gt;getChangelist(NULL, $collection);</div>
<div class="line"><a name="l00493"></a><span class="lineno">  493</span>&#160;    }</div>
<div class="line"><a name="l00494"></a><span class="lineno">  494</span>&#160;    <span class="comment">// Print a table with changes in color, then re-generate again without</span></div>
<div class="line"><a name="l00495"></a><span class="lineno">  495</span>&#160;    <span class="comment">// color to place in the commit comment.</span></div>
<div class="line"><a name="l00496"></a><span class="lineno">  496</span>&#160;    <a class="code" href="config_8drush_8inc.html#a2c365bd279e012b6b071723297bf10f3">_drush_print_config_changes_table</a>($change_list);</div>
<div class="line"><a name="l00497"></a><span class="lineno">  497</span>&#160;    $tbl = <a class="code" href="config_8drush_8inc.html#a3649bb18873b9055257a791a73b126b1">_drush_format_config_changes_table</a>($change_list);</div>
<div class="line"><a name="l00498"></a><span class="lineno">  498</span>&#160;    $output = $tbl-&gt;getTable();</div>
<div class="line"><a name="l00499"></a><span class="lineno">  499</span>&#160;    <span class="keywordflow">if</span> (!stristr(PHP_OS, <span class="stringliteral">&#39;WIN&#39;</span>)) {</div>
<div class="line"><a name="l00500"></a><span class="lineno">  500</span>&#160;      $output = str_replace(<span class="stringliteral">&quot;\r\n&quot;</span>, PHP_EOL, $output);</div>
<div class="line"><a name="l00501"></a><span class="lineno">  501</span>&#160;    }</div>
<div class="line"><a name="l00502"></a><span class="lineno">  502</span>&#160;    $comment .= <span class="stringliteral">&quot;\n\n$output&quot;</span>;</div>
<div class="line"><a name="l00503"></a><span class="lineno">  503</span>&#160;</div>
<div class="line"><a name="l00504"></a><span class="lineno">  504</span>&#160;    <span class="keywordflow">if</span> (!$commit &amp;&amp; !<a class="code" href="group__userinput.html#gaa4169b83ff9dc4222af95d376b21268b">drush_confirm</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;The .yml files in your export directory (!target) will be deleted and replaced with the active config.&#39;</span>, array(<span class="stringliteral">&#39;!target&#39;</span> =&gt; $destination_dir)))) {</div>
<div class="line"><a name="l00505"></a><span class="lineno">  505</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga366aaafdf8c774a58653c64a65b6d91c">drush_user_abort</a>();</div>
<div class="line"><a name="l00506"></a><span class="lineno">  506</span>&#160;    }</div>
<div class="line"><a name="l00507"></a><span class="lineno">  507</span>&#160;    <span class="comment">// Only delete .yml files, and not .htaccess or .git.</span></div>
<div class="line"><a name="l00508"></a><span class="lineno">  508</span>&#160;    <a class="code" href="group__filesystemfunctions.html#ga1c545390a8890f6ea47385f79fbe2e82">drush_scan_directory</a>($destination_dir, <span class="stringliteral">&#39;/\.yml$/&#39;</span>, array(<span class="charliteral">&#39;.&#39;</span>, <span class="stringliteral">&#39;..&#39;</span>), <span class="stringliteral">&#39;unlink&#39;</span>);</div>
<div class="line"><a name="l00509"></a><span class="lineno">  509</span>&#160;  }</div>
<div class="line"><a name="l00510"></a><span class="lineno">  510</span>&#160;</div>
<div class="line"><a name="l00511"></a><span class="lineno">  511</span>&#160;  <span class="comment">// Write all .yml files.</span></div>
<div class="line"><a name="l00512"></a><span class="lineno">  512</span>&#160;  $source_storage = \Drupal::service(<span class="stringliteral">&#39;config.storage&#39;</span>);</div>
<div class="line"><a name="l00513"></a><span class="lineno">  513</span>&#160;  $destination_storage = <span class="keyword">new</span> FileStorage($destination_dir);</div>
<div class="line"><a name="l00514"></a><span class="lineno">  514</span>&#160;  <span class="comment">// If there are any filters, then attach them to the destination storage</span></div>
<div class="line"><a name="l00515"></a><span class="lineno">  515</span>&#160;  <span class="keywordflow">if</span> (!empty($storage_filters)) {</div>
<div class="line"><a name="l00516"></a><span class="lineno">  516</span>&#160;    $destination_storage = <span class="keyword">new</span> <a class="code" href="classDrush_1_1Config_1_1StorageWrapper.html">StorageWrapper</a>($destination_storage, $storage_filters);</div>
<div class="line"><a name="l00517"></a><span class="lineno">  517</span>&#160;  }</div>
<div class="line"><a name="l00518"></a><span class="lineno">  518</span>&#160;  <span class="keywordflow">foreach</span> ($source_storage-&gt;listAll() as $name) {</div>
<div class="line"><a name="l00519"></a><span class="lineno">  519</span>&#160;    $destination_storage-&gt;write($name, $source_storage-&gt;read($name));</div>
<div class="line"><a name="l00520"></a><span class="lineno">  520</span>&#160;  }</div>
<div class="line"><a name="l00521"></a><span class="lineno">  521</span>&#160;</div>
<div class="line"><a name="l00522"></a><span class="lineno">  522</span>&#160;  <span class="comment">// Export configuration collections.</span></div>
<div class="line"><a name="l00523"></a><span class="lineno">  523</span>&#160;  <span class="keywordflow">foreach</span> (\Drupal::service(<span class="stringliteral">&#39;config.storage&#39;</span>)-&gt;getAllCollectionNames() as $collection) {</div>
<div class="line"><a name="l00524"></a><span class="lineno">  524</span>&#160;    $source_storage = $source_storage-&gt;createCollection($collection);</div>
<div class="line"><a name="l00525"></a><span class="lineno">  525</span>&#160;    $destination_storage = $destination_storage-&gt;createCollection($collection);</div>
<div class="line"><a name="l00526"></a><span class="lineno">  526</span>&#160;    <span class="keywordflow">foreach</span> ($source_storage-&gt;listAll() as $name) {</div>
<div class="line"><a name="l00527"></a><span class="lineno">  527</span>&#160;      $destination_storage-&gt;write($name, $source_storage-&gt;read($name));</div>
<div class="line"><a name="l00528"></a><span class="lineno">  528</span>&#160;    }</div>
<div class="line"><a name="l00529"></a><span class="lineno">  529</span>&#160;  }</div>
<div class="line"><a name="l00530"></a><span class="lineno">  530</span>&#160;</div>
<div class="line"><a name="l00531"></a><span class="lineno">  531</span>&#160;  <a class="code" href="group__logging.html#ga47324b65808524558a488916b150dd51">drush_log</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Configuration successfully exported to !target.&#39;</span>, array(<span class="stringliteral">&#39;!target&#39;</span> =&gt; $destination_dir)), LogLevel::SUCCESS);</div>
<div class="line"><a name="l00532"></a><span class="lineno">  532</span>&#160;  <a class="code" href="backend_8inc.html#ad8040331b08464a2a48b7ac8a00ed13c">drush_backend_set_result</a>($destination_dir);</div>
<div class="line"><a name="l00533"></a><span class="lineno">  533</span>&#160;</div>
<div class="line"><a name="l00534"></a><span class="lineno">  534</span>&#160;  <span class="comment">// Commit and push, or add exported configuration if requested.</span></div>
<div class="line"><a name="l00535"></a><span class="lineno">  535</span>&#160;  $remote = <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;push&#39;</span>, FALSE);</div>
<div class="line"><a name="l00536"></a><span class="lineno">  536</span>&#160;  <span class="keywordflow">if</span> ($commit || $remote) {</div>
<div class="line"><a name="l00537"></a><span class="lineno">  537</span>&#160;    <span class="comment">// There must be changed files at the destination dir; if there are not, then</span></div>
<div class="line"><a name="l00538"></a><span class="lineno">  538</span>&#160;    <span class="comment">// we will skip the commit-and-push step</span></div>
<div class="line"><a name="l00539"></a><span class="lineno">  539</span>&#160;    $result = <a class="code" href="group__commandwrappers.html#ga59e8ee9f53442f2029080ac723ed008f">drush_shell_cd_and_exec</a>($destination_dir, <span class="stringliteral">&#39;git status --porcelain .&#39;</span>);</div>
<div class="line"><a name="l00540"></a><span class="lineno">  540</span>&#160;    <span class="keywordflow">if</span> (!$result) {</div>
<div class="line"><a name="l00541"></a><span class="lineno">  541</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;DRUSH_CONFIG_EXPORT_FAILURE&#39;</span>, <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&quot;`git status` failed.&quot;</span>));</div>
<div class="line"><a name="l00542"></a><span class="lineno">  542</span>&#160;    }</div>
<div class="line"><a name="l00543"></a><span class="lineno">  543</span>&#160;    $uncommitted_changes = <a class="code" href="group__commandwrappers.html#gadba8c59ba260dd39f615bc22ca78e1af">drush_shell_exec_output</a>();</div>
<div class="line"><a name="l00544"></a><span class="lineno">  544</span>&#160;    <span class="keywordflow">if</span> (!empty($uncommitted_changes)) {</div>
<div class="line"><a name="l00545"></a><span class="lineno">  545</span>&#160;      $result = <a class="code" href="group__commandwrappers.html#ga59e8ee9f53442f2029080ac723ed008f">drush_shell_cd_and_exec</a>($destination_dir, <span class="stringliteral">&#39;git add -A .&#39;</span>);</div>
<div class="line"><a name="l00546"></a><span class="lineno">  546</span>&#160;      <span class="keywordflow">if</span> (!$result) {</div>
<div class="line"><a name="l00547"></a><span class="lineno">  547</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;DRUSH_CONFIG_EXPORT_FAILURE&#39;</span>, <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&quot;`git add -A` failed.&quot;</span>));</div>
<div class="line"><a name="l00548"></a><span class="lineno">  548</span>&#160;      }</div>
<div class="line"><a name="l00549"></a><span class="lineno">  549</span>&#160;      $comment_file = <a class="code" href="group__filesystemfunctions.html#gadb66635fa63012fb084f8e96a392776d">drush_save_data_to_temp_file</a>($comment);</div>
<div class="line"><a name="l00550"></a><span class="lineno">  550</span>&#160;      $result = <a class="code" href="group__commandwrappers.html#ga59e8ee9f53442f2029080ac723ed008f">drush_shell_cd_and_exec</a>($destination_dir, <span class="stringliteral">&#39;git commit --file=%s&#39;</span>, $comment_file);</div>
<div class="line"><a name="l00551"></a><span class="lineno">  551</span>&#160;      <span class="keywordflow">if</span> (!$result) {</div>
<div class="line"><a name="l00552"></a><span class="lineno">  552</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;DRUSH_CONFIG_EXPORT_FAILURE&#39;</span>, <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&quot;`git commit` failed.  Output:\n\n!output&quot;</span>, array(<span class="stringliteral">&#39;!output&#39;</span> =&gt; implode(<span class="stringliteral">&quot;\n&quot;</span>, <a class="code" href="group__commandwrappers.html#gadba8c59ba260dd39f615bc22ca78e1af">drush_shell_exec_output</a>()))));</div>
<div class="line"><a name="l00553"></a><span class="lineno">  553</span>&#160;      }</div>
<div class="line"><a name="l00554"></a><span class="lineno">  554</span>&#160;      <span class="keywordflow">if</span> ($remote) {</div>
<div class="line"><a name="l00555"></a><span class="lineno">  555</span>&#160;        <span class="comment">// Remote might be FALSE, if --push was not specified, or</span></div>
<div class="line"><a name="l00556"></a><span class="lineno">  556</span>&#160;        <span class="comment">// it might be TRUE if --push was not given a value.</span></div>
<div class="line"><a name="l00557"></a><span class="lineno">  557</span>&#160;        <span class="keywordflow">if</span> (!is_string($remote)) {</div>
<div class="line"><a name="l00558"></a><span class="lineno">  558</span>&#160;          $remote = <span class="stringliteral">&#39;origin&#39;</span>;</div>
<div class="line"><a name="l00559"></a><span class="lineno">  559</span>&#160;        }</div>
<div class="line"><a name="l00560"></a><span class="lineno">  560</span>&#160;        $result = <a class="code" href="group__commandwrappers.html#ga59e8ee9f53442f2029080ac723ed008f">drush_shell_cd_and_exec</a>($destination_dir, <span class="stringliteral">&#39;git push --set-upstream %s %s&#39;</span>, $remote, $branch);</div>
<div class="line"><a name="l00561"></a><span class="lineno">  561</span>&#160;        <span class="keywordflow">if</span> (!$result) {</div>
<div class="line"><a name="l00562"></a><span class="lineno">  562</span>&#160;          <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;DRUSH_CONFIG_EXPORT_FAILURE&#39;</span>, <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&quot;`git push` failed.&quot;</span>));</div>
<div class="line"><a name="l00563"></a><span class="lineno">  563</span>&#160;        }</div>
<div class="line"><a name="l00564"></a><span class="lineno">  564</span>&#160;      }</div>
<div class="line"><a name="l00565"></a><span class="lineno">  565</span>&#160;    }</div>
<div class="line"><a name="l00566"></a><span class="lineno">  566</span>&#160;  }</div>
<div class="line"><a name="l00567"></a><span class="lineno">  567</span>&#160;  elseif (<a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;add&#39;</span>)) {</div>
<div class="line"><a name="l00568"></a><span class="lineno">  568</span>&#160;    <a class="code" href="group__commandwrappers.html#gad0b72e62d81d339d68dc2d3d36db75d6">drush_shell_exec_interactive</a>(<span class="stringliteral">&#39;git add -p %s&#39;</span>, $destination_dir);</div>
<div class="line"><a name="l00569"></a><span class="lineno">  569</span>&#160;  }</div>
<div class="line"><a name="l00570"></a><span class="lineno">  570</span>&#160;</div>
<div class="line"><a name="l00571"></a><span class="lineno">  571</span>&#160;  $values = array(</div>
<div class="line"><a name="l00572"></a><span class="lineno">  572</span>&#160;    <span class="stringliteral">&#39;destination&#39;</span> =&gt; $destination_dir,</div>
<div class="line"><a name="l00573"></a><span class="lineno">  573</span>&#160;  );</div>
<div class="line"><a name="l00574"></a><span class="lineno">  574</span>&#160;  <span class="keywordflow">return</span> $values;</div>
<div class="line"><a name="l00575"></a><span class="lineno">  575</span>&#160;}</div>
<div class="line"><a name="l00576"></a><span class="lineno">  576</span>&#160;</div>
<div class="line"><a name="l00577"></a><span class="lineno">  577</span>&#160;<span class="keyword">function</span> drush_config_import_validate() {</div>
<div class="line"><a name="l00578"></a><span class="lineno">  578</span>&#160;  <a class="code" href="engines_8inc.html#a92390a2dd40c8ed5190be4af058813a8">drush_include_engine</a>(<span class="stringliteral">&#39;drupal&#39;</span>, <span class="stringliteral">&#39;environment&#39;</span>);</div>
<div class="line"><a name="l00579"></a><span class="lineno">  579</span>&#160;  <span class="keywordflow">if</span> (<a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;partial&#39;</span>) &amp;&amp; !<a class="code" href="commands_2core_2drupal_2environment_8inc.html#a643d851fd8dc63ea2ce8cf67aa33098c">drush_module_exists</a>(<span class="stringliteral">&#39;config&#39;</span>)) {</div>
<div class="line"><a name="l00580"></a><span class="lineno">  580</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;config_import_partial&#39;</span>, <span class="stringliteral">&#39;Enable the config module in order to use the --partial option.&#39;</span>);</div>
<div class="line"><a name="l00581"></a><span class="lineno">  581</span>&#160;  }</div>
<div class="line"><a name="l00582"></a><span class="lineno">  582</span>&#160;  </div>
<div class="line"><a name="l00583"></a><span class="lineno">  583</span>&#160;  <span class="keywordflow">if</span> ($source = <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;source&#39;</span>)) {</div>
<div class="line"><a name="l00584"></a><span class="lineno">  584</span>&#160;    <span class="keywordflow">if</span> (!file_exists($source)) {</div>
<div class="line"><a name="l00585"></a><span class="lineno">  585</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;config_import_target&#39;</span>, <span class="stringliteral">&#39;The source directory does not exist.&#39;</span>);</div>
<div class="line"><a name="l00586"></a><span class="lineno">  586</span>&#160;    }</div>
<div class="line"><a name="l00587"></a><span class="lineno">  587</span>&#160;    <span class="keywordflow">if</span> (!is_dir($source)) {</div>
<div class="line"><a name="l00588"></a><span class="lineno">  588</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;config_import_target&#39;</span>, <span class="stringliteral">&#39;The source is not a directory.&#39;</span>);</div>
<div class="line"><a name="l00589"></a><span class="lineno">  589</span>&#160;    }</div>
<div class="line"><a name="l00590"></a><span class="lineno">  590</span>&#160;  }</div>
<div class="line"><a name="l00591"></a><span class="lineno">  591</span>&#160;}</div>
<div class="line"><a name="l00592"></a><span class="lineno">  592</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00593"></a><span class="lineno">  593</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00594"></a><span class="lineno">  594</span>&#160;<span class="comment"> * Presently, the only configuration storage filter that is supported</span></div>
<div class="line"><a name="l00595"></a><span class="lineno">  595</span>&#160;<span class="comment"> * is the &#39;CoreExtensionFilter&#39;.  If other use cases arise that are</span></div>
<div class="line"><a name="l00596"></a><span class="lineno">  596</span>&#160;<span class="comment"> * not supported by Drupal&#39;s configuration override system, then we</span></div>
<div class="line"><a name="l00597"></a><span class="lineno">  597</span>&#160;<span class="comment"> * could add a hook here via drush_command_invoke_all(&#39;drush_storage_filters&#39;);</span></div>
<div class="line"><a name="l00598"></a><span class="lineno">  598</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00599"></a><span class="lineno">  599</span>&#160;<span class="comment"> * See: https://github.com/drush-ops/drush/pull/1522</span></div>
<div class="line"><a name="l00600"></a><span class="lineno">  600</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00601"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#a86087713cd7d19b7a78e277dab06c694">  601</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#a86087713cd7d19b7a78e277dab06c694">drush_config_get_storage_filters</a>() {</div>
<div class="line"><a name="l00602"></a><span class="lineno">  602</span>&#160;  $result = array();</div>
<div class="line"><a name="l00603"></a><span class="lineno">  603</span>&#160;  $module_adjustments = <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;skip-modules&#39;</span>);</div>
<div class="line"><a name="l00604"></a><span class="lineno">  604</span>&#160;  <span class="keywordflow">if</span> (!empty($module_adjustments)) {</div>
<div class="line"><a name="l00605"></a><span class="lineno">  605</span>&#160;    <span class="keywordflow">if</span> (is_string($module_adjustments)) {</div>
<div class="line"><a name="l00606"></a><span class="lineno">  606</span>&#160;      $module_adjustments = explode(<span class="charliteral">&#39;,&#39;</span>, $module_adjustments);</div>
<div class="line"><a name="l00607"></a><span class="lineno">  607</span>&#160;    }</div>
<div class="line"><a name="l00608"></a><span class="lineno">  608</span>&#160;    $result[] = <span class="keyword">new</span> <a class="code" href="classDrush_1_1Config_1_1CoreExtensionFilter.html">CoreExtensionFilter</a>($module_adjustments);</div>
<div class="line"><a name="l00609"></a><span class="lineno">  609</span>&#160;  }</div>
<div class="line"><a name="l00610"></a><span class="lineno">  610</span>&#160;  <span class="keywordflow">return</span> $result;</div>
<div class="line"><a name="l00611"></a><span class="lineno">  611</span>&#160;}</div>
<div class="line"><a name="l00612"></a><span class="lineno">  612</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00613"></a><span class="lineno">  613</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00614"></a><span class="lineno">  614</span>&#160;<span class="comment"> * Command callback. Import from specified config directory (defaults to sync).</span></div>
<div class="line"><a name="l00615"></a><span class="lineno">  615</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00616"></a><span class="lineno">  616</span>&#160;<span class="keyword">function</span> drush_config_import($source = NULL) {</div>
<div class="line"><a name="l00617"></a><span class="lineno">  617</span>&#160;  global $config_directories;</div>
<div class="line"><a name="l00618"></a><span class="lineno">  618</span>&#160;</div>
<div class="line"><a name="l00619"></a><span class="lineno">  619</span>&#160;  <span class="comment">// Determine source directory.</span></div>
<div class="line"><a name="l00620"></a><span class="lineno">  620</span>&#160;  <span class="keywordflow">if</span> ($target = <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;source&#39;</span>)) {</div>
<div class="line"><a name="l00621"></a><span class="lineno">  621</span>&#160;    $source_dir = $target;</div>
<div class="line"><a name="l00622"></a><span class="lineno">  622</span>&#160;  }</div>
<div class="line"><a name="l00623"></a><span class="lineno">  623</span>&#160;  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00624"></a><span class="lineno">  624</span>&#160;    $choices = <a class="code" href="drush_8inc.html#ad847f03f1d1c046f9eb472aafa56137c">drush_map_assoc</a>(array_keys($config_directories));</div>
<div class="line"><a name="l00625"></a><span class="lineno">  625</span>&#160;    unset($choices[CONFIG_ACTIVE_DIRECTORY]);</div>
<div class="line"><a name="l00626"></a><span class="lineno">  626</span>&#160;    <span class="keywordflow">if</span> (!isset($source) &amp;&amp; count($choices) &gt;= 2) {</div>
<div class="line"><a name="l00627"></a><span class="lineno">  627</span>&#160;      $source= <a class="code" href="group__userinput.html#ga7e823bcd58051b17e6e5601340f0c784">drush_choice</a>($choices, <span class="stringliteral">&#39;Choose a source.&#39;</span>);</div>
<div class="line"><a name="l00628"></a><span class="lineno">  628</span>&#160;      <span class="keywordflow">if</span> (empty($source)) {</div>
<div class="line"><a name="l00629"></a><span class="lineno">  629</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga366aaafdf8c774a58653c64a65b6d91c">drush_user_abort</a>();</div>
<div class="line"><a name="l00630"></a><span class="lineno">  630</span>&#160;      }</div>
<div class="line"><a name="l00631"></a><span class="lineno">  631</span>&#160;    }</div>
<div class="line"><a name="l00632"></a><span class="lineno">  632</span>&#160;    elseif (!isset($source)) {</div>
<div class="line"><a name="l00633"></a><span class="lineno">  633</span>&#160;      $source = CONFIG_SYNC_DIRECTORY;</div>
<div class="line"><a name="l00634"></a><span class="lineno">  634</span>&#160;    }</div>
<div class="line"><a name="l00635"></a><span class="lineno">  635</span>&#160;    $source_dir = config_get_config_directory($source);</div>
<div class="line"><a name="l00636"></a><span class="lineno">  636</span>&#160;  }</div>
<div class="line"><a name="l00637"></a><span class="lineno">  637</span>&#160;</div>
<div class="line"><a name="l00638"></a><span class="lineno">  638</span>&#160;  <span class="comment">// Determine $source_storage in partial and non-partial cases.</span><span class="comment"></span></div>
<div class="line"><a name="l00639"></a><span class="lineno">  639</span>&#160;<span class="comment">  /** @var \Drupal\Core\Config\StorageInterface $active_storage */</span></div>
<div class="line"><a name="l00640"></a><span class="lineno">  640</span>&#160;  $active_storage = \Drupal::service(<span class="stringliteral">&#39;config.storage&#39;</span>);</div>
<div class="line"><a name="l00641"></a><span class="lineno">  641</span>&#160;  <span class="keywordflow">if</span> (<a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;partial&#39;</span>)) {</div>
<div class="line"><a name="l00642"></a><span class="lineno">  642</span>&#160;    $source_storage = <span class="keyword">new</span> StorageReplaceDataWrapper($active_storage);</div>
<div class="line"><a name="l00643"></a><span class="lineno">  643</span>&#160;    $file_storage = <span class="keyword">new</span> FileStorage($source_dir);</div>
<div class="line"><a name="l00644"></a><span class="lineno">  644</span>&#160;    <span class="keywordflow">foreach</span> ($file_storage-&gt;listAll() as $name) {</div>
<div class="line"><a name="l00645"></a><span class="lineno">  645</span>&#160;      $data = $file_storage-&gt;read($name);</div>
<div class="line"><a name="l00646"></a><span class="lineno">  646</span>&#160;      $source_storage-&gt;replaceData($name, $data);</div>
<div class="line"><a name="l00647"></a><span class="lineno">  647</span>&#160;    }</div>
<div class="line"><a name="l00648"></a><span class="lineno">  648</span>&#160;  }</div>
<div class="line"><a name="l00649"></a><span class="lineno">  649</span>&#160;  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00650"></a><span class="lineno">  650</span>&#160;    $source_storage = <span class="keyword">new</span> FileStorage($source_dir);</div>
<div class="line"><a name="l00651"></a><span class="lineno">  651</span>&#160;  }</div>
<div class="line"><a name="l00652"></a><span class="lineno">  652</span>&#160;</div>
<div class="line"><a name="l00653"></a><span class="lineno">  653</span>&#160;  <span class="comment">// If our configuration storage is being filtered, then attach all filters</span></div>
<div class="line"><a name="l00654"></a><span class="lineno">  654</span>&#160;  <span class="comment">// to the source storage object.  We will use the filtered values uniformly</span></div>
<div class="line"><a name="l00655"></a><span class="lineno">  655</span>&#160;  <span class="comment">// for comparison, full imports, and partial imports.</span></div>
<div class="line"><a name="l00656"></a><span class="lineno">  656</span>&#160;  $storage_filters = <a class="code" href="config_8drush_8inc.html#a86087713cd7d19b7a78e277dab06c694">drush_config_get_storage_filters</a>();</div>
<div class="line"><a name="l00657"></a><span class="lineno">  657</span>&#160;  <span class="keywordflow">if</span> (!empty($storage_filters)) {</div>
<div class="line"><a name="l00658"></a><span class="lineno">  658</span>&#160;    $source_storage = <span class="keyword">new</span> <a class="code" href="classDrush_1_1Config_1_1StorageWrapper.html">StorageWrapper</a>($source_storage, $storage_filters);</div>
<div class="line"><a name="l00659"></a><span class="lineno">  659</span>&#160;  }</div>
<div class="line"><a name="l00660"></a><span class="lineno">  660</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00661"></a><span class="lineno">  661</span>&#160;<span class="comment">  /** @var \Drupal\Core\Config\ConfigManagerInterface $config_manager */</span></div>
<div class="line"><a name="l00662"></a><span class="lineno">  662</span>&#160;  $config_manager = \Drupal::service(<span class="stringliteral">&#39;config.manager&#39;</span>);</div>
<div class="line"><a name="l00663"></a><span class="lineno">  663</span>&#160;  $storage_comparer = <span class="keyword">new</span> StorageComparer($source_storage, $active_storage, $config_manager);</div>
<div class="line"><a name="l00664"></a><span class="lineno">  664</span>&#160;</div>
<div class="line"><a name="l00665"></a><span class="lineno">  665</span>&#160;</div>
<div class="line"><a name="l00666"></a><span class="lineno">  666</span>&#160;  <span class="keywordflow">if</span> (!$storage_comparer-&gt;createChangelist()-&gt;hasChanges()) {</div>
<div class="line"><a name="l00667"></a><span class="lineno">  667</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="group__logging.html#ga47324b65808524558a488916b150dd51">drush_log</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;There are no changes to import.&#39;</span>), LogLevel::OK);</div>
<div class="line"><a name="l00668"></a><span class="lineno">  668</span>&#160;  }</div>
<div class="line"><a name="l00669"></a><span class="lineno">  669</span>&#160;</div>
<div class="line"><a name="l00670"></a><span class="lineno">  670</span>&#160;  <span class="keywordflow">if</span> (<a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;preview&#39;</span>, <span class="stringliteral">&#39;list&#39;</span>) == <span class="stringliteral">&#39;list&#39;</span>) {</div>
<div class="line"><a name="l00671"></a><span class="lineno">  671</span>&#160;    $change_list = array();</div>
<div class="line"><a name="l00672"></a><span class="lineno">  672</span>&#160;    <span class="keywordflow">foreach</span> ($storage_comparer-&gt;getAllCollectionNames() as $collection) {</div>
<div class="line"><a name="l00673"></a><span class="lineno">  673</span>&#160;      $change_list[$collection] = $storage_comparer-&gt;getChangelist(NULL, $collection);</div>
<div class="line"><a name="l00674"></a><span class="lineno">  674</span>&#160;    }</div>
<div class="line"><a name="l00675"></a><span class="lineno">  675</span>&#160;    <a class="code" href="config_8drush_8inc.html#a2c365bd279e012b6b071723297bf10f3">_drush_print_config_changes_table</a>($change_list);</div>
<div class="line"><a name="l00676"></a><span class="lineno">  676</span>&#160;  }</div>
<div class="line"><a name="l00677"></a><span class="lineno">  677</span>&#160;  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00678"></a><span class="lineno">  678</span>&#160;    <span class="comment">// Copy active storage to the temporary directory.</span></div>
<div class="line"><a name="l00679"></a><span class="lineno">  679</span>&#160;    $temp_dir = <a class="code" href="group__filesystemfunctions.html#ga883d28ed54603b2d268902cec2379804">drush_tempdir</a>();</div>
<div class="line"><a name="l00680"></a><span class="lineno">  680</span>&#160;    $temp_storage = <span class="keyword">new</span> FileStorage($temp_dir);</div>
<div class="line"><a name="l00681"></a><span class="lineno">  681</span>&#160;    $source_dir_storage = <span class="keyword">new</span> FileStorage($source_dir);</div>
<div class="line"><a name="l00682"></a><span class="lineno">  682</span>&#160;    <span class="keywordflow">foreach</span> ($source_dir_storage-&gt;listAll() as $name) {</div>
<div class="line"><a name="l00683"></a><span class="lineno">  683</span>&#160;      <span class="keywordflow">if</span> ($data = $active_storage-&gt;read($name)) {</div>
<div class="line"><a name="l00684"></a><span class="lineno">  684</span>&#160;        $temp_storage-&gt;write($name, $data);</div>
<div class="line"><a name="l00685"></a><span class="lineno">  685</span>&#160;      }</div>
<div class="line"><a name="l00686"></a><span class="lineno">  686</span>&#160;    }</div>
<div class="line"><a name="l00687"></a><span class="lineno">  687</span>&#160;    <a class="code" href="group__commandwrappers.html#gafd358ceac1286dbdd141ff2b8eb7d556">drush_shell_exec</a>(<span class="stringliteral">&#39;diff -x %s -u %s %s&#39;</span>, <span class="stringliteral">&#39;*.git&#39;</span>, $temp_dir, $source_dir);</div>
<div class="line"><a name="l00688"></a><span class="lineno">  688</span>&#160;    $output = <a class="code" href="group__commandwrappers.html#gadba8c59ba260dd39f615bc22ca78e1af">drush_shell_exec_output</a>();</div>
<div class="line"><a name="l00689"></a><span class="lineno">  689</span>&#160;    <a class="code" href="group__outputfunctions.html#ga63acbb94925d6d2693e235e966bba740">drush_print</a>(implode(<span class="stringliteral">&quot;\n&quot;</span>, $output));</div>
<div class="line"><a name="l00690"></a><span class="lineno">  690</span>&#160;  }</div>
<div class="line"><a name="l00691"></a><span class="lineno">  691</span>&#160;</div>
<div class="line"><a name="l00692"></a><span class="lineno">  692</span>&#160;  <span class="keywordflow">if</span> (<a class="code" href="group__userinput.html#gaa4169b83ff9dc4222af95d376b21268b">drush_confirm</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Import the listed configuration changes?&#39;</span>))) {</div>
<div class="line"><a name="l00693"></a><span class="lineno">  693</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="drush_8inc.html#acebe9ed4e4825e6d33ab8dff2157b676">drush_op</a>(<span class="stringliteral">&#39;_drush_config_import&#39;</span>, $storage_comparer);</div>
<div class="line"><a name="l00694"></a><span class="lineno">  694</span>&#160;  }</div>
<div class="line"><a name="l00695"></a><span class="lineno">  695</span>&#160;}</div>
<div class="line"><a name="l00696"></a><span class="lineno">  696</span>&#160;</div>
<div class="line"><a name="l00697"></a><span class="lineno">  697</span>&#160;<span class="comment">// Copied from submitForm() at /core/modules/config/src/Form/ConfigSync.php</span></div>
<div class="line"><a name="l00698"></a><span class="lineno">  698</span>&#160;<span class="keyword">function</span> _drush_config_import(StorageComparer $storage_comparer) {</div>
<div class="line"><a name="l00699"></a><span class="lineno">  699</span>&#160;  $config_importer = <span class="keyword">new</span> ConfigImporter(</div>
<div class="line"><a name="l00700"></a><span class="lineno">  700</span>&#160;    $storage_comparer,</div>
<div class="line"><a name="l00701"></a><span class="lineno">  701</span>&#160;    \Drupal::service(<span class="stringliteral">&#39;event_dispatcher&#39;</span>),</div>
<div class="line"><a name="l00702"></a><span class="lineno">  702</span>&#160;    \Drupal::service(<span class="stringliteral">&#39;config.manager&#39;</span>),</div>
<div class="line"><a name="l00703"></a><span class="lineno">  703</span>&#160;    \Drupal::lock(),</div>
<div class="line"><a name="l00704"></a><span class="lineno">  704</span>&#160;    \Drupal::service(<span class="stringliteral">&#39;config.typed&#39;</span>),</div>
<div class="line"><a name="l00705"></a><span class="lineno">  705</span>&#160;    \Drupal::moduleHandler(),</div>
<div class="line"><a name="l00706"></a><span class="lineno">  706</span>&#160;    \Drupal::service(<span class="stringliteral">&#39;module_installer&#39;</span>),</div>
<div class="line"><a name="l00707"></a><span class="lineno">  707</span>&#160;    \Drupal::service(<span class="stringliteral">&#39;theme_handler&#39;</span>),</div>
<div class="line"><a name="l00708"></a><span class="lineno">  708</span>&#160;    \Drupal::service(<span class="stringliteral">&#39;string_translation&#39;</span>)</div>
<div class="line"><a name="l00709"></a><span class="lineno">  709</span>&#160;  );</div>
<div class="line"><a name="l00710"></a><span class="lineno">  710</span>&#160;  <span class="keywordflow">if</span> ($config_importer-&gt;alreadyImporting()) {</div>
<div class="line"><a name="l00711"></a><span class="lineno">  711</span>&#160;    <a class="code" href="group__logging.html#ga47324b65808524558a488916b150dd51">drush_log</a>(<span class="stringliteral">&#39;Another request may be synchronizing configuration already.&#39;</span>, LogLevel::WARNING);</div>
<div class="line"><a name="l00712"></a><span class="lineno">  712</span>&#160;  }</div>
<div class="line"><a name="l00713"></a><span class="lineno">  713</span>&#160;  <span class="keywordflow">else</span>{</div>
<div class="line"><a name="l00714"></a><span class="lineno">  714</span>&#160;    <span class="keywordflow">try</span> {</div>
<div class="line"><a name="l00715"></a><span class="lineno">  715</span>&#160;      $config_importer-&gt;import();</div>
<div class="line"><a name="l00716"></a><span class="lineno">  716</span>&#160;      <a class="code" href="group__logging.html#ga47324b65808524558a488916b150dd51">drush_log</a>(<span class="stringliteral">&#39;The configuration was imported successfully.&#39;</span>, LogLevel::SUCCESS);</div>
<div class="line"><a name="l00717"></a><span class="lineno">  717</span>&#160;    }</div>
<div class="line"><a name="l00718"></a><span class="lineno">  718</span>&#160;    <span class="keywordflow">catch</span> (ConfigException $e) {</div>
<div class="line"><a name="l00719"></a><span class="lineno">  719</span>&#160;      <span class="comment">// Return a negative result for UI purposes. We do not differentiate</span></div>
<div class="line"><a name="l00720"></a><span class="lineno">  720</span>&#160;      <span class="comment">// between an actual synchronization error and a failed lock, because</span></div>
<div class="line"><a name="l00721"></a><span class="lineno">  721</span>&#160;      <span class="comment">// concurrent synchronizations are an edge-case happening only when</span></div>
<div class="line"><a name="l00722"></a><span class="lineno">  722</span>&#160;      <span class="comment">// multiple developers or site builders attempt to do it without</span></div>
<div class="line"><a name="l00723"></a><span class="lineno">  723</span>&#160;      <span class="comment">// coordinating.</span></div>
<div class="line"><a name="l00724"></a><span class="lineno">  724</span>&#160;      $message = <span class="stringliteral">&#39;The import failed due for the following reasons:&#39;</span> . <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a name="l00725"></a><span class="lineno">  725</span>&#160;      $message .= implode(<span class="stringliteral">&quot;\n&quot;</span>, $config_importer-&gt;getErrors());</div>
<div class="line"><a name="l00726"></a><span class="lineno">  726</span>&#160;</div>
<div class="line"><a name="l00727"></a><span class="lineno">  727</span>&#160;      watchdog_exception(<span class="stringliteral">&#39;config_import&#39;</span>, $e);</div>
<div class="line"><a name="l00728"></a><span class="lineno">  728</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;config_import_fail&#39;</span>, $message);</div>
<div class="line"><a name="l00729"></a><span class="lineno">  729</span>&#160;    }</div>
<div class="line"><a name="l00730"></a><span class="lineno">  730</span>&#160;  }</div>
<div class="line"><a name="l00731"></a><span class="lineno">  731</span>&#160;}</div>
<div class="line"><a name="l00732"></a><span class="lineno">  732</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00733"></a><span class="lineno">  733</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00734"></a><span class="lineno">  734</span>&#160;<span class="comment"> * Edit command callback.</span></div>
<div class="line"><a name="l00735"></a><span class="lineno">  735</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00736"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#ad72fddd99c71a1a854d36dd81e1a80f1">  736</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#ad72fddd99c71a1a854d36dd81e1a80f1">drush_config_edit</a>($config_name = <span class="stringliteral">&#39;&#39;</span>) {</div>
<div class="line"><a name="l00737"></a><span class="lineno">  737</span>&#160;  <span class="comment">// Identify and validate input.</span></div>
<div class="line"><a name="l00738"></a><span class="lineno">  738</span>&#160;  <span class="keywordflow">if</span> ($config_name) {</div>
<div class="line"><a name="l00739"></a><span class="lineno">  739</span>&#160;    $config = \Drupal::configFactory()-&gt;get($config_name);</div>
<div class="line"><a name="l00740"></a><span class="lineno">  740</span>&#160;    <span class="keywordflow">if</span> ($config-&gt;isNew()) {</div>
<div class="line"><a name="l00741"></a><span class="lineno">  741</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Config !name does not exist&#39;</span>, array(<span class="stringliteral">&#39;!name&#39;</span> =&gt; $config_name)));</div>
<div class="line"><a name="l00742"></a><span class="lineno">  742</span>&#160;    }</div>
<div class="line"><a name="l00743"></a><span class="lineno">  743</span>&#160;  }</div>
<div class="line"><a name="l00744"></a><span class="lineno">  744</span>&#160;  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00745"></a><span class="lineno">  745</span>&#160;    $config_names = \Drupal::configFactory()-&gt;listAll();</div>
<div class="line"><a name="l00746"></a><span class="lineno">  746</span>&#160;    $choice = <a class="code" href="group__userinput.html#ga7e823bcd58051b17e6e5601340f0c784">drush_choice</a>($config_names, <span class="stringliteral">&#39;Choose a configuration.&#39;</span>);</div>
<div class="line"><a name="l00747"></a><span class="lineno">  747</span>&#160;    <span class="keywordflow">if</span> (empty($choice)) {</div>
<div class="line"><a name="l00748"></a><span class="lineno">  748</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga366aaafdf8c774a58653c64a65b6d91c">drush_user_abort</a>();</div>
<div class="line"><a name="l00749"></a><span class="lineno">  749</span>&#160;    }</div>
<div class="line"><a name="l00750"></a><span class="lineno">  750</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00751"></a><span class="lineno">  751</span>&#160;      $config_name = $config_names[$choice];</div>
<div class="line"><a name="l00752"></a><span class="lineno">  752</span>&#160;      $config = \Drupal::configFactory()-&gt;get($config_name);</div>
<div class="line"><a name="l00753"></a><span class="lineno">  753</span>&#160;    }</div>
<div class="line"><a name="l00754"></a><span class="lineno">  754</span>&#160;  }</div>
<div class="line"><a name="l00755"></a><span class="lineno">  755</span>&#160;</div>
<div class="line"><a name="l00756"></a><span class="lineno">  756</span>&#160;  $active_storage = $config-&gt;getStorage();</div>
<div class="line"><a name="l00757"></a><span class="lineno">  757</span>&#160;  $contents = $active_storage-&gt;read($config_name);</div>
<div class="line"><a name="l00758"></a><span class="lineno">  758</span>&#160;</div>
<div class="line"><a name="l00759"></a><span class="lineno">  759</span>&#160;  <span class="comment">// Write tmp YAML file for editing</span></div>
<div class="line"><a name="l00760"></a><span class="lineno">  760</span>&#160;  $temp_dir = <a class="code" href="group__filesystemfunctions.html#ga883d28ed54603b2d268902cec2379804">drush_tempdir</a>();</div>
<div class="line"><a name="l00761"></a><span class="lineno">  761</span>&#160;  $temp_storage = <span class="keyword">new</span> FileStorage($temp_dir);</div>
<div class="line"><a name="l00762"></a><span class="lineno">  762</span>&#160;  $temp_storage-&gt;write($config_name, $contents);</div>
<div class="line"><a name="l00763"></a><span class="lineno">  763</span>&#160;</div>
<div class="line"><a name="l00764"></a><span class="lineno">  764</span>&#160;  $exec = <a class="code" href="group__commandwrappers.html#ga516aab026be224e57d9fc0fe9c3de79f">drush_get_editor</a>();</div>
<div class="line"><a name="l00765"></a><span class="lineno">  765</span>&#160;  <a class="code" href="group__commandwrappers.html#gad0b72e62d81d339d68dc2d3d36db75d6">drush_shell_exec_interactive</a>($exec, $temp_storage-&gt;getFilePath($config_name));</div>
<div class="line"><a name="l00766"></a><span class="lineno">  766</span>&#160;</div>
<div class="line"><a name="l00767"></a><span class="lineno">  767</span>&#160;  <span class="comment">// Perform import operation if user did not immediately exit editor.</span></div>
<div class="line"><a name="l00768"></a><span class="lineno">  768</span>&#160;  <span class="keywordflow">if</span> (!<a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;bg&#39;</span>, FALSE)) {</div>
<div class="line"><a name="l00769"></a><span class="lineno">  769</span>&#160;    $options = <a class="code" href="group__dispatching.html#ga9b1a98376983ee529fc868ef4280b12d">drush_redispatch_get_options</a>() + array(<span class="stringliteral">&#39;partial&#39;</span> =&gt; TRUE, <span class="stringliteral">&#39;source&#39;</span> =&gt; $temp_dir);</div>
<div class="line"><a name="l00770"></a><span class="lineno">  770</span>&#160;    $backend_options = array(<span class="stringliteral">&#39;interactive&#39;</span> =&gt; TRUE);</div>
<div class="line"><a name="l00771"></a><span class="lineno">  771</span>&#160;    <span class="keywordflow">return</span> (<span class="keywordtype">bool</span>) <a class="code" href="group__dispatching.html#ga125471885af052278a0874446b332cf9">drush_invoke_process</a>(<span class="stringliteral">&#39;@self&#39;</span>, <span class="stringliteral">&#39;config-import&#39;</span>, array(), $options, $backend_options);</div>
<div class="line"><a name="l00772"></a><span class="lineno">  772</span>&#160;  }</div>
<div class="line"><a name="l00773"></a><span class="lineno">  773</span>&#160;}</div>
<div class="line"><a name="l00774"></a><span class="lineno">  774</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00775"></a><span class="lineno">  775</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00776"></a><span class="lineno">  776</span>&#160;<span class="comment"> * Config pull validate callback</span></div>
<div class="line"><a name="l00777"></a><span class="lineno">  777</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00778"></a><span class="lineno">  778</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00779"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#ab44e91740e7026f2d7f02bd365e8f702">  779</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#ab44e91740e7026f2d7f02bd365e8f702">drush_config_pull_validate</a>($source, $destination) {</div>
<div class="line"><a name="l00780"></a><span class="lineno">  780</span>&#160;  <span class="keywordflow">if</span> (<a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;safe&#39;</span>)) {</div>
<div class="line"><a name="l00781"></a><span class="lineno">  781</span>&#160;    $return = <a class="code" href="group__dispatching.html#ga125471885af052278a0874446b332cf9">drush_invoke_process</a>($destination, <span class="stringliteral">&#39;core-execute&#39;</span>, array(<span class="stringliteral">&#39;git diff --quiet&#39;</span>), array(<span class="stringliteral">&#39;escape&#39;</span> =&gt; 0));</div>
<div class="line"><a name="l00782"></a><span class="lineno">  782</span>&#160;    <span class="keywordflow">if</span> ($return[<span class="stringliteral">&#39;error_status&#39;</span>]) {</div>
<div class="line"><a name="l00783"></a><span class="lineno">  783</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;DRUSH_GIT_DIRTY&#39;</span>, <span class="stringliteral">&#39;There are uncommitted changes in your git working copy.&#39;</span>);</div>
<div class="line"><a name="l00784"></a><span class="lineno">  784</span>&#160;    }</div>
<div class="line"><a name="l00785"></a><span class="lineno">  785</span>&#160;  }</div>
<div class="line"><a name="l00786"></a><span class="lineno">  786</span>&#160;}</div>
<div class="line"><a name="l00787"></a><span class="lineno">  787</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00788"></a><span class="lineno">  788</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00789"></a><span class="lineno">  789</span>&#160;<span class="comment"> * Config pull command callback</span></div>
<div class="line"><a name="l00790"></a><span class="lineno">  790</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00791"></a><span class="lineno">  791</span>&#160;<span class="comment"> * @param string $label</span></div>
<div class="line"><a name="l00792"></a><span class="lineno">  792</span>&#160;<span class="comment"> *   The config label which receives the transferred files.</span></div>
<div class="line"><a name="l00793"></a><span class="lineno">  793</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00794"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#a1a6a43bcec612b34f954d1603e5ed27f">  794</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#a1a6a43bcec612b34f954d1603e5ed27f">drush_config_pull</a>($source, $destination) {</div>
<div class="line"><a name="l00795"></a><span class="lineno">  795</span>&#160;  <span class="comment">// @todo drush_redispatch_get_options() assumes you will execute same command. Not good.</span></div>
<div class="line"><a name="l00796"></a><span class="lineno">  796</span>&#160;  $global_options = <a class="code" href="group__dispatching.html#ga9b1a98376983ee529fc868ef4280b12d">drush_redispatch_get_options</a>() + array(</div>
<div class="line"><a name="l00797"></a><span class="lineno">  797</span>&#160;    <span class="stringliteral">&#39;strict&#39;</span> =&gt; 0,</div>
<div class="line"><a name="l00798"></a><span class="lineno">  798</span>&#160;  );</div>
<div class="line"><a name="l00799"></a><span class="lineno">  799</span>&#160;</div>
<div class="line"><a name="l00800"></a><span class="lineno">  800</span>&#160;  <span class="comment">// @todo If either call is made interactive, we don&#39;t get an $return[&#39;object&#39;] back.</span></div>
<div class="line"><a name="l00801"></a><span class="lineno">  801</span>&#160;  $backend_options = array(<span class="stringliteral">&#39;interactive&#39;</span> =&gt; FALSE);</div>
<div class="line"><a name="l00802"></a><span class="lineno">  802</span>&#160;  <span class="keywordflow">if</span> (<a class="code" href="context_8inc.html#ad25559f8d7d753f636fbeac347c29fc5">drush_get_context</a>(<span class="stringliteral">&#39;DRUSH_SIMULATE&#39;</span>)) {</div>
<div class="line"><a name="l00803"></a><span class="lineno">  803</span>&#160;    $backend_options[<span class="stringliteral">&#39;backend-simulate&#39;</span>] = TRUE;</div>
<div class="line"><a name="l00804"></a><span class="lineno">  804</span>&#160;  }</div>
<div class="line"><a name="l00805"></a><span class="lineno">  805</span>&#160;</div>
<div class="line"><a name="l00806"></a><span class="lineno">  806</span>&#160;  $export_options = array(</div>
<div class="line"><a name="l00807"></a><span class="lineno">  807</span>&#160;    <span class="comment">// Use the standard backup directory on Destination.</span></div>
<div class="line"><a name="l00808"></a><span class="lineno">  808</span>&#160;    <span class="stringliteral">&#39;destination&#39;</span> =&gt; TRUE,</div>
<div class="line"><a name="l00809"></a><span class="lineno">  809</span>&#160;  );</div>
<div class="line"><a name="l00810"></a><span class="lineno">  810</span>&#160;  <a class="code" href="group__logging.html#ga47324b65808524558a488916b150dd51">drush_log</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Starting to export configuration on Target.&#39;</span>), LogLevel::OK);</div>
<div class="line"><a name="l00811"></a><span class="lineno">  811</span>&#160;  $return = <a class="code" href="group__dispatching.html#ga125471885af052278a0874446b332cf9">drush_invoke_process</a>($source, <span class="stringliteral">&#39;config-export&#39;</span>, array(), $global_options + $export_options, $backend_options);</div>
<div class="line"><a name="l00812"></a><span class="lineno">  812</span>&#160;  <span class="keywordflow">if</span> ($return[<span class="stringliteral">&#39;error_status&#39;</span>]) {</div>
<div class="line"><a name="l00813"></a><span class="lineno">  813</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;DRUSH_CONFIG_PULL_EXPORT_FAILED&#39;</span>, <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Config-export failed.&#39;</span>));</div>
<div class="line"><a name="l00814"></a><span class="lineno">  814</span>&#160;  }</div>
<div class="line"><a name="l00815"></a><span class="lineno">  815</span>&#160;  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00816"></a><span class="lineno">  816</span>&#160;    <span class="comment">// Trailing slash assures that transfer files and not the containing dir.</span></div>
<div class="line"><a name="l00817"></a><span class="lineno">  817</span>&#160;    $export_path = $return[<span class="stringliteral">&#39;object&#39;</span>] . <span class="charliteral">&#39;/&#39;</span>;</div>
<div class="line"><a name="l00818"></a><span class="lineno">  818</span>&#160;  }</div>
<div class="line"><a name="l00819"></a><span class="lineno">  819</span>&#160;</div>
<div class="line"><a name="l00820"></a><span class="lineno">  820</span>&#160;  $rsync_options = array(</div>
<div class="line"><a name="l00821"></a><span class="lineno">  821</span>&#160;    <span class="stringliteral">&#39;remove-source-files&#39;</span> =&gt; TRUE,</div>
<div class="line"><a name="l00822"></a><span class="lineno">  822</span>&#160;    <span class="stringliteral">&#39;delete&#39;</span> =&gt; TRUE,</div>
<div class="line"><a name="l00823"></a><span class="lineno">  823</span>&#160;    <span class="stringliteral">&#39;exclude-paths&#39;</span> =&gt; <span class="stringliteral">&#39;.htaccess&#39;</span>,</div>
<div class="line"><a name="l00824"></a><span class="lineno">  824</span>&#160;    <span class="stringliteral">&#39;yes&#39;</span> =&gt; TRUE,  <span class="comment">// No need to prompt as destination is always the target config directory.</span></div>
<div class="line"><a name="l00825"></a><span class="lineno">  825</span>&#160;  );</div>
<div class="line"><a name="l00826"></a><span class="lineno">  826</span>&#160;  $label = <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;label&#39;</span>, <span class="stringliteral">&#39;sync&#39;</span>);</div>
<div class="line"><a name="l00827"></a><span class="lineno">  827</span>&#160;  $runner = <a class="code" href="sitealias_8inc.html#ac42d2a0685791a366aa50237ad0d7b8a">drush_get_runner</a>($source, $destination, <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;runner&#39;</span>, FALSE));</div>
<div class="line"><a name="l00828"></a><span class="lineno">  828</span>&#160;  <a class="code" href="group__logging.html#ga47324b65808524558a488916b150dd51">drush_log</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Starting to rsync configuration files from !source to !dest.&#39;</span>, array(<span class="stringliteral">&#39;!source&#39;</span> =&gt; $source, <span class="stringliteral">&#39;!dest&#39;</span> =&gt; $destination)), LogLevel::OK);</div>
<div class="line"><a name="l00829"></a><span class="lineno">  829</span>&#160;  <span class="comment">// This comment applies similarly to sql-sync&#39;s use of core-rsync.</span></div>
<div class="line"><a name="l00830"></a><span class="lineno">  830</span>&#160;  <span class="comment">// Since core-rsync is a strict-handling command and drush_invoke_process() puts options at end, we can&#39;t send along cli options to rsync.</span></div>
<div class="line"><a name="l00831"></a><span class="lineno">  831</span>&#160;  <span class="comment">// Alternatively, add options like --ssh-options to a site alias (usually on the machine that initiates the sql-sync).</span></div>
<div class="line"><a name="l00832"></a><span class="lineno">  832</span>&#160;  $return = <a class="code" href="group__dispatching.html#ga125471885af052278a0874446b332cf9">drush_invoke_process</a>($runner, <span class="stringliteral">&#39;core-rsync&#39;</span>, array(<span class="stringliteral">&quot;$source:$export_path&quot;</span>, <span class="stringliteral">&quot;$destination:%config-$label&quot;</span>), $rsync_options);</div>
<div class="line"><a name="l00833"></a><span class="lineno">  833</span>&#160;  <span class="keywordflow">if</span> ($return[<span class="stringliteral">&#39;error_status&#39;</span>]) {</div>
<div class="line"><a name="l00834"></a><span class="lineno">  834</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;DRUSH_CONFIG_PULL_RSYNC_FAILED&#39;</span>, <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Config-pull rsync failed.&#39;</span>));</div>
<div class="line"><a name="l00835"></a><span class="lineno">  835</span>&#160;  }</div>
<div class="line"><a name="l00836"></a><span class="lineno">  836</span>&#160;</div>
<div class="line"><a name="l00837"></a><span class="lineno">  837</span>&#160;  <a class="code" href="backend_8inc.html#ad8040331b08464a2a48b7ac8a00ed13c">drush_backend_set_result</a>($return[<span class="stringliteral">&#39;object&#39;</span>]);</div>
<div class="line"><a name="l00838"></a><span class="lineno">  838</span>&#160;}</div>
<div class="line"><a name="l00839"></a><span class="lineno">  839</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00840"></a><span class="lineno">  840</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00841"></a><span class="lineno">  841</span>&#160;<span class="comment"> * Show and return a config object</span></div>
<div class="line"><a name="l00842"></a><span class="lineno">  842</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00843"></a><span class="lineno">  843</span>&#160;<span class="comment"> * @param $config_name</span></div>
<div class="line"><a name="l00844"></a><span class="lineno">  844</span>&#160;<span class="comment"> *   The config object name.</span></div>
<div class="line"><a name="l00845"></a><span class="lineno">  845</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00846"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#ac1bfb8fb33a150037b4151fc96fdd413">  846</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#ac1bfb8fb33a150037b4151fc96fdd413">drush_config_get_object</a>($config_name) {</div>
<div class="line"><a name="l00847"></a><span class="lineno">  847</span>&#160;  $source = <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;source&#39;</span>, <span class="stringliteral">&#39;active&#39;</span>);</div>
<div class="line"><a name="l00848"></a><span class="lineno">  848</span>&#160;  $include_overridden = <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;include-overridden&#39;</span>, FALSE);</div>
<div class="line"><a name="l00849"></a><span class="lineno">  849</span>&#160;</div>
<div class="line"><a name="l00850"></a><span class="lineno">  850</span>&#160;  <span class="keywordflow">if</span> ($include_overridden) {</div>
<div class="line"><a name="l00851"></a><span class="lineno">  851</span>&#160;    <span class="comment">// Displaying overrides only applies to active storage.</span></div>
<div class="line"><a name="l00852"></a><span class="lineno">  852</span>&#160;    $config = \Drupal::config($config_name);</div>
<div class="line"><a name="l00853"></a><span class="lineno">  853</span>&#160;    $data = $config-&gt;get();</div>
<div class="line"><a name="l00854"></a><span class="lineno">  854</span>&#160;  }</div>
<div class="line"><a name="l00855"></a><span class="lineno">  855</span>&#160;  elseif ($source == <span class="stringliteral">&#39;active&#39;</span>) {</div>
<div class="line"><a name="l00856"></a><span class="lineno">  856</span>&#160;    $config = \Drupal::service(<span class="stringliteral">&#39;config.storage&#39;</span>);</div>
<div class="line"><a name="l00857"></a><span class="lineno">  857</span>&#160;    $data = $config-&gt;read($config_name);</div>
<div class="line"><a name="l00858"></a><span class="lineno">  858</span>&#160;  }</div>
<div class="line"><a name="l00859"></a><span class="lineno">  859</span>&#160;  elseif ($source == <span class="stringliteral">&#39;sync&#39;</span>) {</div>
<div class="line"><a name="l00860"></a><span class="lineno">  860</span>&#160;    $config = \Drupal::service(<span class="stringliteral">&#39;config.storage.sync&#39;</span>);</div>
<div class="line"><a name="l00861"></a><span class="lineno">  861</span>&#160;    $data = $config-&gt;read($config_name);</div>
<div class="line"><a name="l00862"></a><span class="lineno">  862</span>&#160;  }</div>
<div class="line"><a name="l00863"></a><span class="lineno">  863</span>&#160;  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00864"></a><span class="lineno">  864</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Unknown value !value for config source.&#39;</span>, array(<span class="stringliteral">&#39;!value&#39;</span> =&gt; $source)));</div>
<div class="line"><a name="l00865"></a><span class="lineno">  865</span>&#160;  }</div>
<div class="line"><a name="l00866"></a><span class="lineno">  866</span>&#160;</div>
<div class="line"><a name="l00867"></a><span class="lineno">  867</span>&#160;  <span class="keywordflow">if</span> ($data === FALSE) {</div>
<div class="line"><a name="l00868"></a><span class="lineno">  868</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Config !name does not exist in !source configuration.&#39;</span>, array(<span class="stringliteral">&#39;!name&#39;</span> =&gt; $config_name, <span class="stringliteral">&#39;!source&#39;</span> =&gt; $source)));</div>
<div class="line"><a name="l00869"></a><span class="lineno">  869</span>&#160;  }</div>
<div class="line"><a name="l00870"></a><span class="lineno">  870</span>&#160;  <span class="keywordflow">if</span> (empty($data)) {</div>
<div class="line"><a name="l00871"></a><span class="lineno">  871</span>&#160;    <a class="code" href="group__logging.html#ga47324b65808524558a488916b150dd51">drush_log</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Config !name exists but has no data.&#39;</span>, array(<span class="stringliteral">&#39;!name&#39;</span> =&gt; $config_name)), LogLevel::INFO);</div>
<div class="line"><a name="l00872"></a><span class="lineno">  872</span>&#160;    <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00873"></a><span class="lineno">  873</span>&#160;  }</div>
<div class="line"><a name="l00874"></a><span class="lineno">  874</span>&#160;  <span class="keywordflow">return</span> $data;</div>
<div class="line"><a name="l00875"></a><span class="lineno">  875</span>&#160;}</div>
<div class="line"><a name="l00876"></a><span class="lineno">  876</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00877"></a><span class="lineno">  877</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00878"></a><span class="lineno">  878</span>&#160;<span class="comment"> * Show and return a value from config system.</span></div>
<div class="line"><a name="l00879"></a><span class="lineno">  879</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00880"></a><span class="lineno">  880</span>&#160;<span class="comment"> * @param $config_name</span></div>
<div class="line"><a name="l00881"></a><span class="lineno">  881</span>&#160;<span class="comment"> *   The config name.</span></div>
<div class="line"><a name="l00882"></a><span class="lineno">  882</span>&#160;<span class="comment"> * @param $key</span></div>
<div class="line"><a name="l00883"></a><span class="lineno">  883</span>&#160;<span class="comment"> *   The config key.</span></div>
<div class="line"><a name="l00884"></a><span class="lineno">  884</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00885"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#a94f2786e14faf36d88449bef68350678">  885</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#a94f2786e14faf36d88449bef68350678">drush_config_get_value</a>($config_name, $key) {</div>
<div class="line"><a name="l00886"></a><span class="lineno">  886</span>&#160;  $data = <a class="code" href="config_8drush_8inc.html#ac1bfb8fb33a150037b4151fc96fdd413">drush_config_get_object</a>($config_name);</div>
<div class="line"><a name="l00887"></a><span class="lineno">  887</span>&#160;  $parts = explode(<span class="charliteral">&#39;.&#39;</span>, $key);</div>
<div class="line"><a name="l00888"></a><span class="lineno">  888</span>&#160;  <span class="keywordflow">if</span> (count($parts) == 1) {</div>
<div class="line"><a name="l00889"></a><span class="lineno">  889</span>&#160;    $value =  isset($data[$key]) ? $data[$key] : NULL;</div>
<div class="line"><a name="l00890"></a><span class="lineno">  890</span>&#160;  }</div>
<div class="line"><a name="l00891"></a><span class="lineno">  891</span>&#160;  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00892"></a><span class="lineno">  892</span>&#160;    $value = NestedArray::getValue($data, $parts, $key_exists);</div>
<div class="line"><a name="l00893"></a><span class="lineno">  893</span>&#160;    $value = $key_exists ? $value : NULL;</div>
<div class="line"><a name="l00894"></a><span class="lineno">  894</span>&#160;  }</div>
<div class="line"><a name="l00895"></a><span class="lineno">  895</span>&#160;</div>
<div class="line"><a name="l00896"></a><span class="lineno">  896</span>&#160;  $returns[$config_name . <span class="charliteral">&#39;:&#39;</span> . $key] = $value;</div>
<div class="line"><a name="l00897"></a><span class="lineno">  897</span>&#160;</div>
<div class="line"><a name="l00898"></a><span class="lineno">  898</span>&#160;  <span class="keywordflow">if</span> ($value === NULL) {</div>
<div class="line"><a name="l00899"></a><span class="lineno">  899</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;DRUSH_CONFIG_ERROR&#39;</span>, <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;No matching key found in !name config.&#39;</span>, array(<span class="stringliteral">&#39;!name&#39;</span> =&gt; $config_name)));</div>
<div class="line"><a name="l00900"></a><span class="lineno">  900</span>&#160;  }</div>
<div class="line"><a name="l00901"></a><span class="lineno">  901</span>&#160;  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00902"></a><span class="lineno">  902</span>&#160;    <span class="keywordflow">return</span> $returns;</div>
<div class="line"><a name="l00903"></a><span class="lineno">  903</span>&#160;  }</div>
<div class="line"><a name="l00904"></a><span class="lineno">  904</span>&#160;}</div>
<div class="line"><a name="l00905"></a><span class="lineno">  905</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00906"></a><span class="lineno">  906</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00907"></a><span class="lineno">  907</span>&#160;<span class="comment"> * Print a table of config changes.</span></div>
<div class="line"><a name="l00908"></a><span class="lineno">  908</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00909"></a><span class="lineno">  909</span>&#160;<span class="comment"> * @param array $config_changes</span></div>
<div class="line"><a name="l00910"></a><span class="lineno">  910</span>&#160;<span class="comment"> *   An array of changes keyed by collection.</span></div>
<div class="line"><a name="l00911"></a><span class="lineno">  911</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00912"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#a3649bb18873b9055257a791a73b126b1">  912</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#a3649bb18873b9055257a791a73b126b1">_drush_format_config_changes_table</a>(array $config_changes, $use_color = FALSE) {</div>
<div class="line"><a name="l00913"></a><span class="lineno">  913</span>&#160;  <span class="keywordflow">if</span> (!$use_color) {</div>
<div class="line"><a name="l00914"></a><span class="lineno">  914</span>&#160;    $red = <span class="stringliteral">&quot;%s&quot;</span>;</div>
<div class="line"><a name="l00915"></a><span class="lineno">  915</span>&#160;    $yellow = <span class="stringliteral">&quot;%s&quot;</span>;</div>
<div class="line"><a name="l00916"></a><span class="lineno">  916</span>&#160;    $green = <span class="stringliteral">&quot;%s&quot;</span>;</div>
<div class="line"><a name="l00917"></a><span class="lineno">  917</span>&#160;  }</div>
<div class="line"><a name="l00918"></a><span class="lineno">  918</span>&#160;  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00919"></a><span class="lineno">  919</span>&#160;    $red = <span class="stringliteral">&quot;\033[31;40m\033[1m%s\033[0m&quot;</span>;</div>
<div class="line"><a name="l00920"></a><span class="lineno">  920</span>&#160;    $yellow = <span class="stringliteral">&quot;\033[1;33;40m\033[1m%s\033[0m&quot;</span>;</div>
<div class="line"><a name="l00921"></a><span class="lineno">  921</span>&#160;    $green = <span class="stringliteral">&quot;\033[1;32;40m\033[1m%s\033[0m&quot;</span>;</div>
<div class="line"><a name="l00922"></a><span class="lineno">  922</span>&#160;  }</div>
<div class="line"><a name="l00923"></a><span class="lineno">  923</span>&#160;</div>
<div class="line"><a name="l00924"></a><span class="lineno">  924</span>&#160;  $rows = array();</div>
<div class="line"><a name="l00925"></a><span class="lineno">  925</span>&#160;  $rows[] = array(<span class="stringliteral">&#39;Collection&#39;</span>, <span class="stringliteral">&#39;Config&#39;</span>, <span class="stringliteral">&#39;Operation&#39;</span>);</div>
<div class="line"><a name="l00926"></a><span class="lineno">  926</span>&#160;  <span class="keywordflow">foreach</span> ($config_changes as $collection =&gt; $changes) {</div>
<div class="line"><a name="l00927"></a><span class="lineno">  927</span>&#160;    <span class="keywordflow">foreach</span> ($changes as $change =&gt; $configs) {</div>
<div class="line"><a name="l00928"></a><span class="lineno">  928</span>&#160;      <span class="keywordflow">switch</span> ($change) {</div>
<div class="line"><a name="l00929"></a><span class="lineno">  929</span>&#160;        <span class="keywordflow">case</span> <span class="stringliteral">&#39;delete&#39;</span>:</div>
<div class="line"><a name="l00930"></a><span class="lineno">  930</span>&#160;          $colour = $red;</div>
<div class="line"><a name="l00931"></a><span class="lineno">  931</span>&#160;          <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00932"></a><span class="lineno">  932</span>&#160;        <span class="keywordflow">case</span> <span class="stringliteral">&#39;update&#39;</span>:</div>
<div class="line"><a name="l00933"></a><span class="lineno">  933</span>&#160;          $colour = $yellow;</div>
<div class="line"><a name="l00934"></a><span class="lineno">  934</span>&#160;          <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00935"></a><span class="lineno">  935</span>&#160;        <span class="keywordflow">case</span> <span class="stringliteral">&#39;create&#39;</span>:</div>
<div class="line"><a name="l00936"></a><span class="lineno">  936</span>&#160;          $colour = $green;</div>
<div class="line"><a name="l00937"></a><span class="lineno">  937</span>&#160;          <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00938"></a><span class="lineno">  938</span>&#160;        <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l00939"></a><span class="lineno">  939</span>&#160;          $colour = <span class="stringliteral">&quot;%s&quot;</span>;</div>
<div class="line"><a name="l00940"></a><span class="lineno">  940</span>&#160;          <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00941"></a><span class="lineno">  941</span>&#160;      }</div>
<div class="line"><a name="l00942"></a><span class="lineno">  942</span>&#160;      <span class="keywordflow">foreach</span>($configs as $config) {</div>
<div class="line"><a name="l00943"></a><span class="lineno">  943</span>&#160;        $rows[] = array(</div>
<div class="line"><a name="l00944"></a><span class="lineno">  944</span>&#160;          $collection,</div>
<div class="line"><a name="l00945"></a><span class="lineno">  945</span>&#160;          $config,</div>
<div class="line"><a name="l00946"></a><span class="lineno">  946</span>&#160;          sprintf($colour, $change)</div>
<div class="line"><a name="l00947"></a><span class="lineno">  947</span>&#160;        );</div>
<div class="line"><a name="l00948"></a><span class="lineno">  948</span>&#160;      }</div>
<div class="line"><a name="l00949"></a><span class="lineno">  949</span>&#160;    }</div>
<div class="line"><a name="l00950"></a><span class="lineno">  950</span>&#160;  }</div>
<div class="line"><a name="l00951"></a><span class="lineno">  951</span>&#160;  $tbl = _drush_format_table($rows);</div>
<div class="line"><a name="l00952"></a><span class="lineno">  952</span>&#160;  <span class="keywordflow">return</span> $tbl;</div>
<div class="line"><a name="l00953"></a><span class="lineno">  953</span>&#160;}</div>
<div class="line"><a name="l00954"></a><span class="lineno">  954</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00955"></a><span class="lineno">  955</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00956"></a><span class="lineno">  956</span>&#160;<span class="comment"> * Print a table of config changes.</span></div>
<div class="line"><a name="l00957"></a><span class="lineno">  957</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00958"></a><span class="lineno">  958</span>&#160;<span class="comment"> * @param array $config_changes</span></div>
<div class="line"><a name="l00959"></a><span class="lineno">  959</span>&#160;<span class="comment"> *   An array of changes keyed by collection.</span></div>
<div class="line"><a name="l00960"></a><span class="lineno">  960</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00961"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#a2c365bd279e012b6b071723297bf10f3">  961</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#a2c365bd279e012b6b071723297bf10f3">_drush_print_config_changes_table</a>(array $config_changes) {</div>
<div class="line"><a name="l00962"></a><span class="lineno">  962</span>&#160;  $tbl =  <a class="code" href="config_8drush_8inc.html#a3649bb18873b9055257a791a73b126b1">_drush_format_config_changes_table</a>($config_changes, !<a class="code" href="context_8inc.html#ad25559f8d7d753f636fbeac347c29fc5">drush_get_context</a>(<span class="stringliteral">&#39;DRUSH_NOCOLOR&#39;</span>));</div>
<div class="line"><a name="l00963"></a><span class="lineno">  963</span>&#160;</div>
<div class="line"><a name="l00964"></a><span class="lineno">  964</span>&#160;  $output = $tbl-&gt;getTable();</div>
<div class="line"><a name="l00965"></a><span class="lineno">  965</span>&#160;  <span class="keywordflow">if</span> (!stristr(PHP_OS, <span class="stringliteral">&#39;WIN&#39;</span>)) {</div>
<div class="line"><a name="l00966"></a><span class="lineno">  966</span>&#160;    $output = str_replace(<span class="stringliteral">&quot;\r\n&quot;</span>, PHP_EOL, $output);</div>
<div class="line"><a name="l00967"></a><span class="lineno">  967</span>&#160;  }</div>
<div class="line"><a name="l00968"></a><span class="lineno">  968</span>&#160;</div>
<div class="line"><a name="l00969"></a><span class="lineno">  969</span>&#160;  <a class="code" href="group__outputfunctions.html#ga63acbb94925d6d2693e235e966bba740">drush_print</a>(rtrim($output));</div>
<div class="line"><a name="l00970"></a><span class="lineno">  970</span>&#160;  <span class="keywordflow">return</span> $tbl;</div>
<div class="line"><a name="l00971"></a><span class="lineno">  971</span>&#160;}</div>
<div class="line"><a name="l00972"></a><span class="lineno">  972</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00973"></a><span class="lineno">  973</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00974"></a><span class="lineno">  974</span>&#160;<span class="comment"> * Command argument complete callback.</span></div>
<div class="line"><a name="l00975"></a><span class="lineno">  975</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00976"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#a82cfb01a12e4452b77475403873ef3ce">  976</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#a82cfb01a12e4452b77475403873ef3ce">config_config_get_complete</a>() {</div>
<div class="line"><a name="l00977"></a><span class="lineno">  977</span>&#160;  <span class="keywordflow">return</span> <a class="code" href="config_8drush_8inc.html#af1d1bf8c1e046236ed8df0712af62ff9">_drush_config_names_complete</a>();</div>
<div class="line"><a name="l00978"></a><span class="lineno">  978</span>&#160;}</div>
<div class="line"><a name="l00979"></a><span class="lineno">  979</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00980"></a><span class="lineno">  980</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00981"></a><span class="lineno">  981</span>&#160;<span class="comment"> * Command argument complete callback.</span></div>
<div class="line"><a name="l00982"></a><span class="lineno">  982</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00983"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#ae458d62399d2a103a0bea5a237e133fa">  983</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#ae458d62399d2a103a0bea5a237e133fa">config_config_set_complete</a>() {</div>
<div class="line"><a name="l00984"></a><span class="lineno">  984</span>&#160;  <span class="keywordflow">return</span> <a class="code" href="config_8drush_8inc.html#af1d1bf8c1e046236ed8df0712af62ff9">_drush_config_names_complete</a>();</div>
<div class="line"><a name="l00985"></a><span class="lineno">  985</span>&#160;}</div>
<div class="line"><a name="l00986"></a><span class="lineno">  986</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00987"></a><span class="lineno">  987</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00988"></a><span class="lineno">  988</span>&#160;<span class="comment"> * Command argument complete callback.</span></div>
<div class="line"><a name="l00989"></a><span class="lineno">  989</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00990"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#a4e3252a4f7010c01e10087e5cc63c779">  990</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#a4e3252a4f7010c01e10087e5cc63c779">config_config_view_complete</a>() {</div>
<div class="line"><a name="l00991"></a><span class="lineno">  991</span>&#160;  <span class="keywordflow">return</span> <a class="code" href="config_8drush_8inc.html#af1d1bf8c1e046236ed8df0712af62ff9">_drush_config_names_complete</a>();</div>
<div class="line"><a name="l00992"></a><span class="lineno">  992</span>&#160;}</div>
<div class="line"><a name="l00993"></a><span class="lineno">  993</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00994"></a><span class="lineno">  994</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00995"></a><span class="lineno">  995</span>&#160;<span class="comment"> * Command argument complete callback.</span></div>
<div class="line"><a name="l00996"></a><span class="lineno">  996</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00997"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#ac2af6c0ae3d422a57d303214eefe6165">  997</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#ac2af6c0ae3d422a57d303214eefe6165">config_config_edit_complete</a>() {</div>
<div class="line"><a name="l00998"></a><span class="lineno">  998</span>&#160;  <span class="keywordflow">return</span> <a class="code" href="config_8drush_8inc.html#af1d1bf8c1e046236ed8df0712af62ff9">_drush_config_names_complete</a>();</div>
<div class="line"><a name="l00999"></a><span class="lineno">  999</span>&#160;}</div>
<div class="line"><a name="l01000"></a><span class="lineno"> 1000</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l01001"></a><span class="lineno"> 1001</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l01002"></a><span class="lineno"> 1002</span>&#160;<span class="comment"> * Command argument complete callback.</span></div>
<div class="line"><a name="l01003"></a><span class="lineno"> 1003</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l01004"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#ab9771429a24ad7304e6fdd12a9993ad6"> 1004</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#ab9771429a24ad7304e6fdd12a9993ad6">config_config_import_complete</a>() {</div>
<div class="line"><a name="l01005"></a><span class="lineno"> 1005</span>&#160;  <span class="keywordflow">return</span> <a class="code" href="config_8drush_8inc.html#a49e0e252235dd709f7151231cf13519e">_drush_config_directories_complete</a>();</div>
<div class="line"><a name="l01006"></a><span class="lineno"> 1006</span>&#160;}</div>
<div class="line"><a name="l01007"></a><span class="lineno"> 1007</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l01008"></a><span class="lineno"> 1008</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l01009"></a><span class="lineno"> 1009</span>&#160;<span class="comment"> * Command argument complete callback.</span></div>
<div class="line"><a name="l01010"></a><span class="lineno"> 1010</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l01011"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#a16e7e892a98982d0800805ac9551ebf1"> 1011</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#a16e7e892a98982d0800805ac9551ebf1">config_config_export_complete</a>() {</div>
<div class="line"><a name="l01012"></a><span class="lineno"> 1012</span>&#160;  <span class="keywordflow">return</span> <a class="code" href="config_8drush_8inc.html#a49e0e252235dd709f7151231cf13519e">_drush_config_directories_complete</a>();</div>
<div class="line"><a name="l01013"></a><span class="lineno"> 1013</span>&#160;}</div>
<div class="line"><a name="l01014"></a><span class="lineno"> 1014</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l01015"></a><span class="lineno"> 1015</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l01016"></a><span class="lineno"> 1016</span>&#160;<span class="comment"> * Command argument complete callback.</span></div>
<div class="line"><a name="l01017"></a><span class="lineno"> 1017</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l01018"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#a2c3fbeb317e825e8bcb6980feb34d2db"> 1018</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#a2c3fbeb317e825e8bcb6980feb34d2db">config_config_pull_complete</a>() {</div>
<div class="line"><a name="l01019"></a><span class="lineno"> 1019</span>&#160;  <span class="keywordflow">return</span> array(<span class="stringliteral">&#39;values&#39;</span> =&gt; array_keys(<a class="code" href="sitealias_8drush_8inc.html#ab84f25812ecd477686e6fa349503ed8d">_drush_sitealias_all_list</a>()));</div>
<div class="line"><a name="l01020"></a><span class="lineno"> 1020</span>&#160;}</div>
<div class="line"><a name="l01021"></a><span class="lineno"> 1021</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l01022"></a><span class="lineno"> 1022</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l01023"></a><span class="lineno"> 1023</span>&#160;<span class="comment"> * Helper function for command argument complete callback.</span></div>
<div class="line"><a name="l01024"></a><span class="lineno"> 1024</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l01025"></a><span class="lineno"> 1025</span>&#160;<span class="comment"> * @return</span></div>
<div class="line"><a name="l01026"></a><span class="lineno"> 1026</span>&#160;<span class="comment"> *   Array of available config directories.</span></div>
<div class="line"><a name="l01027"></a><span class="lineno"> 1027</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l01028"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#a49e0e252235dd709f7151231cf13519e"> 1028</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#a49e0e252235dd709f7151231cf13519e">_drush_config_directories_complete</a>() {</div>
<div class="line"><a name="l01029"></a><span class="lineno"> 1029</span>&#160;  drush_bootstrap_max(DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION);</div>
<div class="line"><a name="l01030"></a><span class="lineno"> 1030</span>&#160;  global $config_directories;</div>
<div class="line"><a name="l01031"></a><span class="lineno"> 1031</span>&#160;  <span class="keywordflow">return</span> array(<span class="stringliteral">&#39;values&#39;</span> =&gt; array_keys($config_directories));</div>
<div class="line"><a name="l01032"></a><span class="lineno"> 1032</span>&#160;}</div>
<div class="line"><a name="l01033"></a><span class="lineno"> 1033</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l01034"></a><span class="lineno"> 1034</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l01035"></a><span class="lineno"> 1035</span>&#160;<span class="comment"> * Helper function for command argument complete callback.</span></div>
<div class="line"><a name="l01036"></a><span class="lineno"> 1036</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l01037"></a><span class="lineno"> 1037</span>&#160;<span class="comment"> * @return</span></div>
<div class="line"><a name="l01038"></a><span class="lineno"> 1038</span>&#160;<span class="comment"> *   Array of available config names.</span></div>
<div class="line"><a name="l01039"></a><span class="lineno"> 1039</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l01040"></a><span class="lineno"><a class="code" href="config_8drush_8inc.html#af1d1bf8c1e046236ed8df0712af62ff9"> 1040</a></span>&#160;<span class="keyword">function</span> <a class="code" href="config_8drush_8inc.html#af1d1bf8c1e046236ed8df0712af62ff9">_drush_config_names_complete</a>() {</div>
<div class="line"><a name="l01041"></a><span class="lineno"> 1041</span>&#160;  drush_bootstrap_max();</div>
<div class="line"><a name="l01042"></a><span class="lineno"> 1042</span>&#160;  <span class="keywordflow">return</span> array(<span class="stringliteral">&#39;values&#39;</span> =&gt; $storage = \Drupal::service(<span class="stringliteral">&#39;config.storage&#39;</span>)-&gt;listAll());</div>
<div class="line"><a name="l01043"></a><span class="lineno"> 1043</span>&#160;}</div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Nov 2 2016 07:28:51 for Drush by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.2
</small></address>
</body>
</html>