mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-07 08:52:35 +00:00
Merge (#127)
This commit is contained in:
31
app/SSH/Wordpress/Wordpress.php
Normal file
31
app/SSH/Wordpress/Wordpress.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\SSH\Wordpress;
|
||||
|
||||
use App\Models\Site;
|
||||
use App\SSH\HasScripts;
|
||||
|
||||
class Wordpress
|
||||
{
|
||||
use HasScripts;
|
||||
|
||||
public function install(Site $site): void
|
||||
{
|
||||
$site->server->ssh()->exec(
|
||||
$this->getScript('install.sh', [
|
||||
'path' => $site->path,
|
||||
'domain' => $site->domain,
|
||||
'db_name' => $site->type_data['database'],
|
||||
'db_user' => $site->type_data['database_user'],
|
||||
'db_pass' => $site->type_data['database_password'],
|
||||
'db_host' => 'localhost',
|
||||
'db_prefix' => 'wp_',
|
||||
'username' => $site->type_data['username'],
|
||||
'password' => $site->type_data['password'],
|
||||
'email' => $site->type_data['email'],
|
||||
'title' => $site->type_data['title'],
|
||||
]),
|
||||
'install-wordpress'
|
||||
);
|
||||
}
|
||||
}
|
27
app/SSH/Wordpress/scripts/install.sh
Normal file
27
app/SSH/Wordpress/scripts/install.sh
Normal file
@ -0,0 +1,27 @@
|
||||
if ! curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! chmod +x wp-cli.phar; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo mv wp-cli.phar /usr/local/bin/wp; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
rm -rf __path__
|
||||
|
||||
if ! wp --path=__path__ core download; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! wp --path=__path__ core config --dbname='__db_name__' --dbuser='__db_user__' --dbpass='__db_pass__' --dbhost='__db_host__' --dbprefix='__db_prefix__'; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! wp --path=__path__ core install --url='http://__domain__' --title="__title__" --admin_user='__username__' --admin_password="__password__" --admin_email='__email__'; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
print "Wordpress installed!"
|
Reference in New Issue
Block a user