I. Why do we need Batch API
Have you get error related to our-of-memory issue or PHP timeout when perform some expensive tasks like import content from third-party, delete hundred thousand nodes ... in Drupal site ?
Batch API is one of solution for above issue. Drupal’s Batch API support us breaks complex, big task into smaller tasks as real our life, the big thing can be do easier if we break it into smaller parts then handle them.
2. How Drupal's Batch API works ?
Here is a sketch to understand the mechanism of batch in Drupal.
3. Use cases
You may see batch when deleting an user account and make its content belong to the Anonymous user in Drupal site (Batch was use because we my have thousand content need make belong Anonymous).
Or bulk generate URL alias (Batch was used because you may have thousand nodes, medias, users, entities need to update, generate URL alias)
Add new comment