diff --git a/az_quickstart.install b/az_quickstart.install index 1bd56d068b..8546ee92aa 100644 --- a/az_quickstart.install +++ b/az_quickstart.install @@ -5,6 +5,7 @@ * Install, update and uninstall functions for az_quickstart install profile. */ +use Drupal\Core\Extension\MissingDependencyException; use Drupal\user\Entity\User; use Drupal\shortcut\Entity\Shortcut; @@ -37,4 +38,14 @@ function az_quickstart_install() { 'link' => ['uri' => 'internal:/admin/content'], ]); $shortcut->save(); + + // Install the Patheon Advanced Page Cache Module when running on Pantheon. + if (defined('PANTHEON_ENVIRONMENT')) { + try { + \Drupal::service('module_installer')->install(['pantheon_advanced_page_cache']); + } + catch (MissingDependencyException $e) { + \Drupal::logger('az_quickstart')->warning('Pantheon Advanced Page Cache module not available to install.'); + } + } } diff --git a/az_quickstart.profile b/az_quickstart.profile index 13ad149a6a..fcfc607c06 100644 --- a/az_quickstart.profile +++ b/az_quickstart.profile @@ -5,6 +5,8 @@ * az_quickstart.profile */ +use Drupal\Core\Extension\MissingDependencyException; + /** * Install az_metrics. */ @@ -81,3 +83,19 @@ function az_quickstart_update_9207() { $module_list = ['az_security']; \Drupal::service('module_installer')->install($module_list); } + +/** + * Ensure Pantheon sites have the advanced page cache module installed. + */ +function az_quickstart_update_9208() { + if (defined('PANTHEON_ENVIRONMENT')) { + try { + \Drupal::service('module_installer')->install(['pantheon_advanced_page_cache']); + } + catch (MissingDependencyException $e) { + return t('Pantheon Advanced Page Cache module not available to install.'); + } + + return t('Pantheon Advanced Page Cache module installed.'); + } +}