Skip to content

Instantly share code, notes, and snippets.

@wilfi
Created May 12, 2022 12:55
Show Gist options
  • Save wilfi/45de590c6c48318d4c6eb4ec8a86182b to your computer and use it in GitHub Desktop.
Save wilfi/45de590c6c48318d4c6eb4ec8a86182b to your computer and use it in GitHub Desktop.
Replace the updateSite() in \Blt\Plugin\Commands ; Line 22 will ensure the drupal cache is cleared for the respective multisite.
/**
* Execute updates on a specific site.
*
* @param string $multisite
* Multisite.
*
* @throws \Acquia\Blt\Robo\Exceptions\BltException
*/
protected function updateSite($multisite) {
// Workaround to perform db updates before site context.
$this->say("Performing DB Updates on <comment>$multisite</comment>...");
$root = $this->getConfigValue('repo.root');
$this->taskDrush()->dir($root . '/docroot/sites/' . $multisite)
->stopOnFail()->uri($multisite)
->drush('updb')->run();
$this->switchSiteContext($multisite);
if ($this->getInspector()->isDrupalInstalled()) {
$this->say("Deploying updates to <comment>$multisite</comment>...");
$this->invokeCommand('drupal:update');
$this->say("Finished deploying updates to $multisite.");
$multisite_cache = $this->taskDrush()->dir($root . '/docroot/sites/' . $multisite)
->stopOnFail()->uri($multisite)
->drush('cr')->run();
if ($multisite_cache->wasSuccessful()) {
$this->say("Drupal cache cleared for $multisite.");
}
}
else {
$this->logger->warning("Drupal is not installed for $multisite. Skipping updates.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment