Skip to content

Commit

Permalink
Merge branch 'main' into cdpt-2264-revert-isolated-cron
Browse files Browse the repository at this point in the history
  • Loading branch information
wilson1000 authored Nov 26, 2024
2 parents 2bfa01a + c878164 commit eb47431
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 96 deletions.
1 change: 0 additions & 1 deletion deploy/development/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ data:
# The following IDs are not private, they form part of the publicly visible oauth login url.
OAUTH_CLIENT_ID: "51266573-d4eb-41db-8ebe-a9548aa4f01e"
OAUTH_TENANT_ID: "0bb413d7-160d-4839-868a-f3d46537f6af"
WP_REDIS_USE_RELAY: 'true'
1 change: 0 additions & 1 deletion deploy/production/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ data:
# The following IDs are not private, they form part of the publicly visible oauth login url.
OAUTH_CLIENT_ID: "ffb808d2-312b-4ffe-a6e5-d6eacfd9f06f"
OAUTH_TENANT_ID: "c6874728-71e6-41fe-a9e1-2e8c36776ad8"
WP_REDIS_USE_RELAY: 'true'
1 change: 0 additions & 1 deletion deploy/staging/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ data:
# The following IDs are not private, they form part of the publicly visible oauth login url.
OAUTH_CLIENT_ID: "ffb808d2-312b-4ffe-a6e5-d6eacfd9f06f"
OAUTH_TENANT_ID: "c6874728-71e6-41fe-a9e1-2e8c36776ad8"
WP_REDIS_USE_RELAY: 'true'
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AmazonS3AndCloudFrontSigning
private mixed $cloudfront_host;
private string $cloudfront_url;

const CLOUDFRONT_DURATION = 60 * 10; // 10 minutes
const CLOUDFRONT_DURATION = 60 * 15; // 15 minutes - important that this is at least nginx cache (10mins) + TRANSIENT_DURATION (2mins)
const CLOUDFRONT_REFRESH = 60 * 5; // 5 minutes
const TRANSIENT_DURATION = 60 * 2; // 2 minutes

Expand Down
59 changes: 54 additions & 5 deletions public/app/themes/clarity/inc/amazon-s3-and-cloudfront.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,67 @@ class AmazonS3AndCloudFrontTweaks
public function __construct()
{
// Increase limits from 50 to 5000.
add_filter( 'as3cf_update_replace_provider_urls_batch_size', fn() => 5000);
add_filter( 'as3cf_update_filter_post_excerpt_batch_size', fn() => 5000);
add_filter('as3cf_update_replace_provider_urls_batch_size', fn() => 5000);
add_filter('as3cf_update_filter_post_excerpt_batch_size', fn() => 5000);

// Increase limits from 500 to 3500, duration is about 45 seconds.
add_filter( 'as3cf_update_fix_broken_item_extra_data_batch_size', fn() => 3500);
add_filter('as3cf_update_fix_broken_item_extra_data_batch_size', fn() => 3500);

// Increase limit from 50 to 750.
add_filter( 'as3cf_update_as3cf_items_table_batch_size', fn() => 750);
add_filter('as3cf_update_as3cf_items_table_batch_size', fn() => 750);
// 750 items take ~20 secs, so decrease interval from 2 to 1 minute.
add_filter( 'as3cf_update_as3cf_items_table_interval', fn() => 1);
add_filter('as3cf_update_as3cf_items_table_interval', fn() => 1);

// Redirect legacy URLs to cdn URLs.
add_action('template_redirect', [$this, 'maybeRedirect404s']);
}

/**
* Redirect local media URLs to cdn URLs.
*
* Some content has links to documents and media that have the path `/wp-content/uploads/`.
* These paths are redirected to `/app/uploads/` by Bedrock.
*
* A further redirect is required to redirect `/app/uploads/` to the CDN URL.
*
* @return void
*/

public function maybeRedirect404s(): void
{
if (!is_404()) {
return;
}

// Check if the request is for a local upload URL.
if (!str_starts_with($_SERVER['REQUEST_URI'], '/app/uploads/')) {
return;
}

// Replace '/app/uploads/' with '/media/'.
$media_uri = str_replace('/app/uploads/', '/media/', $_SERVER['REQUEST_URI']);

// Make it an absolute URL for `attachment_url_to_postid`.
$absolute_url = get_home_url(null, $media_uri);

// Get the attachment id from the url.
$attachment_id = attachment_url_to_postid($absolute_url);

if (!$attachment_id) {
return;
}

// Get the url from the attachment id.
$cdn_url = wp_get_attachment_url($attachment_id);

if (!$cdn_url) {
return;
}

// Redirect to the CDN URL.
wp_redirect($cdn_url, 301);
exit;
}
}

