summaryrefslogtreecommitdiffstats
path: root/core/lib/Drupal
diff options
context:
space:
mode:
authorNathaniel Catchpole2018-12-10 14:08:06 (GMT)
committerNathaniel Catchpole2018-12-10 14:08:17 (GMT)
commit4047cb0e27e07f4eb92b3b7533a62a5ef48ceb4c (patch)
treea9a8939cc548bd5caec5f99f3794609a85f12ee8 /core/lib/Drupal
parent897f0e461eace3c6a8534e51c96b94050e806113 (diff)
Issue #3018774 by xjm: hook_post_update_NAME() docs do not explain batching/ parameterHEAD8.6.x
(cherry picked from commit a9472244bf827f1e6549e9edb6997bd508d4bd16)
Diffstat (limited to 'core/lib/Drupal')
-rw-r--r--core/lib/Drupal/Core/Extension/module.api.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/lib/Drupal/Core/Extension/module.api.php b/core/lib/Drupal/Core/Extension/module.api.php
index 76c49b5..a7d94ff 100644
--- a/core/lib/Drupal/Core/Extension/module.api.php
+++ b/core/lib/Drupal/Core/Extension/module.api.php
@@ -684,6 +684,20 @@ function hook_update_N(&$sandbox) {
* 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.
*