Built-in File Manager (#458)

This commit is contained in:
Saeed Vaziry
2025-02-16 19:56:21 +01:00
committed by GitHub
parent 75e554ad74
commit e2b9d18a71
17 changed files with 907 additions and 29 deletions

View File

@ -94,11 +94,7 @@ public function connect(bool $sftp = false): void
*/
public function exec(string $command, string $log = '', ?int $siteId = null, ?bool $stream = false, ?callable $streamCallback = null): string
{
if (! $log) {
$log = 'run-command';
}
if (! $this->log) {
if (! $this->log && $log) {
$this->log = ServerLog::make($this->server, $log);
if ($siteId) {
$this->log->forSite($siteId);
@ -122,7 +118,7 @@ public function exec(string $command, string $log = '', ?int $siteId = null, ?bo
$this->connection->setTimeout(0);
if ($stream) {
$this->connection->exec($command, function ($output) use ($streamCallback) {
$this->log->write($output);
$this->log?->write($output);
return $streamCallback($output);
});
@ -131,7 +127,7 @@ public function exec(string $command, string $log = '', ?int $siteId = null, ?bo
} else {
$output = '';
$this->connection->exec($command, function ($out) use (&$output) {
$this->log->write($out);
$this->log?->write($out);
$output .= $out;
});