From 659c9e6c10f6c972c5983c728cf3ac6f5bfa8e77 Mon Sep 17 00:00:00 2001 From: Nick Santamaria Date: Thu, 14 Nov 2024 11:04:35 +1100 Subject: [PATCH 1/2] Fixed PHP warning for accessing array offset on null (#538) --- .../Plugin/jsonapi/FieldEnhancer/YamlEnhancer.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/tide_api/src/Plugin/jsonapi/FieldEnhancer/YamlEnhancer.php b/modules/tide_api/src/Plugin/jsonapi/FieldEnhancer/YamlEnhancer.php index 878d6c938..6f19e0c69 100644 --- a/modules/tide_api/src/Plugin/jsonapi/FieldEnhancer/YamlEnhancer.php +++ b/modules/tide_api/src/Plugin/jsonapi/FieldEnhancer/YamlEnhancer.php @@ -23,14 +23,12 @@ class YamlEnhancer extends ResourceFieldEnhancerBase { */ protected function doUndoTransform($data, Context $context) { $data = Yaml::decode($data); - $markup_text = $data['markup']['#markup']; - $processed_text = $data['processed_text']['#text']; - - if (!empty($processed_text)) { - $data['processed_text']['#text'] = $this->processText($processed_text); + + if (!empty($data['markup']['#markup'])) { + $data['processed_text']['#text'] = $this->processText($data['markup']['#markup']); } - if (!empty($markup_text)) { - $data['markup']['#markup'] = $this->processText($markup_text); + if (!empty($data['markup']['#markup'])) { + $data['markup']['#markup'] = $this->processText($data['markup']['#markup']); } return $data; From 15dc4538dcf81c9b7a33fb71bdbe1b9ba7d7ea9a Mon Sep 17 00:00:00 2001 From: Md Nadim Hossain Date: Thu, 14 Nov 2024 11:30:57 +1100 Subject: [PATCH 2/2] Added option to ignore service if not available. (#539) * Added option to ignore service if not available. --- .circleci/merge-to-reference.sh | 21 --------------------- .github/workflows/build.yml | 24 ------------------------ src/TideSystemInfoService.php | 10 ++++++---- tide_core.services.yml | 2 +- 4 files changed, 7 insertions(+), 50 deletions(-) delete mode 100755 .circleci/merge-to-reference.sh diff --git a/.circleci/merge-to-reference.sh b/.circleci/merge-to-reference.sh deleted file mode 100755 index db8b679ef..000000000 --- a/.circleci/merge-to-reference.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash -## -# Merge develop to reference branch in CI. -# - -echo "==> Checking out reference branch" -git checkout reference -echo "==> Merging develop to reference branch" -git merge develop -git checkout develop -- composer.json -git add . -echo "==> Replacing composer require entries starting with dpc-sdp with value dev-reference" -cat composer.json | gojq '.require |= with_entries( - if (.key | test("dpc-sdp/tide")) - then .value = "dev-reference" end)' > composer.json.backup -mv -f composer.json.backup composer.json -echo "==> Add all changes" -git add . -git commit -m "Merge changes from develop." -echo "==> Push the changes to remote reference branch" -git push origin --force reference diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e1caf8d6d..9eb80315a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,16 +5,6 @@ on: workflow_dispatch: jobs: - set_status_in_progress: - name: set_status_in_progress - if: always() - uses: dpc-sdp/github-actions/.github/workflows/set_status.yml@v1.2.0 - secrets: inherit - with: - context: 'tide_build' - description: 'Tide Build running...' - state: 'pending' - target_url: ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} tide_build: name: tide_build secrets: inherit @@ -22,17 +12,3 @@ jobs: with: module_build: true runner: biggy-tide - export_config: - name: export_config - secrets: inherit - uses: dpc-sdp/github-actions/.github/workflows/export_config.yml@v1.2.0 - set_status: - name: set_status - needs: [tide_build] - if: always() - uses: dpc-sdp/github-actions/.github/workflows/set_status.yml@v1.2.0 - secrets: inherit - with: - context: 'tide_build' - description: 'Tide Build' - target_url: ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} diff --git a/src/TideSystemInfoService.php b/src/TideSystemInfoService.php index 13a42b944..fed2f4fa4 100644 --- a/src/TideSystemInfoService.php +++ b/src/TideSystemInfoService.php @@ -226,10 +226,12 @@ function ($entityType) { */ public function getPackageVersion($packageName) { if (empty($packageName)) { - $result = $this->sensorRunner->runSensors([SensorConfig::load('tide_times')]); - $value = $result[0]->getValue(); - $decodedValue = json_decode($value, TRUE); - return $decodedValue; + if ($this->sensorRunner) { + $result = $this->sensorRunner->runSensors([SensorConfig::load('tide_times')]); + $value = $result[0]->getValue(); + $decodedValue = json_decode($value, TRUE); + return $decodedValue; + } } if (strtolower($packageName) === 'php') { diff --git a/tide_core.services.yml b/tide_core.services.yml index c332995ba..49d7fb1d1 100644 --- a/tide_core.services.yml +++ b/tide_core.services.yml @@ -34,4 +34,4 @@ services: - '@entity_field.manager' - '@logger.factory' - '@file_system' - - '@monitoring.sensor_runner' + - '@?monitoring.sensor_runner'