From c2df83cd942bd0f3d78f49e749a2763128c58d7f Mon Sep 17 00:00:00 2001 From: Damien Wilson Date: Thu, 3 Oct 2024 12:58:06 +0100 Subject: [PATCH] Optimise plugins + base-header update (#721) * Update plugins + move needed to MU * Remove lagging AB script * Ensure Search has a title * Update composer.lock --- bin/composer-post-install.sh | 6 +- composer.json | 13 +-- composer.lock | 82 ++++++------------- public/app/themes/clarity/search.php | 1 - .../c-global-header/base-header.php | 46 +++++------ 5 files changed, 59 insertions(+), 89 deletions(-) diff --git a/bin/composer-post-install.sh b/bin/composer-post-install.sh index 383c4e003..7bb07441c 100755 --- a/bin/composer-post-install.sh +++ b/bin/composer-post-install.sh @@ -3,12 +3,12 @@ # Add logging to amazon-s3-and-cloudfront-pro plugin. # Define the search and replace strings. -AS3CF_FILE=/var/www/html/public/app/plugins/amazon-s3-and-cloudfront-pro/classes/upgrades/upgrade.php +AS3CF_FILE=/var/www/html/public/app/mu-plugins/amazon-s3-and-cloudfront-pro/classes/upgrades/upgrade.php AS3CF_SEARCH="\$this->items_processed++;" AS3CF_NEW="if(\$upgraded % 100 === 0) { error_log(\"AS3CF_Upgrade - total \$total, items_processed \$this->items_processed, upgrade_name \$this->upgrade_name\"); }" AS3CF_REPLACE="$AS3CF_SEARCH\n\n\t\t\t$AS3CF_NEW" -# If serach string is in file. Then replace it. +# If search string is in file. Then replace it. if grep -q $AS3CF_SEARCH $AS3CF_FILE ; then echo "Adding logging to amazon-s3-and-cloudfront-pro..." sed -i "s/$AS3CF_SEARCH/$AS3CF_REPLACE/g" $AS3CF_FILE @@ -18,7 +18,7 @@ TOTAL_POLL_FILE=/var/www/html/public/app/plugins/totalpoll-lite/src/Plugin.php TOTAL_POLL_SEARCH="\${tooltip}" TOTAL_POLL_REPLACE="{\$tooltip}" -# If serach string is in file. Then replace it. +# If search string is in file. Then replace it. if grep -q $TOTAL_POLL_SEARCH $TOTAL_POLL_FILE ; then echo "Fixing syntax error in totalpoll-lite..." sed -i "s/$TOTAL_POLL_SEARCH/$TOTAL_POLL_REPLACE/g" $TOTAL_POLL_FILE diff --git a/composer.json b/composer.json index 17ca9fb52..82dc105ff 100644 --- a/composer.json +++ b/composer.json @@ -72,14 +72,12 @@ "ministryofjustice/wp-moj-components": "^3.5.0", "ministryofjustice/wp-moj-elasticsearch": "^2.3.0", "wpackagist-plugin/elasticpress": "^5.0.0", - "php-http/guzzle7-adapter": "^1.0", "alphagov/notifications-php-client": "^6.0", "aws/aws-sdk-php": "^3.133", "wpackagist-plugin/query-monitor": "^3.15", "wpackagist-plugin/debug-bar": "^1.1", "wpackagist-plugin/debug-bar-elasticpress": "^3.1", "deliciousbrains-plugin/wp-offload-media": "^3.2", - "deliciousbrains-plugin/wp-offload-media-assets-pull": "^1.1", "stayallive/wp-sentry": "^7.11", "ext-mysqli": "*", "ext-openssl": "*", @@ -87,8 +85,8 @@ "ext-zlib": "*", "league/oauth2-client": "^2.7", "firebase/php-jwt": "^6.10", - "wpackagist-plugin/redis-cache": "^2.5", - "guzzlehttp/guzzle": "^7.9" + "guzzlehttp/guzzle": "^7.9", + "php-http/guzzle7-adapter": "^1.0" }, "require-dev": { "squizlabs/php_codesniffer": "^3.0.2" @@ -97,8 +95,13 @@ "installer-paths": { "public/app/mu-plugins/{$name}/": [ "type:wordpress-muplugin", + "deliciousbrains-plugin/wp-offload-media", + "ministryofjustice/wp-moj-elasticsearch", + "ministryofjustice/php-markdown-extra", + "wpackagist-plugin/wp-document-revisions", + "wpackagist-plugin/elasticpress", "wpackagist-plugin/ewww-image-optimizer", - "ministryofjustice/php-markdown-extra" + "wpengine/advanced-custom-fields-pro" ], "public/app/plugins/{$name}/": [ "type:wordpress-plugin" diff --git a/composer.lock b/composer.lock index 4e3dcf1bf..146888354 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": "c01512a5e03c40be764675afb02d6cdf", + "content-hash": "5763ec9935ee3ceff6c57f2a16b70920", "packages": [ { "name": "alphagov/notifications-php-client", @@ -115,16 +115,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.321.9", + "version": "3.322.10", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "5de5099cfe0e17cb3eb2fe51de0101c99bc9442a" + "reference": "0adb58bc7989068b489d320970951163847b520b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/5de5099cfe0e17cb3eb2fe51de0101c99bc9442a", - "reference": "5de5099cfe0e17cb3eb2fe51de0101c99bc9442a", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/0adb58bc7989068b489d320970951163847b520b", + "reference": "0adb58bc7989068b489d320970951163847b520b", "shasum": "" }, "require": { @@ -207,9 +207,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.321.9" + "source": "https://github.com/aws/aws-sdk-php/tree/3.322.10" }, - "time": "2024-09-11T18:15:49+00:00" + "time": "2024-10-02T18:14:16+00:00" }, { "name": "composer/installers", @@ -450,21 +450,6 @@ "installer-name": "amazon-s3-and-cloudfront-pro" } }, - { - "name": "deliciousbrains-plugin/wp-offload-media-assets-pull", - "version": "1.1.2", - "dist": { - "type": "zip", - "url": "https://composer.deliciousbrains.com/?wc-api=delicious-brains&request=composer_download&package=wp-offload-media-assets-pull&version=1.1.2" - }, - "require": { - "composer/installers": "~1.0 || ~2.0" - }, - "type": "wordpress-plugin", - "extra": { - "installer-name": "amazon-s3-and-cloudfront-assets-pull" - } - }, { "name": "firebase/php-jwt", "version": "v6.10.1", @@ -1258,6 +1243,7 @@ "issues": "https://github.com/ministryofjustice/php-markdown-extra/issues", "source": "https://github.com/ministryofjustice/php-markdown-extra/tree/main" }, + "abandoned": true, "time": "2023-03-20T09:24:53+00:00" }, { @@ -1578,16 +1564,16 @@ }, { "name": "php-http/httplug", - "version": "2.4.0", + "version": "2.4.1", "source": { "type": "git", "url": "https://github.com/php-http/httplug.git", - "reference": "625ad742c360c8ac580fcc647a1541d29e257f67" + "reference": "5cad731844891a4c282f3f3e1b582c46839d22f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/httplug/zipball/625ad742c360c8ac580fcc647a1541d29e257f67", - "reference": "625ad742c360c8ac580fcc647a1541d29e257f67", + "url": "https://api.github.com/repos/php-http/httplug/zipball/5cad731844891a4c282f3f3e1b582c46839d22f4", + "reference": "5cad731844891a4c282f3f3e1b582c46839d22f4", "shasum": "" }, "require": { @@ -1629,9 +1615,9 @@ ], "support": { "issues": "https://github.com/php-http/httplug/issues", - "source": "https://github.com/php-http/httplug/tree/2.4.0" + "source": "https://github.com/php-http/httplug/tree/2.4.1" }, - "time": "2023-04-14T15:10:03+00:00" + "time": "2024-09-23T11:39:58+00:00" }, { "name": "php-http/promise", @@ -3061,15 +3047,15 @@ }, { "name": "wpackagist-plugin/classic-editor", - "version": "1.6.4", + "version": "1.6.5", "source": { "type": "svn", "url": "https://plugins.svn.wordpress.org/classic-editor/", - "reference": "tags/1.6.4" + "reference": "tags/1.6.5" }, "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/plugin/classic-editor.1.6.4.zip" + "url": "https://downloads.wordpress.org/plugin/classic-editor.1.6.5.zip" }, "require": { "composer/installers": "^1.0 || ^2.0" @@ -3169,15 +3155,15 @@ }, { "name": "wpackagist-plugin/ewww-image-optimizer", - "version": "7.8.0", + "version": "7.9.0", "source": { "type": "svn", "url": "https://plugins.svn.wordpress.org/ewww-image-optimizer/", - "reference": "tags/7.8.0" + "reference": "tags/7.9.0" }, "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/plugin/ewww-image-optimizer.7.8.0.zip" + "url": "https://downloads.wordpress.org/plugin/ewww-image-optimizer.7.9.0.zip" }, "require": { "composer/installers": "^1.0 || ^2.0" @@ -3203,24 +3189,6 @@ "type": "wordpress-plugin", "homepage": "https://wordpress.org/plugins/query-monitor/" }, - { - "name": "wpackagist-plugin/redis-cache", - "version": "2.5.3", - "source": { - "type": "svn", - "url": "https://plugins.svn.wordpress.org/redis-cache/", - "reference": "tags/2.5.3" - }, - "dist": { - "type": "zip", - "url": "https://downloads.wordpress.org/plugin/redis-cache.2.5.3.zip" - }, - "require": { - "composer/installers": "^1.0 || ^2.0" - }, - "type": "wordpress-plugin", - "homepage": "https://wordpress.org/plugins/redis-cache/" - }, { "name": "wpackagist-plugin/simple-301-redirects", "version": "2.0.9", @@ -3294,16 +3262,16 @@ "packages-dev": [ { "name": "squizlabs/php_codesniffer", - "version": "3.10.2", + "version": "3.10.3", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017" + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/62d32998e820bddc40f99f8251958aed187a5c9c", + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c", "shasum": "" }, "require": { @@ -3370,7 +3338,7 @@ "type": "open_collective" } ], - "time": "2024-07-21T23:26:44+00:00" + "time": "2024-09-18T10:38:58+00:00" } ], "aliases": [], diff --git a/public/app/themes/clarity/search.php b/public/app/themes/clarity/search.php index d3f340df9..607736870 100755 --- a/public/app/themes/clarity/search.php +++ b/public/app/themes/clarity/search.php @@ -9,7 +9,6 @@ * @since 1.0 * @version 1.0 */ -wp_enqueue_script('googleOptimizeAB', 'https://www.googleoptimize.com/optimize.js?id=OPT-5MGTCQZ'); get_header(); ?> diff --git a/public/app/themes/clarity/src/components/c-global-header/base-header.php b/public/app/themes/clarity/src/components/c-global-header/base-header.php index 27f525b35..4aae64aea 100644 --- a/public/app/themes/clarity/src/components/c-global-header/base-header.php +++ b/public/app/themes/clarity/src/components/c-global-header/base-header.php @@ -14,15 +14,28 @@ $oAgency = new Agency(); $activeAgency = $oAgency->getCurrentAgency() ? $oAgency->getCurrentAgency() : 'hq'; +// define the title +$header_title = get_the_title(); + +// Search page? +if (is_search()) { + $header_title = 'Search: ' . get_search_query(); + + $query_post_type = sanitize_text_field($_GET['post_types'] ?? null); + if ($query_post_type) { + $header_title .= ' (' . $query_post_type . ')'; + } +} + ?> - - - - - - <?= single_post_title(); ?><?= ' - ' . $activeAgency['label'] . ' Intranet'; ?> + + + + + + <?= $header_title ?><?= ' - ' . $activeAgency['label'] . ' Intranet'; ?> @@ -36,26 +49,13 @@ + wp_head() ?> +