function entity_updates_main

8.0.x entity_updates_main()
master entity_updates_main()

Apply pending entity schema updates.

1 call to entity_updates_main()
drush_core_entity_updates in commands/core/
Command handler. Apply pending entity schema updates.


commands/core/drupal/, line 349
Update.php for provisioned sites. This file is a derivative of the standard drupal update.php, which has been modified to allow being run from the command line.


function entity_updates_main() {
  $change_summary = \Drupal::entityDefinitionUpdateManager()->getChangeSummary();
  if (!empty($change_summary)) {
    drush_print(dt('The following updates are pending:'));

    foreach ($change_summary as $entity_type_id => $changes) {
      drush_print($entity_type_id . ' entity type : ');
      foreach ($changes as $change) {
        drush_print(strip_tags($change), 2);

    if (!drush_confirm(dt('Do you wish to run all pending updates?'))) {
      return drush_user_abort();

    $operations[] = array('drush_update_entity_definitions', array());

    $batch['operations'] = $operations;
    $batch += array(
      'title' => 'Updating',
      'init_message' => 'Starting updates',
      'error_message' => 'An unrecoverable error has occurred. You can find the error message below. It is advised to copy it to the clipboard for reference.',
      'finished' => 'drush_update_finished',
      'file' => 'includes/',
    \Drupal::service('state')->set('system.maintenance_mode', TRUE);
    \Drupal::service('state')->set('system.maintenance_mode', FALSE);
  else {
    drush_log(dt("No entity schema updates required"), LogLevel::SUCCESS);