appDown(); $running = $this->stopTmux(); try { $output = $this->call('nntmux:git'); if ($output === 'Already up-to-date.') { $this->info($output); } else { $status = $this->call('nntmux:composer'); if ($status) { $this->error('Composer failed to update!!'); } $fail = $this->call('nntmux:db'); if ($fail) { $this->error('Db updating failed!!'); } } } catch (\Exception $e) { $this->error($e->getMessage()); } $cleared = (new Smarty())->setCompileDir(config('ytake-laravel-smarty.compile_path'))->clearCompiledTemplate(); if ($cleared) { $this->output->writeln('The Smarty compiled template cache has been cleaned for you'); } else { $this->output->writeln( 'You should clear your Smarty compiled template cache at: '. config('ytake-laravel-smarty.compile_path').'' ); } if ($maintenance === true) { $this->call('up'); } if ($running === true) { $this->startTmux(); } } /** * @return bool */ private function appDown(): bool { if (App::isDownForMaintenance() === false) { $this->call('down', ['--render' => 'errors::maintenance', '--retry' => 120]); return true; } return false; } /** * @return bool */ private function stopTmux(): bool { if ((new Tmux())->isRunning() === true) { $this->call('tmux-ui:stop', ['--kill' => true]); return true; } return false; } private function startTmux(): void { $this->call('tmux-ui:start'); } }