You are here

private static function EntityUpdate::safeUpdateInstallFields in Entity Update 8

Same name and namespace in other branches
  1. 2.0.x src/EntityUpdate.php \Drupal\entity_update\EntityUpdate::safeUpdateInstallFields()

Update all entities / Install fields.

Return value

bool Update is done or FAIL

1 call to EntityUpdate::safeUpdateInstallFields()
EntityUpdate::safeUpdateMain in src/EntityUpdate.php
Update all entities.

File

src/EntityUpdate.php, line 264

Class

EntityUpdate
EntityUpdate Main Class.

Namespace

Drupal\entity_update

Code

private static function safeUpdateInstallFields() {

  // Update.
  try {
    \Drupal::entityDefinitionUpdateManager()
      ->applyUpdates();
    EntityUpdatePrint::drushLog('Entities update success', 'ok');

    // No need to update = OK.
    return !\Drupal::entityDefinitionUpdateManager()
      ->needsUpdates();
  } catch (\Exception $e) {
    EntityUpdatePrint::drushLog($e
      ->getMessage(), 'warning');
  }
  return FALSE;
}