Skip to content

Commit

Permalink
Issue Gizra#455 - Early exit if no memberships to process
Browse files Browse the repository at this point in the history
  • Loading branch information
xurizaemon authored and DiDebru committed Apr 23, 2019
1 parent 89b1787 commit 1b163fc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion og.install
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 1b163fc

Please sign in to comment.