Skip to content

Commit 5c024b3

Browse files
committed
FileServer: added support for permissions [Closes #168]
1 parent 6ad4c51 commit 5c024b3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Deployment/FileServer.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*/
1717
class FileServer implements Server
1818
{
19+
public ?int $filePermissions = null;
20+
public ?int $dirPermissions = null;
1921
private string $root;
2022

2123

@@ -59,6 +61,9 @@ public function readFile(string $remote, string $local): void
5961
public function writeFile(string $local, string $remote, callable $progress = null): void
6062
{
6163
Safe::copy($local, $this->root . $remote);
64+
if ($this->filePermissions) {
65+
$this->chmod($remote, $this->filePermissions);
66+
}
6267
}
6368

6469

@@ -91,7 +96,7 @@ public function renameFile(string $old, string $new): void
9196
public function createDir(string $dir): void
9297
{
9398
if (trim($dir, '/') !== '' && !file_exists($path = $this->root . $dir)) {
94-
Safe::mkdir($path, 0777, true);
99+
Safe::mkdir($path, $this->dirPermissions ?? 0777, true);
95100
}
96101
}
97102

0 commit comments

Comments
 (0)