summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortimKruijsen2018-02-06 10:24:56 (GMT)
committertimKruijsen2018-02-06 10:24:56 (GMT)
commit88ef4d31128cc8b19d1868717f5be7c56677b983 (patch)
treeea59a062979fdd2380aa1523e55a428ed71cc543
parentada82b51e459c1a9fbcdf9cb620c7112c7f1b5f0 (diff)
parentd037ac0ae0ea1603c68e4df1d82f6b3c545593ba (diff)
Merge tag '8.x-1.7' into 8.x-1.x
-rw-r--r--src/Controller/BlocksController.php31
-rwxr-xr-xsrc/Controller/MenuLinksController.php16
-rwxr-xr-xsrc/Controller/TaxonomiesController.php32
3 files changed, 45 insertions, 34 deletions
diff --git a/src/Controller/BlocksController.php b/src/Controller/BlocksController.php
index ab66c49..7d527f5 100644
--- a/src/Controller/BlocksController.php
+++ b/src/Controller/BlocksController.php
@@ -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;
diff --git a/src/Controller/MenuLinksController.php b/src/Controller/MenuLinksController.php
index 3319063..b4ba173 100755
--- a/src/Controller/MenuLinksController.php
+++ b/src/Controller/MenuLinksController.php
@@ -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) {
diff --git a/src/Controller/TaxonomiesController.php b/src/Controller/TaxonomiesController.php
index 4292b7c..1831025 100755
--- a/src/Controller/TaxonomiesController.php
+++ b/src/Controller/TaxonomiesController.php
@@ -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 = [];