| @@ 19-53 (lines=35) @@ | ||
| 16 | /** |
|
| 17 | * SysVinit command builder for Debian based distros. |
|
| 18 | */ |
|
| 19 | class SysVinitDebianCommandBuilder extends SysVinitCommandBuilder |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * {@inheritdoc} |
|
| 23 | */ |
|
| 24 | public function enable($service) |
|
| 25 | { |
|
| 26 | if (empty($service)) { |
|
| 27 | throw new \InvalidArgumentException('No service selected to be enabled'); |
|
| 28 | } |
|
| 29 | ||
| 30 | $this->cmd = 'update-rc.d'; |
|
| 31 | $this->service = $service; |
|
| 32 | $this->action = 'defaults'; |
|
| 33 | ||
| 34 | return $this; |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * {@inheritdoc} |
|
| 39 | */ |
|
| 40 | public function disable($service) |
|
| 41 | { |
|
| 42 | if (empty($service)) { |
|
| 43 | throw new \InvalidArgumentException('No service selected to be disabled'); |
|
| 44 | } |
|
| 45 | ||
| 46 | $this->cmd = 'update-rc.d'; |
|
| 47 | $this->service = $service; |
|
| 48 | $this->action = 'remove'; |
|
| 49 | $this->options[] = '-f'; |
|
| 50 | ||
| 51 | return $this; |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||
| @@ 19-52 (lines=34) @@ | ||
| 16 | /** |
|
| 17 | * SysVinit command builder for Red Hat based distros. |
|
| 18 | */ |
|
| 19 | class SysVinitRedHatCommandBuilder extends SysVinitCommandBuilder |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * {@inheritdoc} |
|
| 23 | */ |
|
| 24 | public function enable($service) |
|
| 25 | { |
|
| 26 | if (empty($service)) { |
|
| 27 | throw new \InvalidArgumentException('No service selected to be enabled'); |
|
| 28 | } |
|
| 29 | ||
| 30 | $this->cmd = 'chkconfig'; |
|
| 31 | $this->service = $service; |
|
| 32 | $this->action = 'on'; |
|
| 33 | ||
| 34 | return $this; |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * {@inheritdoc} |
|
| 39 | */ |
|
| 40 | public function disable($service) |
|
| 41 | { |
|
| 42 | if (empty($service)) { |
|
| 43 | throw new \InvalidArgumentException('No service selected to be disabled'); |
|
| 44 | } |
|
| 45 | ||
| 46 | $this->cmd = 'chkconfig'; |
|
| 47 | $this->service = $service; |
|
| 48 | $this->action = 'off'; |
|
| 49 | ||
| 50 | return $this; |
|
| 51 | } |
|
| 52 | } |
|
| 53 | ||