mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +00:00
init
This commit is contained in:
37
app/SSHCommands/Storage/DownloadFromDropboxCommand.php
Normal file
37
app/SSHCommands/Storage/DownloadFromDropboxCommand.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\SSHCommands\Storage;
|
||||
|
||||
use App\SSHCommands\Command;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DownloadFromDropboxCommand extends Command
|
||||
{
|
||||
protected $src;
|
||||
|
||||
protected $dest;
|
||||
|
||||
protected $token;
|
||||
|
||||
public function __construct($src, $dest, $token)
|
||||
{
|
||||
$this->src = $src;
|
||||
$this->dest = $dest;
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
public function file(string $os): string
|
||||
{
|
||||
return File::get(base_path('system/commands/common/storage/download-from-dropbox.sh'));
|
||||
}
|
||||
|
||||
public function content(string $os): string
|
||||
{
|
||||
$command = $this->file($os);
|
||||
$command = Str::replace('__src__', $this->src, $command);
|
||||
$command = Str::replace('__dest__', $this->dest, $command);
|
||||
|
||||
return Str::replace('__token__', $this->token, $command);
|
||||
}
|
||||
}
|
37
app/SSHCommands/Storage/UploadToDropboxCommand.php
Normal file
37
app/SSHCommands/Storage/UploadToDropboxCommand.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\SSHCommands\Storage;
|
||||
|
||||
use App\SSHCommands\Command;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class UploadToDropboxCommand extends Command
|
||||
{
|
||||
protected $src;
|
||||
|
||||
protected $dest;
|
||||
|
||||
protected $token;
|
||||
|
||||
public function __construct($src, $dest, $token)
|
||||
{
|
||||
$this->src = $src;
|
||||
$this->dest = $dest;
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
public function file(string $os): string
|
||||
{
|
||||
return File::get(base_path('system/commands/common/storage/upload-to-dropbox.sh'));
|
||||
}
|
||||
|
||||
public function content(string $os): string
|
||||
{
|
||||
$command = $this->file($os);
|
||||
$command = Str::replace('__src__', $this->src, $command);
|
||||
$command = Str::replace('__dest__', $this->dest, $command);
|
||||
|
||||
return Str::replace('__token__', $this->token, $command);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user