From 455921b75c8bd500f0a72ab024c65501fb9f111e Mon Sep 17 00:00:00 2001 From: Austin Ginder Date: Wed, 29 Jan 2020 13:55:57 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20NEW:=20=20Command=20`captain=20d?= =?UTF-8?q?b-create`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/captain/db-create | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 app/captain/db-create diff --git a/app/captain/db-create b/app/captain/db-create new file mode 100755 index 0000000..df96817 --- /dev/null +++ b/app/captain/db-create @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +# +# Generates new database storage for current Captain ID +# +# `captaincore captain db-create` +# + +# Load configuration +root_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"; root_path=${root_path%app*} +source ${root_path}lib/arguments + +run_command() { + + cd ${root_path}data + + # Generate local WordPress site to store site info + check=$( wp db create ) + if [[ "$check" == "" ]]; then + echo -e "${COLOR_RED}Error:${COLOR_NORMAL} Database storage aleady created for Captain ID $captain_id" + return + fi + random=$( php -r 'echo bin2hex(openssl_random_pseudo_bytes( 4 ));' ) + wp core install --url=https://${random}.captaincore --admin_user=${random}_captaincore_cli --admin_email=support@${random}.captaincore --title="CaptainCore CLI" + wp option update timezone_string America/New_York + wp option update blog_public 0 + wp plugin delete hello-dolly + wp plugin activate captaincore + wp eval "CaptainCore\DB::upgrade();" + +} +run_command \ No newline at end of file