namespace Cubist\Util;
use Cubist\Net\SSH2;
+use Illuminate\Contracts\Foundation\Application;
use Illuminate\Support\Facades\Log;
class CommandLine
$startTime = microtime(true);
$this->_preExecute();
+ $measure = app() instanceof Application && function_exists('start_measure') && function_exists('stop_measure');
if ($fonction instanceof SSH2) {
$this->makeCommande();
- if (function_exists('start_measure')) {
+ if ($measure) {
start_measure('Exec CLI : ' . $this->commande);
}
$o = $fonction->exec($this->commande);
- if (function_exists('stop_measure')) {
+ if ($measure) {
stop_measure('Exec CLI : ' . $this->commande);
}
file_put_contents($this->output, $o['output'] . "\n\n---\n\n" . $o['error']);
} else if (null === $this->ssh) {
$this->makeCommande($this->output, $this->error);
- if (function_exists('start_measure')) {
+ if ($measure) {
start_measure('Exec CLI : ' . $this->commande);
}
$fonction($this->commande);
- if (function_exists('stop_measure')) {
+ if ($measure) {
stop_measure('Exec CLI : ' . $this->commande);
}
} else {
}
$this->commande = $c;
- if (function_exists('start_measure')) {
+
+ if ($measure) {
start_measure('Exec CLI : ' . $this->commande);
}
$fonction($c);
- if (function_exists('stop_measure')) {
+ if ($measure) {
stop_measure('Exec CLI : ' . $this->commande);
}
}