mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
refactoring
This commit is contained in:
46
app/SSHCommands/Wordpress/InstallWordpressCommand.php
Executable file
46
app/SSHCommands/Wordpress/InstallWordpressCommand.php
Executable file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\SSHCommands\Wordpress;
|
||||
|
||||
use App\SSHCommands\Command;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class InstallWordpressCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
protected string $path,
|
||||
protected string $domain,
|
||||
protected string $dbName,
|
||||
protected string $dbUser,
|
||||
protected string $dbPass,
|
||||
protected string $dbHost,
|
||||
protected string $dbPrefix,
|
||||
protected string $username,
|
||||
protected string $password,
|
||||
protected string $email,
|
||||
protected string $title
|
||||
) {
|
||||
}
|
||||
|
||||
public function file(): string
|
||||
{
|
||||
return File::get(resource_path('commands/wordpress/install.sh'));
|
||||
}
|
||||
|
||||
public function content(): string
|
||||
{
|
||||
return str($this->file())
|
||||
->replace('__path__', $this->path)
|
||||
->replace('__domain__', $this->domain)
|
||||
->replace('__db_name__', $this->dbName)
|
||||
->replace('__db_user__', $this->dbUser)
|
||||
->replace('__db_pass__', $this->dbPass)
|
||||
->replace('__db_host__', $this->dbHost)
|
||||
->replace('__db_prefix__', $this->dbPrefix)
|
||||
->replace('__username__', $this->username)
|
||||
->replace('__password__', $this->password)
|
||||
->replace('__title__', $this->title)
|
||||
->replace('__email__', $this->email)
|
||||
->toString();
|
||||
}
|
||||
}
|
37
app/SSHCommands/Wordpress/UpdateWordpressCommand.php
Executable file
37
app/SSHCommands/Wordpress/UpdateWordpressCommand.php
Executable file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\SSHCommands\Wordpress;
|
||||
|
||||
use App\SSHCommands\Command;
|
||||
|
||||
class UpdateWordpressCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
protected string $path,
|
||||
protected string $url,
|
||||
protected string $username,
|
||||
protected string $password,
|
||||
protected string $email,
|
||||
protected string $title
|
||||
) {
|
||||
}
|
||||
|
||||
public function file(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function content(): string
|
||||
{
|
||||
$command = '';
|
||||
if ($this->title) {
|
||||
$command .= 'wp --path='.$this->path.' option update blogname "'.addslashes($this->title).'"'."\n";
|
||||
}
|
||||
if ($this->url) {
|
||||
$command .= 'wp --path='.$this->path.' option update siteurl "'.addslashes($this->url).'"'."\n";
|
||||
$command .= 'wp --path='.$this->path.' option update home "'.addslashes($this->url).'"'."\n";
|
||||
}
|
||||
|
||||
return $command;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user