From 5ccf415d5171b8ab199cc62097f0f8a5f898ec59 Mon Sep 17 00:00:00 2001 From: Matthew Grasmick Date: Thu, 13 Oct 2016 10:46:49 -0400 Subject: [PATCH] Hiding drush status check output in doctor command. (#554) * Hiding drush status check output in doctor command. * Fixing doctor return property. --- phing/build.yml | 1 + phing/phingcludes/DrushTask.php | 34 ++++++++++++++++++++------------- phing/tasks/blt.xml | 6 +++--- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/phing/build.yml b/phing/build.yml index 269a6cc81..b90d1a577 100644 --- a/phing/build.yml +++ b/phing/build.yml @@ -56,6 +56,7 @@ drush: uri: ${multisite.name} assume: yes passthru: yes + logoutput: yes verbose: ${blt.verbose} multisite: diff --git a/phing/phingcludes/DrushTask.php b/phing/phingcludes/DrushTask.php index ce5482fb1..fc00cfc4c 100644 --- a/phing/phingcludes/DrushTask.php +++ b/phing/phingcludes/DrushTask.php @@ -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. @@ -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. */ @@ -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. */ @@ -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')); } /** @@ -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); + } } } @@ -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) { diff --git a/phing/tasks/blt.xml b/phing/tasks/blt.xml index 91aeacd18..8ac417837 100644 --- a/phing/tasks/blt.xml +++ b/phing/tasks/blt.xml @@ -9,16 +9,16 @@ - + - + - +