blob: 069f5949088096c1e448f1ad0906f1f3a6c627d4 (
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
44
45
46
47
48
49
50
|
<?php
namespace PHPIAC\Modules;
use PHPIAC\Connection;
use PHPIAC\Module\Module;
use PHPIAC\Modules\Support\HasPermissions;
class CopyModule extends Module
{
use HasPermissions;
protected string $src;
protected string $dest;
protected bool $remoteSrc = false;
/**
* @inheritDoc
*/
public function __construct(array $config)
{
parent::__construct($config);
}
/**
* @inheritDoc
*/
public function checkState(): bool
{
return false;
}
/**
* @inheritDoc
*/
public function getCommands(): array
{
if ($this->remoteSrc) {
Connection::exec("sudo cp -r $this->src $this->dest");
}
else {
Connection::put($this->dest, $this->src);
}
Connection::exec($this->getPermissions($this->dest));
return [];
}
}
|