runPull()) { $this->error("An error occurred while executing 'git pull'. \nLogs:"); foreach($this->pullLog as $logLine) { $this->info($logLine); } return; } if($this->alreadyUpToDate) { $this->info("The application is already up-to-date"); return; } if(!$this->runComposer()) { $this->error("Error while updating composer files. \nLogs:"); foreach($this->composerLog as $logLine) { $this->info($logLine); } return; } $this->info("Succesfully updated the application."); } /** * Run git pull process * * @return boolean */ private function runPull() { $addSafe = Process::fromShellCommandline('git config --global --add safe.directory /var/www/MORBLOX-WEBSITE/morblox-site'); $addSafe->setWorkingDirectory(base_path()); $process = Process::fromShellCommandline('git pull'); $process->setWorkingDirectory(base_path()); $this->info("Running 'git pull'"); $addSafe->run(function($type, $buffer) { $this->pullLog[] = $buffer; }); $process->run(function($type, $buffer) { $this->pullLog[] = $buffer; if($buffer == "Already up to date.\n") { $this->alreadyUpToDate = TRUE; } }); return $process->isSuccessful(); } /** * Run composer install process * * @return boolean */ private function runComposer() { $process = new Process(['composer install']); $this->info("Running 'composer install'"); $process->run(function($type, $buffer) { $this->composerLog[] = $buffer; }); return $process->isSuccessful(); } }