@@ -305,7 +305,7 @@ |
||
| 305 | 305 | |
| 306 | 306 | $events = Spyc::YAMLLoad(EXTENDER_PLUGINS_CONFIG); |
| 307 | 307 | |
| 308 | - foreach ($events as $event) { |
|
| 308 | + foreach ( $events as $event ) { |
|
| 309 | 309 | |
| 310 | 310 | $method = empty($event["data"]["method"]) ? null : $event["data"]["method"]; |
| 311 | 311 | |
@@ -200,7 +200,7 @@ |
||
| 200 | 200 | |
| 201 | 201 | $commands = Spyc::YAMLLoad(EXTENDER_COMMANDS_CONFIG); |
| 202 | 202 | |
| 203 | - foreach ($commands as $command => $parameters) { |
|
| 203 | + foreach ( $commands as $command => $parameters ) { |
|
| 204 | 204 | |
| 205 | 205 | $controller->add($command, $parameters["data"]); |
| 206 | 206 | |
@@ -180,7 +180,7 @@ |
||
| 180 | 180 | |
| 181 | 181 | $tasks = Spyc::YAMLLoad(EXTENDER_TASKS_CONFIG); |
| 182 | 182 | |
| 183 | - foreach ($tasks as $task => $parameters) { |
|
| 183 | + foreach ( $tasks as $task => $parameters ) { |
|
| 184 | 184 | |
| 185 | 185 | $description = empty($parameters["data"]["description"]) ? null : $parameters["data"]["description"]; |
| 186 | 186 | |
@@ -482,7 +482,7 @@ |
||
| 482 | 482 | ) |
| 483 | 483 | )) : 1; |
| 484 | 484 | |
| 485 | - while (true) { |
|
| 485 | + while ( true ) { |
|
| 486 | 486 | |
| 487 | 487 | $this->cycle(); |
| 488 | 488 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | $this->logger->info("Received TERM signal, shutting down process gracefully"); |
| 127 | 127 | |
| 128 | - $this->events->emit( new SignalEvent($signal, $this) ); |
|
| 128 | + $this->events->emit(new SignalEvent($signal, $this)); |
|
| 129 | 129 | |
| 130 | 130 | $this->end(0); |
| 131 | 131 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | $this->logger->info("Received TERM signal, shutting down process"); |
| 146 | 146 | |
| 147 | - $this->events->emit( new SignalEvent($signal, $this) ); |
|
| 147 | + $this->events->emit(new SignalEvent($signal, $this)); |
|
| 148 | 148 | |
| 149 | 149 | $this->end(1); |
| 150 | 150 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | $this->logger->info("Received $signal signal, firing associated event(s)"); |
| 165 | 165 | |
| 166 | - $this->events->emit( new SignalEvent($signal, $this) ); |
|
| 166 | + $this->events->emit(new SignalEvent($signal, $this)); |
|
| 167 | 167 | |
| 168 | 168 | } |
| 169 | 169 | |
@@ -109,29 +109,29 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $this->logger->notice("Starting daemon (looping each ".$this->looptime." secs, pid: ".$this->pid.")"); |
| 111 | 111 | |
| 112 | - $this->events->emit( new DaemonEvent('start', $this) ); |
|
| 112 | + $this->events->emit(new DaemonEvent('start', $this)); |
|
| 113 | 113 | |
| 114 | - while ($this->loopactive) { |
|
| 114 | + while ( $this->loopactive ) { |
|
| 115 | 115 | |
| 116 | 116 | $start = microtime(true); |
| 117 | 117 | |
| 118 | 118 | pcntl_signal_dispatch(); |
| 119 | 119 | |
| 120 | - $this->events->emit( new DaemonEvent('preloop', $this) ); |
|
| 120 | + $this->events->emit(new DaemonEvent('preloop', $this)); |
|
| 121 | 121 | |
| 122 | - if ( $this->runlock->check() && $this->loopactive) { |
|
| 122 | + if ( $this->runlock->check() && $this->loopactive ) { |
|
| 123 | 123 | |
| 124 | - $this->events->emit( new DaemonEvent('loopstart', $this) ); |
|
| 124 | + $this->events->emit(new DaemonEvent('loopstart', $this)); |
|
| 125 | 125 | |
| 126 | 126 | $this->loop(); |
| 127 | 127 | |
| 128 | - $this->events->emit( new DaemonEvent('loopstop', $this) ); |
|
| 128 | + $this->events->emit(new DaemonEvent('loopstop', $this)); |
|
| 129 | 129 | |
| 130 | 130 | $this->loopcount++; |
| 131 | 131 | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - $this->events->emit( new DaemonEvent('postloop', $this) ); |
|
| 134 | + $this->events->emit(new DaemonEvent('postloop', $this)); |
|
| 135 | 135 | |
| 136 | 136 | $this->loopelapsed = (microtime(true) - $start); |
| 137 | 137 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | $this->logger->notice("Stopping daemon (pid: ".$this->pid.")"); |
| 145 | 145 | |
| 146 | - $this->events->emit( new DaemonEvent('stop', $this) ); |
|
| 146 | + $this->events->emit(new DaemonEvent('stop', $this)); |
|
| 147 | 147 | |
| 148 | 148 | $this->end(0); |
| 149 | 149 | |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | ) { |
| 28 | 28 | |
| 29 | 29 | // parsing configuration |
| 30 | - $this->configuration = new Configuration( DefaultConfiguration::get() ); |
|
| 30 | + $this->configuration = new Configuration(DefaultConfiguration::get()); |
|
| 31 | 31 | $this->configuration->merge($configuration); |
| 32 | 32 | |
| 33 | 33 | // fix the daemon start time |
@@ -14,24 +14,24 @@ |
||
| 14 | 14 | $chars = 60; |
| 15 | 15 | |
| 16 | 16 | // show the header |
| 17 | - $console->br()->border('-',$chars); |
|
| 17 | + $console->br()->border('-', $chars); |
|
| 18 | 18 | $console->bold()->flank('Extender execution summary'); |
| 19 | - $console->border('-',$chars); |
|
| 19 | + $console->border('-', $chars); |
|
| 20 | 20 | $console->out('Total run time: '.self::calculateRunTime($daemon->starttime)); |
| 21 | - $console->border('-',$chars); |
|
| 21 | + $console->border('-', $chars); |
|
| 22 | 22 | $padding = $console->padding(26); |
| 23 | - $padding->label('Total processed jobs')->result($daemon->completedjobs+$daemon->failedjobs); |
|
| 23 | + $padding->label('Total processed jobs')->result($daemon->completedjobs + $daemon->failedjobs); |
|
| 24 | 24 | $padding = $console->padding(30); |
| 25 | 25 | $padding->label('├─ Completed')->result('<light_green>'.$daemon->completedjobs.'</green>'); |
| 26 | 26 | $padding->label('└─ Failed')->result('<red>'.$daemon->failedjobs.'</red>'); |
| 27 | - $console->border('-',$chars); |
|
| 27 | + $console->border('-', $chars); |
|
| 28 | 28 | |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | private static function calculateRunTime($starttime) { |
| 32 | 32 | |
| 33 | - $start_formatted = sprintf("%06d",($starttime - floor($starttime)) * 1000000); |
|
| 34 | - $start = new DateTime( date('Y-m-d H:i:s.'.$start_formatted, $starttime) ); |
|
| 33 | + $start_formatted = sprintf("%06d", ($starttime - floor($starttime)) * 1000000); |
|
| 34 | + $start = new DateTime(date('Y-m-d H:i:s.'.$start_formatted, $starttime)); |
|
| 35 | 35 | $end = new DateTime(); |
| 36 | 36 | |
| 37 | 37 | $diff = $end->diff($start); |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | $daemon = $event->getDaemon(); |
| 11 | 11 | |
| 12 | - if ( $daemon->looplimit === $daemon->loopcount) { |
|
| 12 | + if ( $daemon->looplimit === $daemon->loopcount ) { |
|
| 13 | 13 | $daemon->logger->info('Stopping daemon due to loop limit ('.$daemon->looplimit.') reached'); |
| 14 | 14 | // $daemon->stop(); |
| 15 | 15 | $daemon->loopactive = false; |