mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
init
This commit is contained in:
31
app/SSHCommands/EditFileCommand.php
Normal file
31
app/SSHCommands/EditFileCommand.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\SSHCommands;
|
||||
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class EditFileCommand extends Command
|
||||
{
|
||||
protected $path;
|
||||
|
||||
protected $content;
|
||||
|
||||
public function __construct($path, $content)
|
||||
{
|
||||
$this->path = $path;
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
public function file(string $os): string
|
||||
{
|
||||
return File::get(base_path('system/commands/common/edit-file.sh'));
|
||||
}
|
||||
|
||||
public function content(string $os): string
|
||||
{
|
||||
$command = Str::replace('__path__', $this->path, $this->file($os));
|
||||
|
||||
return Str::replace('__content__', addslashes($this->content), $command);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user