Skip to content

Commit

Permalink
debug(SHS-6113): see why Econ site fails update
Browse files Browse the repository at this point in the history
  • Loading branch information
dalin- committed Mar 4, 2025
1 parent b71ff58 commit 96aa9dc
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use Drupal\Core\DrupalKernel;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\Core\Menu\MenuTreeParameters;
use Drupal\Core\Utility\UpdateException;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\hs_entities\Entity\HsEntityType;
Expand Down Expand Up @@ -1318,6 +1319,13 @@ function su_humsci_profile_update_9725() {

/**
* Clean-up possible node settings dupes from su_humsci_profile_update_9723().
*
* @param array $sandbox
*
* @return string
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
* @throws \Drupal\Core\Utility\UpdateException
*/
function su_humsci_profile_update_9726(&$sandbox) {
$node_type = 'hs_private_page';
Expand All @@ -1331,7 +1339,7 @@ function su_humsci_profile_update_9726(&$sandbox) {
$sandbox['ids'] = array_combine($ids, $ids);
$sandbox['total'] = count($sandbox['ids']);
}
$nids = array_slice($sandbox['ids'], 0, 50);
$nids = array_slice($sandbox['ids'], 0, 100);

/** @var \Drupal\node\NodeInterface $node */
foreach ($node_storage->loadMultiple($nids) as $node) {
Expand All @@ -1340,6 +1348,9 @@ function su_humsci_profile_update_9726(&$sandbox) {
$changed = FALSE;
if ($node_settings) {
foreach ($node_settings as $node_operation => &$node_permissions) {
if (!is_array($node_permissions)) {
throw new UpdateException('Error on node ' . $node->id() . "where operation $node_operation is not an array.");
}
$clean_permissions = array_unique($node_permissions);
if ($clean_permissions !== $node_permissions) {
$changed = TRUE;
Expand Down

0 comments on commit 96aa9dc

Please sign in to comment.