Skip to content

Commit

Permalink
Closes #1287: Ensure advanced page cache module is installed on Panth…
Browse files Browse the repository at this point in the history
…eon sites. (#1288)
  • Loading branch information
joeparsons authored Feb 8, 2022
1 parent da11e9e commit c17dffa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
11 changes: 11 additions & 0 deletions az_quickstart.install
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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.');
}
}
}
18 changes: 18 additions & 0 deletions az_quickstart.profile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* az_quickstart.profile
*/

use Drupal\Core\Extension\MissingDependencyException;

/**
* Install az_metrics.
*/
Expand Down Expand Up @@ -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.');
}
}

0 comments on commit c17dffa

Please sign in to comment.