Skip to content

Commit

Permalink
Hiding drush status check output in doctor command. (#554)
Browse files Browse the repository at this point in the history
* Hiding drush status check output in doctor command.

* Fixing doctor return property.
  • Loading branch information
grasmash authored Oct 13, 2016
1 parent ef57f4c commit 5ccf415
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
1 change: 1 addition & 0 deletions phing/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ drush:
uri: ${multisite.name}
assume: yes
passthru: yes
logoutput: yes
verbose: ${blt.verbose}

multisite:
Expand Down
34 changes: 21 additions & 13 deletions phing/phingcludes/DrushTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ class DrushTask extends Task {
private $pipe = FALSE;
private $options = array();
private $params = array();
private $return_glue = "\n";
private $return_property = NULL;
private $verbose = FALSE;
private $haltonerror = TRUE;
private $passthru = FALSE;
private $logoutput = TRUE;

/**
* The Drush command to run.
Expand Down Expand Up @@ -154,13 +154,6 @@ public function setPipe($var) {
}
}

/**
* The 'glue' characters used between each line of the returned output.
*/
public function setReturnGlue($str) {
$this->return_glue = (string) $str;
}

/**
* The name of a Phing property to assign the Drush command's output to.
*/
Expand Down Expand Up @@ -220,6 +213,17 @@ public function setPassthru($var) {
}
}

/**
* Log output.
*/
public function setLogOutput($var) {
if (is_string($var)) {
$this->logoutput = ($var === 'yes' || $var === 'true');
} else {
$this->logoutput = !!$var;
}
}

/**
* Initialize the task.
*/
Expand All @@ -233,6 +237,7 @@ public function init() {
$this->setVerbose($this->getProject()->getProperty('drush.verbose'));
$this->setAssume($this->getProject()->getProperty('drush.assume'));
$this->setPassthru($this->getProject()->getProperty('drush.passthru'));
$this->setLogOutput($this->getProject()->getProperty('drush.logoutput'));
}

/**
Expand Down Expand Up @@ -322,9 +327,12 @@ public function main() {
$command = implode(' ', $command);
$this->log("Executing: $command");
exec($command, $output, $return);
// Collect Drush output for display through Phing's log.
foreach ($output as $line) {
$this->log($line);

if ($this->logoutput) {
// Collect Drush output for display through Phing's log.
foreach ($output as $line) {
$this->log($line);
}
}
}

Expand All @@ -333,9 +341,9 @@ public function main() {
chdir($initial_cwd);
}

// Set value of the 'pipe' property.
// Set value of the return property.
if (!empty($this->return_property)) {
$this->getProject()->setProperty($this->return_property, implode($this->return_glue, $output));
$this->getProject()->setProperty($this->return_property, $return);
}
// Build fail.
if ($this->haltonerror && $return != 0) {
Expand Down
6 changes: 3 additions & 3 deletions phing/tasks/blt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
</target>

<target name="doctor" description="Inspects your local blt configuration for possible issues.">
<drush command="status" returnProperty="drush.status" haltonerror="false" passthru="false" verbose="false"/>
<drush command="status" returnProperty="drush.status" haltonerror="false" passthru="false" verbose="false" logoutput="false"/>
<if>
<equals arg1="${drush.status}" arg2="0"/>
<then>
<drush command="blt-doctor" verbose="false" uri="" dir="${docroot}">
<drush command="blt-doctor" verbose="false" dir="${docroot}">
<option name="include">../vendor/acquia/blt/drush</option>
</drush>
</then>
<else>
<drush command="blt-doctor" verbose="false" uri="" dir="${docroot}" alias="">
<drush command="blt-doctor" verbose="false" dir="${docroot}" alias="">
<option name="include">../vendor/acquia/blt/drush</option>
</drush>
</else>
Expand Down

0 comments on commit 5ccf415

Please sign in to comment.