summaryrefslogtreecommitdiff
path: root/src/CopyModule.php
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2021-04-28 13:58:55 +0200
committerDaniel Weipert <code@drogueronin.de>2021-04-28 13:58:55 +0200
commit20d9f63918d3b2bd75853182063f43eb36d7cd8a (patch)
treeb6f48898297f761dcec8532b524844cc968ec565 /src/CopyModule.php
parent11dc8c730dda2c5bd38cb386f96331c5ce3cac9c (diff)
Adjusts modulesv1.0.0
Diffstat (limited to 'src/CopyModule.php')
-rw-r--r--src/CopyModule.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/CopyModule.php b/src/CopyModule.php
index 069f594..1f0b5c3 100644
--- a/src/CopyModule.php
+++ b/src/CopyModule.php
@@ -4,15 +4,17 @@ namespace PHPIAC\Modules;
use PHPIAC\Connection;
use PHPIAC\Module\Module;
+use PHPIAC\Modules\Support\HandlesFiles;
use PHPIAC\Modules\Support\HasPermissions;
class CopyModule extends Module
{
- use HasPermissions;
+ use HasPermissions, HandlesFiles;
protected string $src;
protected string $dest;
+ protected bool $force = false;
protected bool $remoteSrc = false;
/**
@@ -28,13 +30,17 @@ class CopyModule extends Module
*/
public function checkState(): bool
{
- return false;
+ if ($this->force) {
+ return false;
+ }
+
+ return $this->fileExists($this->dest);
}
/**
* @inheritDoc
*/
- public function getCommands(): array
+ public function execute(): void
{
if ($this->remoteSrc) {
Connection::exec("sudo cp -r $this->src $this->dest");
@@ -44,7 +50,5 @@ class CopyModule extends Module
}
Connection::exec($this->getPermissions($this->dest));
-
- return [];
}
}