Commit 81c6dc62 authored by catch's avatar catch
Browse files

Issue #3123472 by Neslee Canil Pinto, joachim, longwave: calls to...

Issue #3123472 by Neslee Canil Pinto, joachim, longwave: calls to StorageComparer should not be inlined in if()s
parent fb44ad00
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -354,7 +354,8 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
      $source_storage->replaceData($config_name, $data);
      $storage_comparer = new StorageComparer($source_storage, $this->configStorage);

      if (!$storage_comparer->createChangelist()->hasChanges()) {
      $storage_comparer->createChangelist();
      if (!$storage_comparer->hasChanges()) {
        $form_state->setErrorByName('import', $this->t('There are no changes to import.'));
      }
      else {
+4 −2
Original line number Diff line number Diff line
@@ -206,7 +206,8 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    $syncStorage = $this->importTransformer->transform($this->syncStorage);
    $source_list = $syncStorage->listAll();
    $storage_comparer = new StorageComparer($syncStorage, $this->activeStorage);
    if (empty($source_list) || !$storage_comparer->createChangelist()->hasChanges()) {
    $storage_comparer->createChangelist();
    if (empty($source_list) || !$storage_comparer->hasChanges()) {
      $form['no_changes'] = [
        '#type' => 'table',
        '#header' => [$this->t('Name'), $this->t('Operations')],
@@ -225,7 +226,8 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    // warned of potential losses to configuration.
    if ($this->snapshotStorage->exists('core.extension')) {
      $snapshot_comparer = new StorageComparer($this->activeStorage, $this->snapshotStorage);
      if (!$form_state->getUserInput() && $snapshot_comparer->createChangelist()->hasChanges()) {
      $snapshot_comparer->createChangelist();
      if (!$form_state->getUserInput() && $snapshot_comparer->hasChanges()) {
        $change_list = [];
        foreach ($snapshot_comparer->getAllCollectionNames() as $collection) {
          foreach ($snapshot_comparer->getChangelist(NULL, $collection) as $config_names) {