@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * @return void |
| 30 | 30 | */ |
| 31 | - public function create(){
|
|
| 31 | + public function create() {
|
|
| 32 | 32 | |
| 33 | 33 | $schedulePath = app()->path()->schedule(); |
| 34 | 34 | |
| 35 | - if(!file_exists($schedulePath)){
|
|
| 35 | + if (!file_exists($schedulePath)) {
|
|
| 36 | 36 | $this->directory['schedule'] = $schedulePath; |
| 37 | 37 | $this->file->makeDirectory($this); |
| 38 | 38 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $this->argument['scheduleClass'] = ucfirst($this->argument['schedule']).''; |
| 42 | 42 | $this->argument['projectName'] = strtolower($this->projectName()); |
| 43 | 43 | |
| 44 | - $this->touch['schedule/schedule']= $schedulePath.'/'.$this->argument['schedule'].'.php'; |
|
| 44 | + $this->touch['schedule/schedule'] = $schedulePath.'/'.$this->argument['schedule'].'.php'; |
|
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | $this->file->touch($this); |
@@ -56,14 +56,14 @@ discard block |
||
| 56 | 56 | {
|
| 57 | 57 | $schedules = Utils::glob(app()->path()->schedule()); |
| 58 | 58 | |
| 59 | - if(isset($schedules[$this->argument['schedule']])){
|
|
| 59 | + if (isset($schedules[$this->argument['schedule']])) {
|
|
| 60 | 60 | |
| 61 | 61 | $scheduleNamespace = Utils::getNamespace($schedules[$this->argument['schedule']]); |
| 62 | 62 | $scheduleInstance = app()->resolve($scheduleNamespace); |
| 63 | 63 | |
| 64 | 64 | $command = '*/1 * * * * cd '.root.' && php api schedule run munch schedule:'.lcfirst($this->argument['schedule']).' >> /dev/null 2>&1'; |
| 65 | 65 | |
| 66 | - if($this->cronjob_exists($command)===false){
|
|
| 66 | + if ($this->cronjob_exists($command)===false) {
|
|
| 67 | 67 | |
| 68 | 68 | $output = shell_exec('crontab -l');
|
| 69 | 69 | file_put_contents('/tmp/crontab.txt', $output.''.$command.''.PHP_EOL);
|
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | {
|
| 82 | 82 | $schedules = Utils::glob(app()->path()->schedule()); |
| 83 | 83 | |
| 84 | - if(isset($schedules[$this->argument['schedule']])){
|
|
| 84 | + if (isset($schedules[$this->argument['schedule']])) {
|
|
| 85 | 85 | $scheduleNamespace = Utils::getNamespace($schedules[$this->argument['schedule']]); |
| 86 | 86 | $scheduleInstance = app()->resolve($scheduleNamespace); |
| 87 | 87 | |
@@ -89,20 +89,20 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - private function cronjob_exists($command){
|
|
| 92 | + private function cronjob_exists($command) {
|
|
| 93 | 93 | |
| 94 | - $cronjob_exists=false; |
|
| 94 | + $cronjob_exists = false; |
|
| 95 | 95 | |
| 96 | 96 | exec('crontab -l', $crontab);
|
| 97 | 97 | |
| 98 | 98 | |
| 99 | - if(isset($crontab)&&is_array($crontab)){
|
|
| 99 | + if (isset($crontab) && is_array($crontab)) {
|
|
| 100 | 100 | |
| 101 | 101 | $crontab = array_flip($crontab); |
| 102 | 102 | |
| 103 | - if(isset($crontab[$command])){
|
|
| 103 | + if (isset($crontab[$command])) {
|
|
| 104 | 104 | |
| 105 | - $cronjob_exists=true; |
|
| 105 | + $cronjob_exists = true; |
|
| 106 | 106 | |
| 107 | 107 | } |
| 108 | 108 | |