diff --git a/features.drush.inc b/features.drush.inc index c73c5bf..8626224 100644 --- a/features.drush.inc +++ b/features.drush.inc @@ -88,6 +88,11 @@ function features_drush_command() { 'drupal dependencies' => array('features', 'diff'), 'aliases' => array('fd'), ); + $items['features-conflicts-all'] = array( + 'description' => "Show all conflicting features.", + 'drupal dependencies' => array('features'), + 'aliases' => array('fca'), + ); return $items; } @@ -115,6 +120,8 @@ function features_drush_help($section) { return dt("Show a diff of a feature module."); case 'drush:features-add': return dt("Add a component to a feature module."); + case 'drush:features-conflict-all': + return dt("List of the conflicted features for your site."); } } @@ -627,6 +634,38 @@ function drush_features_diff() { } /** + * Show a table list of conflicting features. + */ +function drush_features_conflicts_all() { + $conflicts = features_get_conflicts(TRUE); + $features_errors = array(); + if (!empty($conflicts)) { + // Declase our headers. + $rows = array(array(dt('Name'), dt('Conflicting Feature'), dt('Component'), dt('Component Name'))); + // Loop over the conflict, features, components, and items. + foreach ($conflicts as $feature => $conflicting_features) { + // Let save our features so we can throw drush errors later. + $features_errors[] = $feature; + foreach ($conflicting_features as $conflicting_feature => $components) { + foreach ($components as $key => $value) { + foreach ($value as $item) { + $rows[] = array($feature, $conflicting_feature, $key, $item); + } + } + } + } + drush_print_table($rows, TRUE); + // Now lets make sure we throw an error for each conflicting feature. + foreach ($features_errors as $module) { + _features_drush_set_error($module, "FEATURES_CONFLICTS"); + } + } + else { + drush_print(dt('No conflicts founds.')); + } +} + +/** * Helper function to call drush_set_error(). * * @param $feature @@ -646,6 +685,9 @@ function _features_drush_set_error($feature, $error = '') { case 'FEATURES_COMPONENT_NOT_FOUND': $message = 'The given component !feature could not be found.'; break; + case 'FEATURES_CONFLICTS': + $message = 'The feature !feature has conflicts.'; + break; default: $error = 'FEATURES_FEATURE_NOT_FOUND'; $message = 'The feature !feature could not be found.';