This commit is contained in:
Saeed Vaziry
2023-07-02 12:47:50 +02:00
commit 5c72f12490
825 changed files with 41659 additions and 0 deletions

View File

@ -0,0 +1,36 @@
<?php
namespace App\SSHCommands\Database;
use App\SSHCommands\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
class BackupDatabaseCommand extends Command
{
protected $provider;
protected $database;
protected $fileName;
public function __construct($provider, $database, $fileName)
{
$this->provider = $provider;
$this->database = $database;
$this->fileName = $fileName;
}
public function file(string $os): string
{
return File::get(base_path('system/commands/database/'.$this->provider.'/backup.sh'));
}
public function content(string $os): string
{
$command = $this->file($os);
$command = Str::replace('__database__', $this->database, $command);
return Str::replace('__file__', $this->fileName, $command);
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace App\SSHCommands\Database;
use App\SSHCommands\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
class CreateCommand extends Command
{
/**
* @var string
*/
protected $provider;
/**
* @var string
*/
protected $name;
public function __construct($provider, $name)
{
$this->provider = $provider;
$this->name = $name;
}
public function file(string $os): string
{
return File::get(base_path('system/commands/database/'.$this->provider.'/create.sh'));
}
public function content(string $os): string
{
return Str::replace('__name__', $this->name, $this->file($os));
}
}

View File

@ -0,0 +1,51 @@
<?php
namespace App\SSHCommands\Database;
use App\SSHCommands\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
class CreateUserCommand extends Command
{
/**
* @var string
*/
protected $provider;
/**
* @var string
*/
protected $username;
/**
* @var string
*/
protected $password;
/**
* @var string
*/
protected $host;
public function __construct($provider, $username, $password, $host)
{
$this->provider = $provider;
$this->username = $username;
$this->password = $password;
$this->host = $host;
}
public function file(string $os): string
{
return File::get(base_path('system/commands/database/'.$this->provider.'/create-user.sh'));
}
public function content(string $os): string
{
$command = Str::replace('__username__', $this->username, $this->file($os));
$command = Str::replace('__password__', $this->password, $command);
return Str::replace('__host__', $this->host, $command);
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace App\SSHCommands\Database;
use App\SSHCommands\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
class DeleteCommand extends Command
{
/**
* @var string
*/
protected $provider;
/**
* @var string
*/
protected $name;
public function __construct($provider, $name)
{
$this->provider = $provider;
$this->name = $name;
}
public function file(string $os): string
{
return File::get(base_path('system/commands/database/'.$this->provider.'/delete.sh'));
}
public function content(string $os): string
{
return Str::replace('__name__', $this->name, $this->file($os));
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace App\SSHCommands\Database;
use App\SSHCommands\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
class DeleteUserCommand extends Command
{
/**
* @var string
*/
protected $provider;
/**
* @var string
*/
protected $username;
/**
* @var string
*/
protected $host;
public function __construct($provider, $username, $host)
{
$this->provider = $provider;
$this->username = $username;
$this->host = $host;
}
public function file(string $os): string
{
return File::get(base_path('system/commands/database/'.$this->provider.'/delete-user.sh'));
}
public function content(string $os): string
{
$command = Str::replace('__username__', $this->username, $this->file($os));
return Str::replace('__host__', $this->host, $command);
}
}

View File

@ -0,0 +1,48 @@
<?php
namespace App\SSHCommands\Database;
use App\SSHCommands\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
class LinkCommand extends Command
{
/**
* @var string
*/
protected $provider;
/**
* @var string
*/
protected $username;
protected $host;
/**
* @var string
*/
protected $database;
public function __construct($provider, $username, $host, $database)
{
$this->provider = $provider;
$this->username = $username;
$this->host = $host;
$this->database = $database;
}
public function file(string $os): string
{
return File::get(base_path('system/commands/database/'.$this->provider.'/link.sh'));
}
public function content(string $os): string
{
$command = Str::replace('__username__', $this->username, $this->file($os));
$command = Str::replace('__host__', $this->host, $command);
return Str::replace('__database__', $this->database, $command);
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace App\SSHCommands\Database;
use App\SSHCommands\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
class RestoreDatabaseCommand extends Command
{
protected $provider;
protected $database;
protected $fileName;
public function __construct($provider, $database, $fileName)
{
$this->provider = $provider;
$this->database = $database;
$this->fileName = $fileName;
}
public function file(string $os): string
{
return File::get(base_path('system/commands/database/'.$this->provider.'/restore.sh'));
}
public function content(string $os): string
{
$command = $this->file($os);
$command = Str::replace('__database__', $this->database, $command);
return Str::replace('__file__', $this->fileName, $command);
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace App\SSHCommands\Database;
use App\SSHCommands\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
class UnlinkCommand extends Command
{
/**
* @var string
*/
protected $provider;
/**
* @var string
*/
protected $username;
protected $host;
public function __construct($provider, $username, $host)
{
$this->provider = $provider;
$this->username = $username;
$this->host = $host;
}
public function file(string $os): string
{
return File::get(base_path('system/commands/database/'.$this->provider.'/unlink.sh'));
}
public function content(string $os): string
{
$command = Str::replace('__username__', $this->username, $this->file($os));
return Str::replace('__host__', $this->host, $command);
}
}