Skip to content
Snippets Groups Projects
Commit 0bc95db9 authored by Kevin Paxman's avatar Kevin Paxman
Browse files

EXPHR: timeout the global message if it doesn't load fast enough

parent b81c420c
No related branches found
No related tags found
1 merge request!127Feature/exphr kpaxman global message timeout
...@@ -207,8 +207,17 @@ function uw_fdsu_theme_resp_preprocess_region(&$variables) { ...@@ -207,8 +207,17 @@ function uw_fdsu_theme_resp_preprocess_region(&$variables) {
$variables['faculty'] = theme_get_setting('wcms_colour_scheme', 'uw_fdsu_theme_resp') ? theme_get_setting('wcms_colour_scheme', 'uw_fdsu_theme_resp') : 'org-default'; $variables['faculty'] = theme_get_setting('wcms_colour_scheme', 'uw_fdsu_theme_resp') ? theme_get_setting('wcms_colour_scheme', 'uw_fdsu_theme_resp') : 'org-default';
// Create the stream context to use with file_get_contents
// so it times out after a certain period instead of
// waiting indefinitely.
$context = stream_context_create(array(
'http' => array(
'timeout' => 3, // Timeout in seconds.
)
));
// Global message content. // Global message content.
$global_message = file_get_contents('https://uwaterloo.ca/global-message.html'); $global_message = file_get_contents('https://uwaterloo.ca/global-message.html', 0, $context);
// If there is something to display, make sure to include css file, and // If there is something to display, make sure to include css file, and
// pass message as render array, then use render twig filter to avoid using // pass message as render array, then use render twig filter to avoid using
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment