Commit 88ef4d31 authored by timKruijsen's avatar timKruijsen

Merge tag '8.x-1.7' into 8.x-1.x

parents ada82b51 d037ac0a
......@@ -232,13 +232,15 @@ class BlocksController extends ControllerBase {
$uuidsInConfig[] = $block['uuid'];
}
$query = StructureSyncHelper::getEntityQuery('block_content');
$query->condition('uuid', $uuidsInConfig, 'NOT IN');
$ids = $query->execute();
$controller = StructureSyncHelper::getEntityManager()
->getStorage('block_content');
$entities = $controller->loadMultiple($ids);
$controller->delete($entities);
if(!empty($uuidsInConfig)) {
$query = StructureSyncHelper::getEntityQuery('block_content');
$query->condition('uuid', $uuidsInConfig, 'NOT IN');
$ids = $query->execute();
$controller = StructureSyncHelper::getEntityManager()
->getStorage('block_content');
$entities = $controller->loadMultiple($ids);
$controller->delete($entities);
}
if (array_key_exists('drush', $context) && $context['drush'] === TRUE) {
drush_log('Deleted custom blocks that were not in config', 'ok');
......@@ -258,12 +260,15 @@ class BlocksController extends ControllerBase {
$uuidsInConfig[] = $block['uuid'];
}
$query = StructureSyncHelper::getEntityQuery('block_content');
$query->condition('uuid', $uuidsInConfig, 'IN');
$ids = $query->execute();
$controller = StructureSyncHelper::getEntityManager()
->getStorage('block_content');
$entities = $controller->loadMultiple($ids);
$entities = [];
if(!empty($uuidsInConfig)) {
$query = StructureSyncHelper::getEntityQuery('block_content');
$query->condition('uuid', $uuidsInConfig, 'IN');
$ids = $query->execute();
$controller = StructureSyncHelper::getEntityManager()
->getStorage('block_content');
$entities = $controller->loadMultiple($ids);
}
$context['sandbox']['max'] = count($blocks);
$context['sandbox']['progress'] = 0;
......
......@@ -248,13 +248,15 @@ class MenuLinksController extends ControllerBase {
foreach ($menus as $menuLink) {
$uuidsInConfig[] = $menuLink['uuid'];
}
$query = StructureSyncHelper::getEntityQuery('menu_link_content');
$query->condition('uuid', $uuidsInConfig, 'IN');
$ids = $query->execute();
$controller = StructureSyncHelper::getEntityManager()
->getStorage('menu_link_content');
$entities = $controller->loadMultiple($ids);
$entities = [];
if(!empty($uuidsInConfig)) {
$query = StructureSyncHelper::getEntityQuery('menu_link_content');
$query->condition('uuid', $uuidsInConfig, 'IN');
$ids = $query->execute();
$controller = StructureSyncHelper::getEntityManager()
->getStorage('menu_link_content');
$entities = $controller->loadMultiple($ids);
}
$parents = array_column($menus, 'parent');
foreach ($parents as &$parent) {
......
......@@ -246,13 +246,15 @@ class TaxonomiesController extends ControllerBase {
}
}
$query = StructureSyncHelper::getEntityQuery('taxonomy_term');
$query->condition('uuid', $uuidsInConfig, 'NOT IN');
$tids = $query->execute();
$controller = StructureSyncHelper::getEntityManager()
->getStorage('taxonomy_term');
$entities = $controller->loadMultiple($tids);
$controller->delete($entities);
if(!empty($uuidsInConfig)) {
$query = StructureSyncHelper::getEntityQuery('taxonomy_term');
$query->condition('uuid', $uuidsInConfig, 'NOT IN');
$tids = $query->execute();
$controller = StructureSyncHelper::getEntityManager()
->getStorage('taxonomy_term');
$entities = $controller->loadMultiple($tids);
$controller->delete($entities);
}
if (array_key_exists('drush', $context) && $context['drush'] === TRUE) {
drush_log('Deleted taxonomies that were not in config', 'ok');
......@@ -273,13 +275,15 @@ class TaxonomiesController extends ControllerBase {
$uuidsInConfig[] = $taxonomy['uuid'];
}
}
$query = StructureSyncHelper::getEntityQuery('taxonomy_term');
$query->condition('uuid', $uuidsInConfig, 'IN');
$tids = $query->execute();
$controller = StructureSyncHelper::getEntityManager()
->getStorage('taxonomy_term');
$entities = $controller->loadMultiple($tids);
$entities = [];
if(!empty($uuidsInConfig)) {
$query = StructureSyncHelper::getEntityQuery('taxonomy_term');
$query->condition('uuid', $uuidsInConfig, 'IN');
$tids = $query->execute();
$controller = StructureSyncHelper::getEntityManager()
->getStorage('taxonomy_term');
$entities = $controller->loadMultiple($tids);
}
$tidsDone = [];
$tidsLeft = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment