forked from acquia/blt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent cache collisions in multisite db-update tasks (acquia#3166)
* Add drush cache dir utility script. * Enhanced Factory Hook to isolate db-update tasks to tempoary drush cache. * Update Factory Hooks from BLT template. * Remove redundant cache clear and rebuild to preserve drush context of current request. * Style tweaks and setting update version number to 9.2.
- Loading branch information
Showing
4 changed files
with
67 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Creates a unique temporary cache directory given a site, env, and uri. | ||
* This is used for every blt command invocation on site install and update. | ||
*/ | ||
|
||
$site = $argv[1]; | ||
$env = $argv[2]; | ||
$uri = $argv[3]; | ||
|
||
|
||
if (empty($argv[3])) { | ||
echo "Error: Not enough arguments. Site, environment, and uri are required.\n"; | ||
exit(1); | ||
} | ||
|
||
// Create a temporary cache directory for this drush process only. | ||
$cache_directory = sprintf('/mnt/tmp/%s.%s/drush_tmp_cache/%s', $site, $env, md5($uri)); | ||
shell_exec(sprintf('mkdir -p %s', escapeshellarg($cache_directory))); | ||
|
||
if (!file_exists($cache_directory)) { | ||
syslog(LOG_ERR, sprintf('Drush updates could not be executed, as the required cache directory [%s] is missing.', $cache_directory)); | ||
die('Missing or corrupted drush cache for this process.'); | ||
} | ||
else { | ||
echo "$cache_directory"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters