From 5558a09812fb25f014a849c04a14e25b92b9fa2b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Feb 2024 19:47:07 -0800 Subject: [PATCH 1/8] Bump drupal/codit_menu_tools from 1.0.0-alpha5 to 1.0.1 (#17203) Bumps drupal/codit_menu_tools from 1.0.0-alpha5 to 1.0.1. --- updated-dependencies: - dependency-name: drupal/codit_menu_tools dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index 3feac7b66e..30afbf6c26 100644 --- a/composer.lock +++ b/composer.lock @@ -3055,17 +3055,17 @@ }, { "name": "drupal/codit_menu_tools", - "version": "1.0.0-alpha5", + "version": "1.0.1", "source": { "type": "git", "url": "https://git.drupalcode.org/project/codit_menu_tools.git", - "reference": "1.0.0-alpha5" + "reference": "1.0.1" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/codit_menu_tools-1.0.0-alpha5.zip", - "reference": "1.0.0-alpha5", - "shasum": "4dff97ae333a7ae80765403c252f551887210dc6" + "url": "https://ftp.drupal.org/files/projects/codit_menu_tools-1.0.1.zip", + "reference": "1.0.1", + "shasum": "06327db394d467cf1dcb40db4328364d32822a7a" }, "require": { "drupal/core": "^10" @@ -3073,11 +3073,11 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "1.0.0-alpha5", - "datestamp": "1707500832", + "version": "1.0.1", + "datestamp": "1707535222", "security-coverage": { - "status": "not-covered", - "message": "Alpha releases are not covered by Drupal security advisories." + "status": "covered", + "message": "Covered by Drupal's security advisory policy" } } }, From 993c2090cc9e2a4c8efb16d808c0a9659e41e190 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 09:01:56 -0500 Subject: [PATCH 2/8] Bump int128/datadog-actions-metrics from 1.79.0 to 1.80.0 (#17207) Bumps [int128/datadog-actions-metrics](https://github.com/int128/datadog-actions-metrics) from 1.79.0 to 1.80.0. - [Release notes](https://github.com/int128/datadog-actions-metrics/releases) - [Commits](https://github.com/int128/datadog-actions-metrics/compare/af1a1a70bb380b079e38053d5fb32ae907ce2b6a...2ca3c09b18e2185806a071ed29fd5a02b75f8599) --- updated-dependencies: - dependency-name: int128/datadog-actions-metrics dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/actions-metrics.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/actions-metrics.yml b/.github/workflows/actions-metrics.yml index f1ec78d3fa..2bfbb7f781 100644 --- a/.github/workflows/actions-metrics.yml +++ b/.github/workflows/actions-metrics.yml @@ -11,7 +11,7 @@ jobs: timeout-minutes: 10 steps: - name: Send GitHub Actions metrics to DataDog - uses: int128/datadog-actions-metrics@af1a1a70bb380b079e38053d5fb32ae907ce2b6a # v1.79.0 + uses: int128/datadog-actions-metrics@2ca3c09b18e2185806a071ed29fd5a02b75f8599 # v1.80.0 with: datadog-api-key: ${{ secrets.DATADOG_API_KEY }} collect-job-metrics: true From 65fd5b7d2534d6fea9ddf03e8c4b63ba282c61d7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 09:02:16 -0500 Subject: [PATCH 3/8] Bump reviewdog/action-eslint from 1.22.0 to 1.23.0 (#17206) Bumps [reviewdog/action-eslint](https://github.com/reviewdog/action-eslint) from 1.22.0 to 1.23.0. - [Release notes](https://github.com/reviewdog/action-eslint/releases) - [Commits](https://github.com/reviewdog/action-eslint/compare/5deb8e2c1d8a9bbefff4d80d6702c41c5b3729cb...b3c5aa2589ed06195b52faffd3afb108c02faaf5) --- updated-dependencies: - dependency-name: reviewdog/action-eslint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/continuous_integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index 5ea204ed62..158d5fc841 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -43,7 +43,7 @@ jobs: uses: ./.github/actions/post-checkout - name: ReviewDog # See also `composer va:test:eslint` in composer.json - uses: reviewdog/action-eslint@5deb8e2c1d8a9bbefff4d80d6702c41c5b3729cb # v1.22.0 + uses: reviewdog/action-eslint@b3c5aa2589ed06195b52faffd3afb108c02faaf5 # v1.23.0 with: reporter: github-pr-review eslint_flags: '--max-warnings 0 -c .eslintrc.json --no-eslintrc docroot/modules/custom/**/*.es6.js docroot/themes/custom/**/*.es6.js tests/cypress/**/*.js' From 67c5d927c483c14d4911983db1a07586b4926c1f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 10:17:09 -0500 Subject: [PATCH 4/8] Bump reviewdog/action-stylelint from 1.18.1 to 1.22.1 (#17204) Bumps [reviewdog/action-stylelint](https://github.com/reviewdog/action-stylelint) from 1.18.1 to 1.22.1. - [Release notes](https://github.com/reviewdog/action-stylelint/releases) - [Commits](https://github.com/reviewdog/action-stylelint/compare/548276a94275c7865effa8d72fa8b6983d9f47c4...eadef3f639793f2b361a4719ee8720bf5055a0ff) --- updated-dependencies: - dependency-name: reviewdog/action-stylelint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/continuous_integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index 158d5fc841..e21798631f 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -139,7 +139,7 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Stylelint modules # See also `composer va:test:stylelint-modules` in composer.json - uses: reviewdog/action-stylelint@548276a94275c7865effa8d72fa8b6983d9f47c4 # v1.18.1 + uses: reviewdog/action-stylelint@eadef3f639793f2b361a4719ee8720bf5055a0ff # v1.22.1 with: fail_on_error: true github_token: ${{ secrets.github_token }} @@ -149,7 +149,7 @@ jobs: stylelint_input: 'docroot/modules/custom/**/*.css' - name: Stylelint themes # See also `composer va:test:stylelint-themes` in composer.json - uses: reviewdog/action-stylelint@548276a94275c7865effa8d72fa8b6983d9f47c4 # v1.18.1 + uses: reviewdog/action-stylelint@eadef3f639793f2b361a4719ee8720bf5055a0ff # v1.22.1 with: fail_on_error: true github_token: ${{ secrets.github_token }} From 8e9eec9d694804d3450a0d298a78cc8add781cd9 Mon Sep 17 00:00:00 2001 From: Steve Wirt Date: Mon, 12 Feb 2024 12:29:02 -0500 Subject: [PATCH 5/8] VACMS-16233 Reorder VAMC menus (#17189) * VACMS-4943 Remove VA Leavenworh menu. It is empty and not used. * VACMS-4943 Remove VA Topeka menu. It is empty and not used. * VACMS-14683 Bring in scripts changes from 14683. * VACMS-16233 Add reorder VAMC System menu items. --- ...ent.va-leavenworth-health-care.changed.yml | 18 -- ...va-leavenworth-health-care.description.yml | 18 -- ...ent.va-leavenworth-health-care.metatag.yml | 18 -- ...ntent.va-leavenworth-health-care.title.yml | 18 -- ...t.va-leavenworth-health-care.view_mode.yml | 20 -- ..._content.va-topeka-health-care.changed.yml | 18 -- ...tent.va-topeka-health-care.description.yml | 18 -- ..._content.va-topeka-health-care.metatag.yml | 18 -- ...nk_content.va-topeka-health-care.title.yml | 18 -- ...ontent.va-topeka-health-care.view_mode.yml | 20 -- ...ink_content.va-leavenworth-health-care.yml | 18 -- ...enu_link_content.va-topeka-health-care.yml | 18 -- ...system.menu.va-leavenworth-health-care.yml | 14 -- .../system.menu.va-topeka-health-care.yml | 14 -- .../VACMS-16233-reorder-vamc-menu-items.php | 99 ++++++++++ scripts/content/script-library.php | 174 +++++++++++++++++- 16 files changed, 268 insertions(+), 253 deletions(-) delete mode 100644 config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.changed.yml delete mode 100644 config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.description.yml delete mode 100644 config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.metatag.yml delete mode 100644 config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.title.yml delete mode 100644 config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.view_mode.yml delete mode 100644 config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.changed.yml delete mode 100644 config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.description.yml delete mode 100644 config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.metatag.yml delete mode 100644 config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.title.yml delete mode 100644 config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.view_mode.yml delete mode 100644 config/sync/language.content_settings.menu_link_content.va-leavenworth-health-care.yml delete mode 100644 config/sync/language.content_settings.menu_link_content.va-topeka-health-care.yml delete mode 100644 config/sync/system.menu.va-leavenworth-health-care.yml delete mode 100644 config/sync/system.menu.va-topeka-health-care.yml create mode 100644 scripts/content/VACMS-16233-reorder-vamc-menu-items.php diff --git a/config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.changed.yml b/config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.changed.yml deleted file mode 100644 index 3d4cd89268..0000000000 --- a/config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.changed.yml +++ /dev/null @@ -1,18 +0,0 @@ -uuid: 3f2d2ec2-879e-47d8-a8cc-5d09217436e4 -langcode: en -status: true -dependencies: - config: - - system.menu.va-leavenworth-health-care -id: menu_link_content.va-leavenworth-health-care.changed -field_name: changed -entity_type: menu_link_content -bundle: va-leavenworth-health-care -label: Changed -description: 'The time that the menu link was last edited.' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: changed diff --git a/config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.description.yml b/config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.description.yml deleted file mode 100644 index a222be04cf..0000000000 --- a/config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.description.yml +++ /dev/null @@ -1,18 +0,0 @@ -uuid: ef139ac8-8c31-4da1-86f0-8af6d9749032 -langcode: en -status: true -dependencies: - config: - - system.menu.va-leavenworth-health-care -id: menu_link_content.va-leavenworth-health-care.description -field_name: description -entity_type: menu_link_content -bundle: va-leavenworth-health-care -label: Description -description: 'Shown when hovering over the menu link.' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string diff --git a/config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.metatag.yml b/config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.metatag.yml deleted file mode 100644 index 8b4f04fae8..0000000000 --- a/config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.metatag.yml +++ /dev/null @@ -1,18 +0,0 @@ -uuid: f8faf9ea-96fb-49b4-89a1-85f599800efc -langcode: en -status: true -dependencies: - config: - - system.menu.va-leavenworth-health-care -id: menu_link_content.va-leavenworth-health-care.metatag -field_name: metatag -entity_type: menu_link_content -bundle: va-leavenworth-health-care -label: 'Metatags (Hidden field for JSON support)' -description: 'The meta tags for the entity.' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: map diff --git a/config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.title.yml b/config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.title.yml deleted file mode 100644 index 3651823a04..0000000000 --- a/config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.title.yml +++ /dev/null @@ -1,18 +0,0 @@ -uuid: 45771ebb-ff9f-4d41-8091-199095f6980c -langcode: en -status: true -dependencies: - config: - - system.menu.va-leavenworth-health-care -id: menu_link_content.va-leavenworth-health-care.title -field_name: title -entity_type: menu_link_content -bundle: va-leavenworth-health-care -label: 'Menu link title' -description: 'The text to be used for this link in the menu.' -required: true -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string diff --git a/config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.view_mode.yml b/config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.view_mode.yml deleted file mode 100644 index f847dbe409..0000000000 --- a/config/sync/core.base_field_override.menu_link_content.va-leavenworth-health-care.view_mode.yml +++ /dev/null @@ -1,20 +0,0 @@ -uuid: b967b3f4-3b6a-4952-8bdd-1e29215e7d8b -langcode: en -status: true -dependencies: - config: - - system.menu.va-leavenworth-health-care - module: - - menu_item_extras -id: menu_link_content.va-leavenworth-health-care.view_mode -field_name: view_mode -entity_type: menu_link_content -bundle: va-leavenworth-health-care -label: 'View mode' -description: 'Per item view mode selector.' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string diff --git a/config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.changed.yml b/config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.changed.yml deleted file mode 100644 index ec451acb13..0000000000 --- a/config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.changed.yml +++ /dev/null @@ -1,18 +0,0 @@ -uuid: 53d9a2c1-1088-4094-b3bb-abc9e2385fe5 -langcode: en -status: true -dependencies: - config: - - system.menu.va-topeka-health-care -id: menu_link_content.va-topeka-health-care.changed -field_name: changed -entity_type: menu_link_content -bundle: va-topeka-health-care -label: Changed -description: 'The time that the menu link was last edited.' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: changed diff --git a/config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.description.yml b/config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.description.yml deleted file mode 100644 index 51dc51476b..0000000000 --- a/config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.description.yml +++ /dev/null @@ -1,18 +0,0 @@ -uuid: 87dd9f31-45a2-47e2-af3a-eb37a7f620d2 -langcode: en -status: true -dependencies: - config: - - system.menu.va-topeka-health-care -id: menu_link_content.va-topeka-health-care.description -field_name: description -entity_type: menu_link_content -bundle: va-topeka-health-care -label: Description -description: 'Shown when hovering over the menu link.' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string diff --git a/config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.metatag.yml b/config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.metatag.yml deleted file mode 100644 index dd4a79ef27..0000000000 --- a/config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.metatag.yml +++ /dev/null @@ -1,18 +0,0 @@ -uuid: da6103a5-de28-41dd-b4f0-53087bee2889 -langcode: en -status: true -dependencies: - config: - - system.menu.va-topeka-health-care -id: menu_link_content.va-topeka-health-care.metatag -field_name: metatag -entity_type: menu_link_content -bundle: va-topeka-health-care -label: 'Metatags (Hidden field for JSON support)' -description: 'The meta tags for the entity.' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: map diff --git a/config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.title.yml b/config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.title.yml deleted file mode 100644 index 78836b9b2a..0000000000 --- a/config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.title.yml +++ /dev/null @@ -1,18 +0,0 @@ -uuid: bf001922-b5fd-479d-acab-a25fb32ebca6 -langcode: en -status: true -dependencies: - config: - - system.menu.va-topeka-health-care -id: menu_link_content.va-topeka-health-care.title -field_name: title -entity_type: menu_link_content -bundle: va-topeka-health-care -label: 'Menu link title' -description: 'The text to be used for this link in the menu.' -required: true -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string diff --git a/config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.view_mode.yml b/config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.view_mode.yml deleted file mode 100644 index 219cb08a5e..0000000000 --- a/config/sync/core.base_field_override.menu_link_content.va-topeka-health-care.view_mode.yml +++ /dev/null @@ -1,20 +0,0 @@ -uuid: 24007f4e-cbb3-4b84-a87f-1416ee0818fb -langcode: en -status: true -dependencies: - config: - - system.menu.va-topeka-health-care - module: - - menu_item_extras -id: menu_link_content.va-topeka-health-care.view_mode -field_name: view_mode -entity_type: menu_link_content -bundle: va-topeka-health-care -label: 'View mode' -description: 'Per item view mode selector.' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string diff --git a/config/sync/language.content_settings.menu_link_content.va-leavenworth-health-care.yml b/config/sync/language.content_settings.menu_link_content.va-leavenworth-health-care.yml deleted file mode 100644 index ea070a35f9..0000000000 --- a/config/sync/language.content_settings.menu_link_content.va-leavenworth-health-care.yml +++ /dev/null @@ -1,18 +0,0 @@ -uuid: 79299311-302d-4d60-a3ef-cecf4524d356 -langcode: en -status: true -dependencies: - config: - - system.menu.va-leavenworth-health-care - module: - - content_translation -third_party_settings: - content_translation: - enabled: false - bundle_settings: - untranslatable_fields_hide: '0' -id: menu_link_content.va-leavenworth-health-care -target_entity_type_id: menu_link_content -target_bundle: va-leavenworth-health-care -default_langcode: site_default -language_alterable: false diff --git a/config/sync/language.content_settings.menu_link_content.va-topeka-health-care.yml b/config/sync/language.content_settings.menu_link_content.va-topeka-health-care.yml deleted file mode 100644 index bbf25f9eaf..0000000000 --- a/config/sync/language.content_settings.menu_link_content.va-topeka-health-care.yml +++ /dev/null @@ -1,18 +0,0 @@ -uuid: 22aacb56-0220-4aaa-9a8f-f999dd970e91 -langcode: en -status: true -dependencies: - config: - - system.menu.va-topeka-health-care - module: - - content_translation -third_party_settings: - content_translation: - enabled: false - bundle_settings: - untranslatable_fields_hide: '0' -id: menu_link_content.va-topeka-health-care -target_entity_type_id: menu_link_content -target_bundle: va-topeka-health-care -default_langcode: site_default -language_alterable: false diff --git a/config/sync/system.menu.va-leavenworth-health-care.yml b/config/sync/system.menu.va-leavenworth-health-care.yml deleted file mode 100644 index f982dc911b..0000000000 --- a/config/sync/system.menu.va-leavenworth-health-care.yml +++ /dev/null @@ -1,14 +0,0 @@ -uuid: efdadc4b-3464-454c-975d-0cd0a83b883a -langcode: en -status: true -dependencies: - module: - - workbench_menu_access -third_party_settings: - workbench_menu_access: - access_scheme: - 356: '356' -id: va-leavenworth-health-care -label: 'VA Leavenworth health care' -description: 'VISN 15 | va.gov/leavenworth-health-care' -locked: false diff --git a/config/sync/system.menu.va-topeka-health-care.yml b/config/sync/system.menu.va-topeka-health-care.yml deleted file mode 100644 index 117c10a37d..0000000000 --- a/config/sync/system.menu.va-topeka-health-care.yml +++ /dev/null @@ -1,14 +0,0 @@ -uuid: 07a6a9a5-dfe2-4b02-8466-526d27a5d24d -langcode: en -status: true -dependencies: - module: - - workbench_menu_access -third_party_settings: - workbench_menu_access: - access_scheme: - 360: '360' -id: va-topeka-health-care -label: 'VA Topeka health care' -description: 'VISN 15 | va.gov/topeka-health-care' -locked: false diff --git a/scripts/content/VACMS-16233-reorder-vamc-menu-items.php b/scripts/content/VACMS-16233-reorder-vamc-menu-items.php new file mode 100644 index 0000000000..41123b2247 --- /dev/null +++ b/scripts/content/VACMS-16233-reorder-vamc-menu-items.php @@ -0,0 +1,99 @@ + 0]; + do { + print(va_gov_vamc_deploy_resort_vamc_menus($sandbox)); + } while ($sandbox['#finished'] < 1); + + return "Script run complete. All menus should have been updated. "; +} + +/** + * Re-sort VAMC menus. + * + * @param mixed $sandbox + * Batch sandbox to keep state during multiple runs. + * + * @return string + * The message to be output. + */ +function va_gov_vamc_deploy_resort_vamc_menus(&$sandbox) { + script_library_sandbox_init($sandbox, '_va_gov_vamc_get_system_menus', []); + _va_gov_vamc_arrange_menus($sandbox); + return script_library_sandbox_complete($sandbox, "Re-arranged @total VAMC System Menus."); +} + +/** + * Get all VAMC system menus. + * + * @return array + * An array of VAMC system menus ['machine_name' => 'Human Name']. + */ +function _va_gov_vamc_get_system_menus(): array { + // Load the menus. + $vamc_menus = MenuManipulator::getAllMenuNames('-health-'); + $non_name_compliant_menus = [ + 'va-central-western-massachusetts' => 'VA Central Western Massachusetts health care', + 'va-columbia-south-carolina-healt' => 'VA Columbia South Carolina health care', + 'va-lebanon' => 'VA Lebanon health care', + ]; + + return array_merge($vamc_menus, $non_name_compliant_menus); +} + +/** + * Re-arranges existing VAMC menus to match a pattern. + * + * @param mixed $sandbox + * Batch sandbox to keep state during multiple runs. + * + * @return string + * A message to be output. + */ +function _va_gov_vamc_arrange_menus(&$sandbox) { + $menu_name = array_key_first($sandbox['items_to_process']); + $pattern = [ + 'About us', + 'Programs', + 'Research', + 'Policies', + 'VA police', + 'Work with us', + 'Contact us', + ]; + $menu_arranger = new MenuManipulator($menu_name); + $menu_arranger->matchPattern($pattern); + $message = "The menu {$sandbox['items_to_process'][$menu_name]} had been rearranged."; + unset($sandbox['items_to_process'][$menu_name]); + $sandbox['current']++; + + return $message; +} diff --git a/scripts/content/script-library.php b/scripts/content/script-library.php index b78c6799ec..6363a152b9 100644 --- a/scripts/content/script-library.php +++ b/scripts/content/script-library.php @@ -3,13 +3,21 @@ /** * @file * Common code related to drupal content scripts. + * + * This file can also be included in other things that run during non-full + * bootstrap processes like hook_update_n, post update, and deploy. + * Put the following line wherever you want to use this library. + * require_once __DIR__ . '/script-library.php'; */ +use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Entity\EntityTypeManagerInterface; +use Drupal\Core\Utility\UpdateException; use Drupal\node\NodeInterface; use Drupal\node\NodeStorageInterface; use Drupal\taxonomy\Entity\Term; use Drupal\user\UserStorageInterface; +use Psr\Log\LogLevel; const CMS_MIGRATOR_ID = 1317; @@ -152,6 +160,37 @@ function normalize_crisis_number($input, $plain = FALSE): string { return $output; } +/** + * Get an array of node ids for batch processing. + * + * @param string $node_bundle + * The bundle name of the nodes to lookup. + * @param bool $published_only + * TRUE if you need only published nodes. + * + * @return array + * An array of nids for for the requested bundle. + */ +function get_nids_of_type($node_bundle, $published_only = FALSE): array { + $query = \Drupal::entityQuery('node') + ->condition('type', $node_bundle) + ->accessCheck(FALSE); + if ($published_only) { + $query->condition('status', 1); + } + + $nids = $query->execute(); + // Having a node ids as a numeric keyed array is problematic when it comes + // to removing things from the array. As soon as you unset one, the array + // becomes renumbered. So we create string keys, with numeric values. + // [35, 75, 20] becomes + // ['node_35' => 35, 'node_75' => 75, 'node_20' => 20]. + $node_ids = array_combine( + array_map('_va_gov_stringifynid', array_values($nids)), + array_values($nids)); + return $node_ids; +} + /** * Saves a node revision with log messaging. * @@ -170,16 +209,18 @@ function save_node_revision(NodeInterface $node, $message = '', $new = TRUE): in $node->setNewRevision($new); $node->setSyncing(TRUE); $node->setValidationRequired(FALSE); + $node->enforceIsNew(FALSE); // New revisions deserve special treatment. if ($new) { - $node->enforceIsNew(TRUE); $node->setChangedTime(time()); $node->setRevisionCreationTime(time()); $uid = CMS_MIGRATOR_ID; } else { - $node->enforceIsNew(FALSE); $uid = $node->getRevisionUserId(); + // Append new log message to previous log message. + $prefix = !empty($message) ? $node->getRevisionLogMessage() . ' - ' : ''; + $message = $prefix . $message; } $node->setRevisionUserId($uid); $revision_time = $node->getRevisionCreationTime(); @@ -188,9 +229,7 @@ function save_node_revision(NodeInterface $node, $message = '', $new = TRUE): in // the value is not different from the original value. $revision_time++; $node->setRevisionCreationTime($revision_time); - // Append new log message to previous log message. - $prefix = !empty($message) ? $node->getRevisionLogMessage() . ' - ' : ''; - $node->setRevisionLogMessage($prefix . $message); + $node->setRevisionLogMessage($message); $node->set('moderation_state', $moderation_state); return $node->save(); @@ -258,6 +297,131 @@ function save_new_terms($vocabulary_id, array $terms): int { return $terms_created; } +/** + * Initializes the basic sandbox values. + * + * @param array $sandbox + * Standard drupal $sandbox var to keep state in hook_update_N. + * @param string $counter_callback + * A function name to call to get the items to process. Must return an array. + * @param array $callback_args + * A flat array of arguments to pass to the counter_callback. + * + * @throws Drupal\Core\Utility\UpdateException + * If the counter callback can not be found. + */ +function script_library_sandbox_init(array &$sandbox, $counter_callback, array $callback_args = []) { + if (empty($sandbox['total'])) { + // Sandbox has not been initiated. + if (is_callable($counter_callback)) { + $sandbox['items_to_process'] = call_user_func_array($counter_callback, $callback_args); + $sandbox['total'] = count($sandbox['items_to_process']); + $sandbox['current'] = 0; + } + else { + // Something went wrong could not use callback. Throw exception. + throw new UpdateException( + "Counter callback {$counter_callback} provided in script_library_sandbox_init() is not callable. Can not proceed." + ); + } + } +} + +/** + * Updates the counts and log if complete. + * + * @param array $sandbox + * Hook_update_n sandbox for keeping state. + * @param string $completed_message + * Message to log when completed. Can use '@completed' and '@total' as tokens. + * + * @return string + * String to be used as update hook messages. + */ +function script_library_sandbox_complete(array &$sandbox, $completed_message) { + // Determine when to stop batching. + $sandbox['current'] = ($sandbox['total'] - count($sandbox['items_to_process'])); + $sandbox['#finished'] = (empty($sandbox['total'])) ? 1 : ($sandbox['current'] / $sandbox['total']); + $vars = [ + '@completed' => $sandbox['current'], + '@total' => $sandbox['total'], + ]; + $message = t('Processing... @completed/@total.', $vars) . PHP_EOL; + // Log the all finished notice. + if ($sandbox['#finished'] === 1) { + Drupal::logger('va_gov_vamc')->log(LogLevel::INFO, $completed_message, $vars); + $logged_message = new FormattableMarkup($completed_message, $vars); + $message = t('Process completed:') . " {$logged_message}" . PHP_EOL; + } + return $message; +} + +/** + * Lookup a key in a map array and return the value from the map. + * + * @param string|null $lookup + * A map key to lookup. Do not lookup int as indexes can shift. + * @param array $map + * An array containing string key value pairs. [lookup => value]. + * @param bool $strict + * TRUE = only want a value from the array, FALSE = want your lookup back. + * + * @return mixed + * Whatever the value associated with the key. + */ +function script_libary_map_to_value(string|null $lookup, array $map, bool $strict = TRUE) : mixed { + if (empty($lookup)) { + if (isset($map['default'])) { + // There is a default set, so use it. + return $map['default']; + } + elseif ($strict) { + return NULL; + } + else { + return $lookup; + } + } + if ($strict) { + // Strict, so either it is there, or nothing. + return $map[$lookup] ?? NULL; + } + else { + // Not strict, so pass back what given it its not in the map. + return $map[$lookup] ?? $lookup; + } +} + +/** + * Turns on or off queueing of items to the post_api. + * + * CAUTION: The only time we would want to fully disable queueing is during a + * deploy when editors can not save anything. + * + * @param bool $state + * TRUE to toggle the settings on, FALSE to toggle them off. + */ +function script_library_disable_post_api_queueing(bool $state): void { + $on = ($state) ? 1 : 0; + $config_post_api = \Drupal::configFactory()->getEditable('post_api.settings'); + $config_post_api->set('disable_queueing', $on) + ->save(FALSE); + script_library_skip_post_api_data_check($state); +} + +/** + * Turns on or off data checks and deduping for adding items to post_api queue. + * + * @param bool $state + * TRUE to toggle the settings on, FALSE to toggle them off. + */ +function script_library_skip_post_api_data_check(bool $state): void { + $on = ($state) ? 1 : 0; + $config_va_gov_post_api = \Drupal::configFactory()->getEditable('va_gov_post_api.settings'); + $config_va_gov_post_api->set('bypass_data_check', $on) + ->save(FALSE); +} + /** * Callback function to concat node ids with string. * From d8995b486690fb6ef37d3e0d151f99e01c039532 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 11:30:32 -0800 Subject: [PATCH 6/8] Bump va-gov/content-build from 0.0.3437 to 0.0.3438 (#17180) Bumps [va-gov/content-build](https://github.com/department-of-veterans-affairs/content-build) from 0.0.3437 to 0.0.3438. - [Release notes](https://github.com/department-of-veterans-affairs/content-build/releases) - [Commits](https://github.com/department-of-veterans-affairs/content-build/compare/v0.0.3437...v0.0.3438) --- updated-dependencies: - dependency-name: va-gov/content-build dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Edmund Dunn <109987005+edmund-dunn@users.noreply.github.com> --- composer.json | 2 +- composer.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 9e9478136f..ca884a10c7 100644 --- a/composer.json +++ b/composer.json @@ -221,7 +221,7 @@ "symfony/phpunit-bridge": "^5.1", "symfony/process": "^6.3", "symfony/routing": "^6.3", - "va-gov/content-build": "^0.0.3437", + "va-gov/content-build": "^0.0.3438", "vlucas/phpdotenv": "^5.3", "webflo/drupal-finder": "^1.0.0", "webmozart/path-util": "^2.3", diff --git a/composer.lock b/composer.lock index 30afbf6c26..0da326200d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5a2e47403b810bc18a1b3c3793555a6a", + "content-hash": "6ca07aefb604394deced04a91e7826c7", "packages": [ { "name": "asm89/stack-cors", @@ -25807,7 +25807,7 @@ }, { "name": "va-gov/content-build", - "version": "v0.0.3437", + "version": "v0.0.3438", "source": { "type": "git", "url": "https://github.com/department-of-veterans-affairs/content-build.git", @@ -25843,7 +25843,7 @@ "description": "Front-end for VA.gov. This repository contains the code that generates the www.va.gov website. It contains a Metalsmith static site builder that uses a Drupal CMS for content. This file is here to publish releases to https://packagist.org/packages/va-gov/content-build, so that the CMS CI system can install it and update it using standard composer processes, and so that we can run tests across both systems. See https://github.com/department-of-veterans-affairs/va.gov-cms for the CMS repo, and stand by for more documentation.", "support": { "issues": "https://github.com/department-of-veterans-affairs/content-build/issues", - "source": "https://github.com/department-of-veterans-affairs/content-build/tree/v0.0.3437" + "source": "https://github.com/department-of-veterans-affairs/content-build/tree/v0.0.3438" }, "time": "2024-02-06T20:33:35+00:00" }, From 1d2364f0deb1737ffcd0eb256bbd79a9e137ef33 Mon Sep 17 00:00:00 2001 From: Nate Douglas Date: Mon, 12 Feb 2024 16:11:17 -0500 Subject: [PATCH 7/8] Update tugboat.md --- READMES/devops/tugboat.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/READMES/devops/tugboat.md b/READMES/devops/tugboat.md index de0332abaa..e0551b3ef6 100644 --- a/READMES/devops/tugboat.md +++ b/READMES/devops/tugboat.md @@ -36,6 +36,8 @@ Can only update CPU and memory at a project level, not repository level. ## Tugboat Crisis Intervention +Shelling into the Tugboat server can be accomplished with `ssm-session tugboat utility`. + ### Overload **Symptoms**: Tugboat is slow, requests to Tugboat dashboard return 502/504 status codes, previews disappear and reappear, etc. From 5b6d0bb541334785a15b4c2732b76c0fb7bca2e0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 18:01:05 -0800 Subject: [PATCH 8/8] Bump va-gov/content-build from 0.0.3438 to 0.0.3439 (#17217) Bumps [va-gov/content-build](https://github.com/department-of-veterans-affairs/content-build) from 0.0.3438 to 0.0.3439. - [Release notes](https://github.com/department-of-veterans-affairs/content-build/releases) - [Commits](https://github.com/department-of-veterans-affairs/content-build/compare/v0.0.3438...v0.0.3439) --- updated-dependencies: - dependency-name: va-gov/content-build dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.json | 2 +- composer.lock | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index ca884a10c7..e131258609 100644 --- a/composer.json +++ b/composer.json @@ -221,7 +221,7 @@ "symfony/phpunit-bridge": "^5.1", "symfony/process": "^6.3", "symfony/routing": "^6.3", - "va-gov/content-build": "^0.0.3438", + "va-gov/content-build": "^0.0.3439", "vlucas/phpdotenv": "^5.3", "webflo/drupal-finder": "^1.0.0", "webmozart/path-util": "^2.3", diff --git a/composer.lock b/composer.lock index 0da326200d..f24c39f1c6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6ca07aefb604394deced04a91e7826c7", + "content-hash": "15c7c7fba07e61d6be8de41d94c2619f", "packages": [ { "name": "asm89/stack-cors", @@ -25807,16 +25807,16 @@ }, { "name": "va-gov/content-build", - "version": "v0.0.3438", + "version": "v0.0.3439", "source": { "type": "git", "url": "https://github.com/department-of-veterans-affairs/content-build.git", - "reference": "7e1bb61b6bb656124410196ee2bb9933417c8db5" + "reference": "ef743f09f6c05b78d40bfb01730aac12f3d35988" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/department-of-veterans-affairs/content-build/zipball/7e1bb61b6bb656124410196ee2bb9933417c8db5", - "reference": "7e1bb61b6bb656124410196ee2bb9933417c8db5", + "url": "https://api.github.com/repos/department-of-veterans-affairs/content-build/zipball/ef743f09f6c05b78d40bfb01730aac12f3d35988", + "reference": "ef743f09f6c05b78d40bfb01730aac12f3d35988", "shasum": "" }, "type": "node-project", @@ -25843,9 +25843,9 @@ "description": "Front-end for VA.gov. This repository contains the code that generates the www.va.gov website. It contains a Metalsmith static site builder that uses a Drupal CMS for content. This file is here to publish releases to https://packagist.org/packages/va-gov/content-build, so that the CMS CI system can install it and update it using standard composer processes, and so that we can run tests across both systems. See https://github.com/department-of-veterans-affairs/va.gov-cms for the CMS repo, and stand by for more documentation.", "support": { "issues": "https://github.com/department-of-veterans-affairs/content-build/issues", - "source": "https://github.com/department-of-veterans-affairs/content-build/tree/v0.0.3438" + "source": "https://github.com/department-of-veterans-affairs/content-build/tree/v0.0.3439" }, - "time": "2024-02-06T20:33:35+00:00" + "time": "2024-02-08T21:53:11+00:00" }, { "name": "vlucas/phpdotenv", @@ -26816,6 +26816,7 @@ "drupal/cer": 10, "drupal/change_labels": 20, "drupal/ckeditor_abbreviation": 15, + "drupal/codit_menu_tools": 15, "drupal/components": 10, "drupal/danse_content_moderation": 10, "drupal/entity_block": 10,