You are here

function _configuration_start_tracking in Configuration Management 7.2

1 string reference to '_configuration_start_tracking'
configuration_drush_command in ./configuration.drush.inc
Implements of hook_drush_command().

File

./configuration.drush.inc, line 341
configuration.drush.inc Let you perform configuration actions from the console.

Code

function _configuration_start_tracking() {
  $start_tracking_all = drush_get_option('all');
  if (!empty($start_tracking_all)) {
    $args = _components_indentifier_formater();
  }
  else {
    $args = func_get_args();
  }
  if (empty($args)) {
    return drush_set_error('', dt('No configurations were selected to track'));
  }
  $handlers = ConfigurationManagement::getConfigurationHandler();
  foreach ($args as $arg) {
    list($component, $identifier) = explode('.', $arg, 2);
    if (empty($handlers[$component])) {
      return drush_set_error('', dt('The component @component is not valid or the module to track the configuration is not installed.', array(
        '@component' => $component,
      )));
    }
    if (empty($identifier)) {
      return drush_set_error('', dt('No identifier supplied for @arg.', array(
        '@arg' => $arg,
      )));
    }
  }
  $rows = array();
  $start_tracking_dependencies = !drush_get_option('exclude-dependencies');
  $start_tracking_optionals = !drush_get_option('exclude-optionals');
  $result = ConfigurationManagement::startTracking($args, $start_tracking_dependencies, $start_tracking_optionals);
  foreach ($result
    ->getInfo('exported') as $tracking) {
    $rows[]['exported'] = $tracking;
  }
  drush_log(dt('The configurations changes for for the following items are now being tracked.'), 'ok');
  drush_print_table($rows);
}