diff --git a/scripts/composer/class-mitcomposerscripts.php b/scripts/composer/class-mitcomposerscripts.php index f436200f..4734a223 100644 --- a/scripts/composer/class-mitcomposerscripts.php +++ b/scripts/composer/class-mitcomposerscripts.php @@ -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( '-----' ); } } diff --git a/web/app/themes/mitlib-parent/functions.php b/web/app/themes/mitlib-parent/functions.php index 89f5abf2..d30bcd5e 100644 --- a/web/app/themes/mitlib-parent/functions.php +++ b/web/app/themes/mitlib-parent/functions.php @@ -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.