diff core/lib/Drupal/Core/Extension/module.api.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children af1871eacc83
line wrap: on
line diff
--- a/core/lib/Drupal/Core/Extension/module.api.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/core/lib/Drupal/Core/Extension/module.api.php	Thu Feb 28 13:21:36 2019 +0000
@@ -479,7 +479,7 @@
 /**
  * Perform a single update between minor versions.
  *
- * hook_update_N() can only be used to update between minor versions of a
+ * Hook hook_update_N() can only be used to update between minor versions of a
  * module. To upgrade between major versions of Drupal (for example, between
  * Drupal 7 and 8), use the @link migrate Migrate API @endlink instead.
  *
@@ -684,6 +684,20 @@
  * Drupal also ensures to not execute the same hook_post_update_NAME() function
  * twice.
  *
+ * @section sec_bulk Batch updates
+ * If running your update all at once could possibly cause PHP to time out, use
+ * the $sandbox parameter to indicate that the Batch API should be used for your
+ * update. In this case, your update function acts as an implementation of
+ * callback_batch_operation(), and $sandbox acts as the batch context
+ * parameter. In your function, read the state information from the previous
+ * run from $sandbox (or initialize), run a chunk of updates, save the state in
+ * $sandbox, and set $sandbox['#finished'] to a value between 0 and 1 to
+ * indicate the percent completed, or 1 if it is finished (you need to do this
+ * explicitly in each pass).
+ *
+ * See the @link batch Batch operations topic @endlink for more information on
+ * how to use the Batch API.
+ *
  * @param array $sandbox
  *   Stores information for batch updates. See above for more information.
  *
@@ -933,7 +947,7 @@
     $requirements['drupal'] = [
       'title' => t('Drupal'),
       'value' => \Drupal::VERSION,
-      'severity' => REQUIREMENT_INFO
+      'severity' => REQUIREMENT_INFO,
     ];
   }