Skip to content
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
2 changes: 2 additions & 0 deletions scripts/composer/class-mitcomposerscripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public static function multidev_search_replace_syntax( $event ): void {
$multidev = self::multidev_name( $event );
$terminus_command = "terminus remote:wp mitlib-wp-network.$multidev -- search-replace libraries.mit.edu $multidev-mitlib-wp-network.pantheonsite.io --url=libraries.mit.edu --network";
$event->getIO()->write( $terminus_command );
$terminus_command = "terminus remote:wp mitlib-wp-network.$multidev -- search-replace noreply@$multidev-mitlib-wp-network.pantheonsite.io noreply@libraries.mit.edu --network";
$event->getIO()->write( $terminus_command );
$event->getIO()->write( '-----' );
}
}
30 changes: 28 additions & 2 deletions web/app/themes/mitlib-parent/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,35 @@ function setup_scss_folders() {
}

/**
* Register and selectively enqueue the scripts and stylesheets needed for this
* page.
* Override max cache age for certain conditions.
*
* The default cache behavior is defined by the combination of two plugins:
* Pantheon MU Plugin and Pantheon Advanced Page Cache. The cache lifetime is
* typically set to 1 week via the former plugin, but certain pages require a
* shorter cache life. This function implements those alternative lifetimes.
*
* @link https://docs.pantheon.io/guides/wordpress-configurations/wordpress-cache-plugin#override-the-default-max-age
*/
function override_cache_default_max_age() {
$site = parse_url( get_site_url(), PHP_URL_PATH );
if ( is_page( 'hours' ) ) { // All hours pages (including those with query parameters).
return 1 * DAY_IN_SECONDS;
} elseif ( '/news' == $site && is_page( 'events' ) ) { // The news site events page.
return 1 * DAY_IN_SECONDS;
} elseif ( '/exhibits' == $site && is_page( '' ) ) { // The exhibits site homepage.
return 1 * DAY_IN_SECONDS;
} elseif ( '/exhibits' == $site && is_page( 'current-upcoming-past-exhibits' ) ) { // The exhibits site composite listing.
return 1 * DAY_IN_SECONDS;
} else { // All other content should be cached for a week.
return 1 * WEEK_IN_SECONDS;
}
}
add_filter( 'pantheon_cache_default_max_age', 'Mitlib\Parent\override_cache_default_max_age' );

/**
* Register and selectively enqueue the scripts and stylesheets needed for this
* page.
*/
function setup_scripts_styles() {
// This allows us to cache-bust these assets without needing to remember to
// increment the theme version here.
Expand Down