Loading modules/custom/entity_access_by_field/entity_access_by_field.post_update.php +3 −27 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ function entity_access_by_field_post_update_10102_rebuild_node_access() { * Reindex items in the 'social_all' and 'social_content'. */ function entity_access_by_field_post_update_11001_reindex_search(array &$sandbox): void { if (!isset($sandbox['total'])) { /** @var \Drupal\search_api\IndexInterface[] $search_api_indexes */ $search_api_indexes = \Drupal::entityTypeManager() ->getStorage('search_api_index') Loading @@ -32,34 +31,11 @@ function entity_access_by_field_post_update_11001_reindex_search(array &$sandbox 'social_all', 'social_content', ]); $sandbox['total'] = 0; foreach ($search_api_indexes as $index_id => $index) { $index->clear(); $sandbox[$index_id] = [ 'not_indexed' => $index->hasValidTracker() ? $index->getTrackerInstance()->getRemainingItemsCount() : 0, ]; $sandbox['total'] += $sandbox[$index_id]['not_indexed']; } $sandbox['indexes'] = $search_api_indexes; $sandbox['total_indexed'] = 0; } if (!empty($sandbox['indexes'])) { /** @var \Drupal\search_api\IndexInterface $current_index */ $current_index = reset($sandbox['indexes']); $current_index_id = $current_index->id(); if ($sandbox[$current_index_id]['not_indexed'] <= 0) { unset($sandbox['indexes'][$current_index_id]); } if (isset($sandbox['indexes'][$current_index_id])) { $indexed = $current_index->indexItems(25); $sandbox[$current_index_id]['not_indexed'] -= $indexed; $sandbox['total_indexed'] += $indexed; } $sandbox['#finished'] = empty($sandbox['total']) ? 1 : ($sandbox['total_indexed'] / $sandbox['total']); } // Removed reindexing because it could cause a problems with a search server // if platforms has a lot of items to be indexed. Let's make cron do the work // instead of doing it ourselves. } Loading
modules/custom/entity_access_by_field/entity_access_by_field.post_update.php +3 −27 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ function entity_access_by_field_post_update_10102_rebuild_node_access() { * Reindex items in the 'social_all' and 'social_content'. */ function entity_access_by_field_post_update_11001_reindex_search(array &$sandbox): void { if (!isset($sandbox['total'])) { /** @var \Drupal\search_api\IndexInterface[] $search_api_indexes */ $search_api_indexes = \Drupal::entityTypeManager() ->getStorage('search_api_index') Loading @@ -32,34 +31,11 @@ function entity_access_by_field_post_update_11001_reindex_search(array &$sandbox 'social_all', 'social_content', ]); $sandbox['total'] = 0; foreach ($search_api_indexes as $index_id => $index) { $index->clear(); $sandbox[$index_id] = [ 'not_indexed' => $index->hasValidTracker() ? $index->getTrackerInstance()->getRemainingItemsCount() : 0, ]; $sandbox['total'] += $sandbox[$index_id]['not_indexed']; } $sandbox['indexes'] = $search_api_indexes; $sandbox['total_indexed'] = 0; } if (!empty($sandbox['indexes'])) { /** @var \Drupal\search_api\IndexInterface $current_index */ $current_index = reset($sandbox['indexes']); $current_index_id = $current_index->id(); if ($sandbox[$current_index_id]['not_indexed'] <= 0) { unset($sandbox['indexes'][$current_index_id]); } if (isset($sandbox['indexes'][$current_index_id])) { $indexed = $current_index->indexItems(25); $sandbox[$current_index_id]['not_indexed'] -= $indexed; $sandbox['total_indexed'] += $indexed; } $sandbox['#finished'] = empty($sandbox['total']) ? 1 : ($sandbox['total_indexed'] / $sandbox['total']); } // Removed reindexing because it could cause a problems with a search server // if platforms has a lot of items to be indexed. Let's make cron do the work // instead of doing it ourselves. }