| @@ 32-64 (lines=33) @@ | ||
| 29 | * $this->taskServiceDisable('systemd', 'httpd')->run(); |
|
| 30 | * ``` |
|
| 31 | */ |
|
| 32 | class Disable extends BaseTask implements CommandInterface |
|
| 33 | { |
|
| 34 | /** |
|
| 35 | * {@inheritdoc} |
|
| 36 | * |
|
| 37 | * @throws \InvalidArgumentException |
|
| 38 | */ |
|
| 39 | public function getCommand() |
|
| 40 | { |
|
| 41 | if ($this->builder === null) { |
|
| 42 | throw new \InvalidArgumentException('Service manager not defined'); |
|
| 43 | } |
|
| 44 | ||
| 45 | $this->builder->disable($this->service); |
|
| 46 | ||
| 47 | if (!$this->verbose) { |
|
| 48 | $this->builder->quiet(); |
|
| 49 | } |
|
| 50 | ||
| 51 | return $this->builder->getCommand(); |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * {@inheritdoc} |
|
| 56 | * |
|
| 57 | * @throws \InvalidArgumentException |
|
| 58 | */ |
|
| 59 | public function run() |
|
| 60 | { |
|
| 61 | $command = $this->getCommand(); |
|
| 62 | ||
| 63 | $this->printTaskInfo('Disabling service...'); |
|
| 64 | return $this->executeCommand($command); |
|
| 65 | } |
|
| 66 | } |
|
| 67 | ||
| @@ 32-64 (lines=33) @@ | ||
| 29 | * $this->taskServiceEnable('systemd', 'httpd')->run(); |
|
| 30 | * ``` |
|
| 31 | */ |
|
| 32 | class Enable extends BaseTask implements CommandInterface |
|
| 33 | { |
|
| 34 | /** |
|
| 35 | * {@inheritdoc} |
|
| 36 | * |
|
| 37 | * @throws \InvalidArgumentException |
|
| 38 | */ |
|
| 39 | public function getCommand() |
|
| 40 | { |
|
| 41 | if ($this->builder === null) { |
|
| 42 | throw new \InvalidArgumentException('Service manager not defined'); |
|
| 43 | } |
|
| 44 | ||
| 45 | $this->builder->enable($this->service); |
|
| 46 | ||
| 47 | if (!$this->verbose) { |
|
| 48 | $this->builder->quiet(); |
|
| 49 | } |
|
| 50 | ||
| 51 | return $this->builder->getCommand(); |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * {@inheritdoc} |
|
| 56 | * |
|
| 57 | * @throws \InvalidArgumentException |
|
| 58 | */ |
|
| 59 | public function run() |
|
| 60 | { |
|
| 61 | $command = $this->getCommand(); |
|
| 62 | ||
| 63 | $this->printTaskInfo('Enabling service...'); |
|
| 64 | return $this->executeCommand($command); |
|
| 65 | } |
|
| 66 | } |
|
| 67 | ||
| @@ 32-64 (lines=33) @@ | ||
| 29 | * $this->taskServiceRestart('systemd', 'httpd')->run(); |
|
| 30 | * ``` |
|
| 31 | */ |
|
| 32 | class Restart extends BaseTask implements CommandInterface |
|
| 33 | { |
|
| 34 | /** |
|
| 35 | * {@inheritdoc} |
|
| 36 | * |
|
| 37 | * @throws \InvalidArgumentException |
|
| 38 | */ |
|
| 39 | public function getCommand() |
|
| 40 | { |
|
| 41 | if ($this->builder === null) { |
|
| 42 | throw new \InvalidArgumentException('Service manager not defined'); |
|
| 43 | } |
|
| 44 | ||
| 45 | $this->builder->restart($this->service); |
|
| 46 | ||
| 47 | if (!$this->verbose) { |
|
| 48 | $this->builder->quiet(); |
|
| 49 | } |
|
| 50 | ||
| 51 | return $this->builder->getCommand(); |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * {@inheritdoc} |
|
| 56 | * |
|
| 57 | * @throws \InvalidArgumentException |
|
| 58 | */ |
|
| 59 | public function run() |
|
| 60 | { |
|
| 61 | $command = $this->getCommand(); |
|
| 62 | ||
| 63 | $this->printTaskInfo('Restarting service...'); |
|
| 64 | return $this->executeCommand($command); |
|
| 65 | } |
|
| 66 | } |
|
| 67 | ||
| @@ 32-64 (lines=33) @@ | ||
| 29 | * $this->taskServiceStart('systemd', 'httpd')->run(); |
|
| 30 | * ``` |
|
| 31 | */ |
|
| 32 | class Start extends BaseTask implements CommandInterface |
|
| 33 | { |
|
| 34 | /** |
|
| 35 | * {@inheritdoc} |
|
| 36 | * |
|
| 37 | * @throws \Exception |
|
| 38 | */ |
|
| 39 | public function getCommand() |
|
| 40 | { |
|
| 41 | if ($this->builder === null) { |
|
| 42 | throw new \InvalidArgumentException('Service manager not defined'); |
|
| 43 | } |
|
| 44 | ||
| 45 | $this->builder->start($this->service); |
|
| 46 | ||
| 47 | if (!$this->verbose) { |
|
| 48 | $this->builder->quiet(); |
|
| 49 | } |
|
| 50 | ||
| 51 | return $this->builder->getCommand(); |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * {@inheritdoc} |
|
| 56 | * |
|
| 57 | * @throws \Exception |
|
| 58 | */ |
|
| 59 | public function run() |
|
| 60 | { |
|
| 61 | $command = $this->getCommand(); |
|
| 62 | ||
| 63 | $this->printTaskInfo('Starting service...'); |
|
| 64 | return $this->executeCommand($command); |
|
| 65 | } |
|
| 66 | } |
|
| 67 | ||
| @@ 32-64 (lines=33) @@ | ||
| 29 | * $this->taskServiceStop('systemd', 'httpd')->run(); |
|
| 30 | * ``` |
|
| 31 | */ |
|
| 32 | class Stop extends BaseTask implements CommandInterface |
|
| 33 | { |
|
| 34 | /** |
|
| 35 | * {@inheritdoc} |
|
| 36 | * |
|
| 37 | * @throws \InvalidArgumentException |
|
| 38 | */ |
|
| 39 | public function getCommand() |
|
| 40 | { |
|
| 41 | if ($this->builder === null) { |
|
| 42 | throw new \InvalidArgumentException('Service manager not defined'); |
|
| 43 | } |
|
| 44 | ||
| 45 | $this->builder->stop($this->service); |
|
| 46 | ||
| 47 | if (!$this->verbose) { |
|
| 48 | $this->builder->quiet(); |
|
| 49 | } |
|
| 50 | ||
| 51 | return $this->builder->getCommand(); |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * {@inheritdoc} |
|
| 56 | * |
|
| 57 | * @throws \InvalidArgumentException |
|
| 58 | */ |
|
| 59 | public function run() |
|
| 60 | { |
|
| 61 | $command = $this->getCommand(); |
|
| 62 | ||
| 63 | $this->printTaskInfo('Stopping service...'); |
|
| 64 | return $this->executeCommand($command); |
|
| 65 | } |
|
| 66 | } |
|
| 67 | ||
| @@ 29-63 (lines=35) @@ | ||
| 26 | * $this->taskServiceReload('systemd', 'httpd')->run(); |
|
| 27 | * ``` |
|
| 28 | */ |
|
| 29 | class Reload extends BaseTask implements CommandInterface |
|
| 30 | { |
|
| 31 | /** |
|
| 32 | * {@inheritdoc} |
|
| 33 | * |
|
| 34 | * @throws \InvalidArgumentException |
|
| 35 | */ |
|
| 36 | public function getCommand() |
|
| 37 | { |
|
| 38 | if ($this->builder === null) { |
|
| 39 | throw new \InvalidArgumentException('Service manager not defined'); |
|
| 40 | } |
|
| 41 | ||
| 42 | $this->builder->reload($this->service); |
|
| 43 | ||
| 44 | if (!$this->verbose) { |
|
| 45 | $this->builder->quiet(); |
|
| 46 | } |
|
| 47 | ||
| 48 | return $this->builder->getCommand(); |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * {@inheritdoc} |
|
| 53 | * |
|
| 54 | * @throws \InvalidArgumentException |
|
| 55 | */ |
|
| 56 | public function run() |
|
| 57 | { |
|
| 58 | $command = $this->getCommand(); |
|
| 59 | ||
| 60 | $this->printTaskInfo('Reloading service...'); |
|
| 61 | return $this->executeCommand($command); |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||