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