public function MultiversionManager::disableEntityTypes in Multiversion 8.2
Same name and namespace in other branches
- 8 src/MultiversionManager.php \Drupal\multiversion\MultiversionManager::disableEntityTypes()
Return value
\Drupal\multiversion\MultiversionManagerInterface
Overrides MultiversionManagerInterface::disableEntityTypes
File
- src/
MultiversionManager.php, line 343
Class
Namespace
Drupal\multiversionCode
public function disableEntityTypes($entity_types_to_disable = NULL) {
// $entity_types = ($entity_types_to_disable !== NULL) ? $entity_types_to_disable : $this->getEnabledEntityTypes();
// if (empty($entity_types)) {
// return $this;
// }
//
// // Temporarily disable the maintenance of the {comment_entity_statistics} table.
// $this->state->set('comment.maintain_entity_statistics', FALSE);
// $multiversion_settings = \Drupal::configFactory()
// ->getEditable('multiversion.settings');
// $enabled_entity_types = $multiversion_settings->get('enabled_entity_types') ?: [];
// $operations = [];
// $sandbox = [];
// // Define the step size.
// $sandbox['step_size'] = Settings::get('entity_conversion_batch_size', 50);
// foreach ($entity_types as $entity_type_id => $entity_type) {
// if (!in_array($entity_type_id, $enabled_entity_types)) {
// continue;
// }
// $base_table = $entity_type->getBaseTable();
// $sandbox['base_tables'][$entity_type_id] = $base_table;
// $entities_count = $this->connection->select($base_table)
// ->countQuery()
// ->execute()
// ->fetchField();
// $i = 0;
// while ($i <= $entities_count) {
// $operations[] = [
// [
// get_class($this),
// 'convertToOriginalStorage',
// ],
// [
// $entity_type_id,
// $this->entityTypeManager,
// $this->state,
// $multiversion_settings,
// &$sandbox
// ],
// ];
// $i += $sandbox['step_size'];
// }
// $operations[] = [
// [
// get_class($this),
// 'fixPrimaryKeys',
// ],
// [
// $entity_type_id,
// $this->entityTypeManager,
// $this->connection,
// ],
// ];
// }
//
// // Create and process the batch.
// if (!empty($operations)) {
// $batch = [
// 'operations' => $operations,
// 'finished' => [get_class($this), 'conversionFinished']
// ];
// batch_set($batch);
// $batch =& batch_get();
// $batch['progressive'] = FALSE;
// batch_process();
// }
//
// // Enable the the maintenance of entity statistics for comments.
// $this->state->set('comment.maintain_entity_statistics', TRUE);
// self::disableIsActive(NULL);
return $this;
}