On Acquia Cloud, the Drush background import check that runs on /admin/content/migrate/configure fails even with $conf['migrate_drush_path']
configured correctly to /usr/local/bin/drush
. I stepped through the code below with Devel from inside a site, and noticed that the "drush status" that is run returns most information, but does not return a proper "Drupal bootstrap: Successful", which is what the code is checking for. When I output the value of $command
, and run it directly on the server, it does output "Drupal bootstrap: Successful" as it should.
I was not able to figure out why the output did not include the bootstrap info when run from the site, so it's unclear if it's something with Acquia or something that can be fixed in this code. I opened a support ticket with Acquia (#230646) about this and they verified the background migrate task worked. The migration appears to be able to be run in the background, it's just that the check makes it appear to be configured incorrectly in the UI.
The snippet below is where the check happens, and causes $drush_validated
to still be FALSE, and report that "Drush is misconfigured on the server". Thanks!
if ($drush_path && is_executable($drush_path)) {
// Try running a drush status command to verify it's properly configured.
$uri = $GLOBALS['base_url'];
$uid = $GLOBALS['user']->uid;
$command = "$drush_path status --user=$uid --uri=$uri --root=" . DRUPAL_ROOT;
exec($command, $output, $status);
if ($status == 0) {
$version = '';
foreach ($output as $line) {
if (preg_match('|Drush version +: +(.*)|', $line, $matches)) {
$version = trim($matches[1]);
}
elseif (preg_match('|Drupal bootstrap +: +Successful *|', $line, $matches)) {
$drush_validated = TRUE;
}
}
}
Comment | File | Size | Author |
---|---|---|---|
#4 | migrate_drush_background-2599200-4.patch | 1.82 KB | vinmassaro |
|
Comments
Comment #2
vinmassaro CreditAttribution: vinmassaro commentedComment #3
vinmassaro CreditAttribution: vinmassaro commentedI received this response from Acquia support (#242926):
Attached is a patch that fixes this issue by checking if the AH_SITE_ENVIRONMENT environment variable is set, and adding the script prefix before the drush command. I've tested it on Acquia Cloud and am able to run migrations in the background from the UI.
Comment #4
vinmassaro CreditAttribution: vinmassaro commentedNew patch with updated comment.
Comment #5
pifagorComment #7
pifagorComment #9
joseph.olstadhttps://www.drupal.org/project/migrate/releases/7.x-2.12