From a39c978c7d133666d12fcdf7b642e53918638a3b Mon Sep 17 00:00:00 2001 From: EarthlingDavey <15802017+EarthlingDavey@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:46:55 +0000 Subject: [PATCH] Update composer-post-install.sh (#761) * Update composer-post-install.sh * Update composer-post-install.sh --- bin/composer-post-install.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/bin/composer-post-install.sh b/bin/composer-post-install.sh index a8f5df0c8..62c2ddd9a 100755 --- a/bin/composer-post-install.sh +++ b/bin/composer-post-install.sh @@ -26,18 +26,20 @@ fi MOJ_COMPONENTS_FILE=/var/www/html/public/app/mu-plugins/wp-moj-components/component/Introduce/Introduce.php -MOJ_COMPONENTS_SEARCH_1="justice\.web@digital\.justice\.gov\.uk" -MOJ_COMPONENTS_REPLACE_1="intranet-support@digital.justice.gov.uk" -MOJ_COMPONENTS_SEARCH_2="Justice\son\sthe\sWeb\steam" -MOJ_COMPONENTS_REPLACE_2="Central Digital Product Team" +MOJ_COMPONENTS_SEARCH_EMAIL="justice\.web@digital\.justice\.gov\.uk" +MOJ_COMPONENTS_REPLACE_EMAIL="intranet-support@digital.justice.gov.uk" # If search string is in file. Then replace it. -if grep -q $MOJ_COMPONENTS_SEARCH_1 $MOJ_COMPONENTS_FILE ; then +if grep -q $MOJ_COMPONENTS_SEARCH_EMAIL $MOJ_COMPONENTS_FILE ; then echo "Replacing email text in wp-moj-components plugin." - sed -i "s/$MOJ_COMPONENTS_SEARCH_1/$MOJ_COMPONENTS_REPLACE_1/g" $MOJ_COMPONENTS_FILE + sed -i "s/$MOJ_COMPONENTS_SEARCH_EMAIL/$MOJ_COMPONENTS_REPLACE_EMAIL/g" $MOJ_COMPONENTS_FILE fi -if grep -q $MOJ_COMPONENTS_SEARCH_2 $MOJ_COMPONENTS_FILE ; then - echo "Replacing team text in wp-moj-components plugin." - sed -i "s/'$MOJ_COMPONENTS_SEARCH_2'/'$MOJ_COMPONENTS_REPLACE_2'/g" $MOJ_COMPONENTS_FILE +MOJ_COMPONENTS_SEARCH_PARAGRAPH="
This website is ([\w\W]*?)<\/p>" +MOJ_COMPONENTS_REPLACE_PARAGRAPH="
This website is technically maintained by Justice Digital, Central Digital Product Team:<\/p>" + +if [ -f "$MOJ_COMPONENTS_FILE" ] ; then + echo "Replacing paragraph text in wp-moj-components plugin" + MOJ_COMPONENTS_CONTENT=$(perl -0777pe 's/'"$MOJ_COMPONENTS_SEARCH_PARAGRAPH"'/'"$MOJ_COMPONENTS_REPLACE_PARAGRAPH"'/s' "$MOJ_COMPONENTS_FILE") + echo "$MOJ_COMPONENTS_CONTENT" > "$MOJ_COMPONENTS_FILE" fi