Updating Drupal Features Without the UI

The features module is a great module for maintaining multiple instances of a Drupal site (e.g., dev, test, prod). Whenever I added a new context , view or content type to the site and wanted to maintain it via features, I always visited the Features page of my website, scrolled down to my feature and clicked 'Recreate.' Then I proceeded to click through the new features, select them and then rebuild the feature. Time consuming, but definitely worth it!

With all that said however, I've recently found myself updating features with different components quite a bit and the UI just seemed a bit prohibitive as far as speed was concerned (some of my sites have been getting pretty big with all of the enabled modules). So researching this 'problem' a bit further, I found that you can just edit your feature's .info file directly to add your new component!

Here are some quick-start examples to get you started:

;Add a new depency
dependencies[] = module_name

;Add a new box
features[box][] = box_machine_name

;Add a new context
features[context][] = context_machine_name

;Add a new field (e.g., node-page-body)
features[field][] = entity_type-bundle-field_machine_name

;Add a new filter
features[filter][] = filter_machine_name

;Add a new content type
features[node][] = node_machine_name

;Add a new permission (e.g., create node content)
features[user_permission][] = permission value

;Add a new role
features[user_role][] = role

;Add a new variable
features[variable][] = variable_name

;Add a new view
features[views_view][] = view_machine_name

Once you've added your new components, don't forget to adjust your features version number if appropriate and then run drush fu feature_machine_name. That's it! Your feature is now up-to-date with your latest component without clicking through the Features UI.

Updating Drupal Features Without the UI | Gerrit Brands

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /homepages/29/d196880538/htdocs/drupal7/includes/common.inc:2681) in drupal_send_headers() (line 1212 of /homepages/29/d196880538/htdocs/drupal7/includes/bootstrap.inc).
  • PDOException: SQLSTATE[42000]: Syntax error or access violation: 1142 INSERT command denied to user 'dbo354826752'@'74.208.16.6' for table 'watchdog': INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => cron [:db_insert_placeholder_2] => Attempting to re-run cron while it is already running. [:db_insert_placeholder_3] => a:0:{} [:db_insert_placeholder_4] => 4 [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => http://www.gerritbrands.com/blog/updating-drupal-features-without-ui [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => 54.162.152.232 [:db_insert_placeholder_9] => 1508363444 ) in dblog_watchdog() (line 154 of /homepages/29/d196880538/htdocs/drupal7/modules/dblog/dblog.module).

Error

The website encountered an unexpected error. Please try again later.