blob: 95ba77105f226a742cd0dd2dcd4e7649e66010eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<?php
namespace PHPIAC\Modules;
use PHPIAC\Connection;
use PHPIAC\Module\Module;
use PHPIAC\Module\State;
use PHPIAC\Modules\Support\HasPermissions;
class FileModule extends Module
{
use HasPermissions;
protected string $path;
protected string $state = State::PRESENT;
/**
* @inheritDoc
*/
public function checkState(): bool
{
return false;
}
/**
* @inheritDoc
*/
public function getCommands(): array
{
if ($this->state === State::PRESENT) {
Connection::exec(
"sudo touch $this->path" . PHP_EOL .
$this->getPermissions($this->path)
);
}
else {
Connection::exec("sudo rm -rf $this->path");
}
return [];
}
}
|