Execute a Drush command.
public execute ( array $args, string $dir = null, boolean $mustRun = false, boolean $quiet = true ) : string | boolean | ||
$args | array | Command arguments (everything after 'drush'). |
$dir | string | The working directory. |
$mustRun | boolean | Enable exceptions if the command fails. |
$quiet | boolean | Suppress command output. |
return | string | boolean |
/** * Build in 'profile' mode: the application contains a site profile. * * @param string $profileName * * @throws \Exception */ protected function buildInProfileMode($profileName) { $drushHelper = new DrushHelper($this->output); $drushHelper->ensureInstalled(); // Find the contrib make file. if (file_exists($this->appRoot . '/project.make')) { $projectMake = $this->appRoot . '/project.make'; } elseif (file_exists($this->appRoot . '/drupal-org.make')) { $projectMake = $this->appRoot . '/drupal-org.make'; } else { throw new \Exception("Couldn't find a project.make or drupal-org.make in the directory."); } // Find the core make file. if (file_exists($this->appRoot . '/project-core.make')) { $projectCoreMake = $this->appRoot . '/project-core.make'; } elseif (file_exists($this->appRoot . '/drupal-org-core.make')) { $projectCoreMake = $this->appRoot . '/drupal-org-core.make'; } else { throw new \Exception("Couldn't find a project-core.make or drupal-org-core.make in the directory."); } $args = array_merge(array('make', $projectCoreMake, $this->buildDir), $this->drushFlags); $drushHelper->execute($args, null, true, false); $profileDir = $this->buildDir . '/profiles/' . $profileName; mkdir($profileDir, 0755, true); $this->output->writeln("Building the profile: <info>{$profileName}</info>"); $args = array_merge(array('make', '--no-core', '--contrib-destination=.', $projectMake), $this->drushFlags); $drushHelper->execute($args, $profileDir, true, false); $this->output->writeln("Symlinking existing app files to the profile"); $this->ignoredFiles[] = basename($projectMake); $this->ignoredFiles[] = basename($projectCoreMake); $this->ignoredFiles[] = 'settings.local.php'; $this->specialDestinations['settings*.php'] = '{webroot}/sites/default'; $this->specialDestinations['sites.php'] = '{webroot}/sites'; $this->processSettingsPhp(); // Symlink recursively; skip existing files (built by Drush make) for // example 'modules/contrib', but include files from the app such as // 'modules/custom'. $this->fsHelper->symlinkAll($this->appRoot, $profileDir, true, true, array_merge($this->ignoredFiles, array_keys($this->specialDestinations))); }