Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HSD8-687: Slow stage sites #1714

Merged
merged 4 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@
"https://www.drupal.org/project/redirect/issues/3057250": "https://www.drupal.org/files/issues/2024-08-11/redirect--2024-08-11--3057250-79.patch",
"https://www.drupal.org/project/redirect/issues/3018897": "https://www.drupal.org/files/issues/2024-08-12/redirect-3018897-28.patch"
},
"drupal/shield": {
"https://www.drupal.org/project/shield/issues/3479117": "patches/shield-undefined_array_key_explode-3479117.patch"
},
"drupal/ui_patterns": {
"Ui Patterns Views Preview": "patches/contrib/ui_patterns_views-preview.patch"
},
Expand Down
14 changes: 9 additions & 5 deletions docroot/modules/humsci/hs_field_helpers/hs_field_helpers.module
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,16 @@ function _hs_field_helpers_cleanup_pattern_regions(array &$pattern, $pattern_id)
$rendered = $element;
}

// Remove all wrapper divs so we can check if the region actually has any
// visible output.
$rendered = preg_replace("/<div.*?>(.*?)<\/div>/s", "$1", $rendered);
$rendered = preg_replace("/<div>(.*?)<\/div>/s", "$1", $rendered);
if (empty(trim($rendered))) {
if (is_null($rendered)) {
unset($pattern[$region]);
} else {
// Remove all wrapper divs so we can check if the region actually has any
// visible output.
$rendered = preg_replace("/<div.*?>(.*?)<\/div>/s", "$1", $rendered);
$rendered = preg_replace("/<div>(.*?)<\/div>/s", "$1", $rendered);
if (empty(trim($rendered))) {
unset($pattern[$region]);
}
}

continue;
Expand Down
2 changes: 1 addition & 1 deletion docroot/modules/humsci/hs_layouts/hs_layouts.module
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function hs_layouts_preprocess_pattern_vertical_card(&$variables) {
$renderer = \Drupal::service('renderer');
$title_rendered = is_array($variables['title']) ? $renderer->renderInIsolation($variables['title']) : $variables['title'];

if (strpos($title_rendered, '<a') === FALSE) {
if (is_null($title_rendered) || strpos($title_rendered, '<a') === FALSE) {
$original_title = $variables['title'];
// If the title is not linked, get the link from the button.
_hs_layouts_make_title_the_link($variables);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ protected function getDateFields() {

// Only operate on CCK Fields. We dont care about base fields like entity
// title, published etc.
if (strpos($table, '__') === FALSE) {
if (is_null($table) || strpos($table, '__') === FALSE) {
continue;
}

Expand Down
27 changes: 27 additions & 0 deletions patches/shield-undefined_array_key_explode-3479117.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/src/ShieldMiddleware.php b/src/ShieldMiddleware.php
index f2a0b56..eb9d993 100644
--- a/src/ShieldMiddleware.php
+++ b/src/ShieldMiddleware.php
@@ -209,10 +209,20 @@ class ShieldMiddleware implements HttpKernelInterface {
$input_pass = $request->server->get('PHP_AUTH_PW');
}
elseif (!empty($request->server->get('HTTP_AUTHORIZATION'))) {
- [$input_user, $input_pass] = explode(':', base64_decode(substr($request->server->get('HTTP_AUTHORIZATION'), 6)), 2);
+ $decoded = base64_decode(substr($request->server->get('HTTP_AUTHORIZATION'), 6));
+ $credentials = explode(':', $decoded, 2);
+
+ if (count($credentials) === 2) {
+ [$input_user, $input_pass] = $credentials;
+ }
}
elseif (!empty($request->server->get('REDIRECT_HTTP_AUTHORIZATION'))) {
- [$input_user, $input_pass] = explode(':', base64_decode(substr($request->server->get('REDIRECT_HTTP_AUTHORIZATION'), 6)), 2);
+ $decoded = base64_decode(substr($request->server->get('REDIRECT_HTTP_AUTHORIZATION'), 6));
+ $credentials = explode(':', $decoded, 2);
+
+ if (count($credentials) === 2) {
+ [$input_user, $input_pass] = $credentials;
+ }
}
if (isset($input_user) && $input_user === $user && hash_equals($pass, $input_pass)) {
$request->headers->set('X-Shield-Status', 'authenticated');
Loading