diff options
Diffstat (limited to 'src/CopyModule.php')
-rw-r--r-- | src/CopyModule.php | 14 |
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 []; } } |