wip add checks before wp-cli actions

This commit is contained in:
hulamy
2022-09-23 20:35:45 +02:00
parent ea26d08301
commit c931788485

View File

@@ -1,18 +1,22 @@
#!/bin/sh #!/bin/sh
# install wordpress with cli : https://make.wordpress.org/cli/handbook/how-to-install/ # install wordpress with cli : https://make.wordpress.org/cli/handbook/how-to-install/
# commands : https://developer.wordpress.org/cli/commands/
mkdir -p ${WP_DIR} mkdir -p ${WP_DIR}
wp core download --path="${WP_DIR}" --allow-root wp core download --path="${WP_DIR}" --allow-root
# create config file : # create config file :
if ! wp core version --path="${WP_DIR}"; then
wp config create \ wp config create \
--dbhost="${DB_HOST}" \ --dbhost="${DB_HOST}" \
--dbname="${DB_NAME}" \ --dbname="${DB_NAME}" \
--dbuser="${DB_USER}" \ --dbuser="${DB_USER}" \
--dbpass="${DB_PSWD}" \ --dbpass="${DB_PSWD}" \
--path="${WP_DIR}" --allow-root --path="${WP_DIR}" --allow-root
fi
# install wordpress : # install wordpress :
if ! wp core is-installed --path="${WP_DIR}"; then
wp core install \ wp core install \
--url="${WP_URL}" \ --url="${WP_URL}" \
--title="${WP_TITLE}" \ --title="${WP_TITLE}" \
@@ -21,6 +25,7 @@ wp core install \
--admin_password="${WP_ADMIN_PSWD}" \ --admin_password="${WP_ADMIN_PSWD}" \
--skip-email \ --skip-email \
--path="${WP_DIR}" --allow-root --path="${WP_DIR}" --allow-root
fi
# create user : # create user :
wp user create \ wp user create \