From 1b163fcc0077ca8e2a256304806fd8b494eb8594 Mon Sep 17 00:00:00 2001 From: Chris Burgess Date: Mon, 24 Dec 2018 13:26:39 +1300 Subject: [PATCH] Issue #455 - Early exit if no memberships to process --- og.install | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/og.install b/og.install index d657d4709..80ad218cf 100644 --- a/og.install +++ b/og.install @@ -28,9 +28,14 @@ function og_update_8001(&$sandbox) { \Drupal::entityDefinitionUpdateManager()->installFieldStorageDefinition('entity_bundle', 'og_membership', 'og', $storage_definition); $sandbox['#finished'] = 0; + $sandbox['batch_size'] = 500; $sandbox['current'] = 0; $sandbox['total'] = $storage->getQuery()->count()->execute(); - $sandbox['batch_size'] = 500; + + if (!$sandbox['total']) { + $sandbox['#finished'] = 1; + return t('No OG memberships found.'); + } } // Update the existing memberships to include the group bundle ID.