new AmazonS3AndCloudFrontTweaks();
10 changes: 4 additions & 6 deletions public/app/themes/clarity/src/components/c-polls/style.styl
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@

// Overriding Totalpoll plugin styles to Clarity theme styles.
// Needs to be outside of this specific component's scope so it is global and will affect wherever the shortcode is used on the site.
.totalpoll-wrapper {
h4 {
font-size: $mantle !important;
}
}

.totalpoll-button, .totalpoll-button-primary, .totalpoll-button-vote {
cursor: pointer !important;
font-size: $outerCore !important;
Expand Down Expand Up @@ -59,6 +53,10 @@
display: none !important;
}

h4 {
font-size: $mantle !important;
}

.totalpoll-question-choices-item-votes-text {
font-size: $outerCore !important;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,24 +150,39 @@ img.aligncenter { display: block; margin-left: auto; margin-right: auto; }
border: 1px solid $border;
}

h2,
h3,
h4,
h5,
h6 {
ff-title();
margin-bottom: $spacing;
font-weight: 700;
}

h1 {
h1();
ff-title()
font-size: $crust;
}

h2 {
h2();
font-size: $mantle;
margin-top: 50px;
}

h3 {
h3();
font-size: 24px;
line-height: 30px;
}

h4 {
h4();
font-size: 19px;
line-height: 25px;
}

h5 {
h5();
font-size: 16px;
line-height: 20px;
}

h6 {
Expand Down
69 changes: 0 additions & 69 deletions public/app/themes/clarity/src/globals/css/_mixins.styl
Original file line number Diff line number Diff line change
Expand Up @@ -17,75 +17,6 @@ ff-body() {
margin-bottom: $bodyCopy;
}

// Heading styles for c-rich-text component and the o-page--title object, adapted from https://design-system.service.gov.uk/styles/type-scale/
h1() {
ff-title();
font-size: 3.2rem;
line-height: 1.1875;
margin-bottom: 2.5rem;
@media screen and (min-width: 640px) {
font-size: 4.8rem;
line-height: 1.125;
margin-bottom: 3.125rem;
}
}

h2() {
ff-title();
font-size: 2.7rem;
line-height: 1.22222;
margin-top: 3rem;
margin-bottom: 1.25rem;
@media screen and (min-width: 640px) {
font-size: 3.6rem;
line-height: 1.16667;
margin-bottom: 1.875rem;
}
}

h3() {
ff-title();
font-size: 2.2rem;
line-height: 1.31818;
margin-top: 3rem;
margin-bottom: 1rem;
@media screen and (min-width: 640px) {
font-size: 2.6rem;
line-height: 1.25;
margin-bottom: 1.25rem;
}
}

h4() {
ff-title();
font-size: 1.9rem;
line-height: 1.42105;
margin-top: 3rem;
margin-bottom: 1rem;
@media screen and (min-width: 640px) {
font-size: 2.2rem;
line-height: 1.36364;
margin-bottom: 1.25rem;
}
}

h5() {
ff-title();
font-size: 1.6rem;
line-height: 1.5;
margin-top: 3rem;
margin-bottom: 1rem;
@media screen and (min-width: 640px) {
font-size: 1.9rem;
line-height: 1.47368;
margin-bottom: 1.25rem;
}
}

body() {
ff-body();
}

// For a real content list with bullet points
real-list() {
ff-body();
Expand Down
4 changes: 2 additions & 2 deletions public/app/themes/clarity/src/globals/css/objects.styl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
margin-bottom: $spacing*2;
// Main page title
&--page {
h1();
font-size: $crust;
margin-top: $spacing*2;
}
// Section title
Expand All @@ -22,7 +22,7 @@
}

&--headline {
h1();
font-size: $crust;
}

&--byline {
Expand Down
5 changes: 0 additions & 5 deletions public/app/themes/clarity/src/globals/css/reset.styl
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@ select::-ms-expand {
display: none;
} // Remove default drop down style in IE
html {
/* This is an old trick to make rems map to pixel values.
* The browser default is 16px, 62.5% sets it to 10px so 1.6 rem is equivalent to 16px.
* See this article for a better explanation: https://www.aleksandrhovhannisyan.com/blog/62-5-percent-font-size-trick/
* TODO: remove this in future as it's confusing and doesn't integrate well
*/
// Reset font size to 10px
font-size: 62.5%;
}
Expand Down

0 comments on commit eb47431

Please sign in to comment.