5 * Post update functions for test module.
11 function update_test_postupdate_post_update_first() {
12 $execution = \Drupal::state()->get('post_update_test_execution', []);
13 $execution[] = __FUNCTION__;
14 \Drupal::state()->set('post_update_test_execution', $execution);
16 return 'First update';
22 function update_test_postupdate_post_update_second() {
23 $execution = \Drupal::state()->get('post_update_test_execution', []);
24 $execution[] = __FUNCTION__;
25 \Drupal::state()->set('post_update_test_execution', $execution);
27 return 'Second update';
33 function update_test_postupdate_post_update_test1() {
34 $execution = \Drupal::state()->get('post_update_test_execution', []);
35 $execution[] = __FUNCTION__;
36 \Drupal::state()->set('post_update_test_execution', $execution);
38 return 'Test1 update';
44 function update_test_postupdate_post_update_test0() {
45 $execution = \Drupal::state()->get('post_update_test_execution', []);
46 $execution[] = __FUNCTION__;
47 \Drupal::state()->set('post_update_test_execution', $execution);
49 return 'Test0 update';
53 * Testing batch processing in post updates update.
55 function update_test_postupdate_post_update_test_batch(&$sandbox = NULL) {
56 if (!isset($sandbox['steps'])) {
57 $sandbox['current_step'] = 0;
58 $sandbox['steps'] = 3;
61 $sandbox['current_step']++;
63 $execution = \Drupal::state()->get('post_update_test_execution', []);
64 $execution[] = __FUNCTION__ . '-' . $sandbox['current_step'];
65 \Drupal::state()->set('post_update_test_execution', $execution);
67 $sandbox['#finished'] = $sandbox['current_step'] / $sandbox['steps'];
68 return 'Test post update batches';