Skip to content

Commit 8c1a52e

Browse files
committed
fix: remove plugin_path workflow env, create mu-plugins
1 parent 1d5278b commit 8c1a52e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

main.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,20 +278,21 @@ function block_emails() {
278278

279279
# priority: 1. hosts.yml 2. vip 3. WP
280280
echo -e "\033[34mSETUP EMAIL BLOCKING\033[0m"
281-
if [[ -d "$HTDOCS/wp-content/client-mu-plugins" ]]; then
282-
BLOCK_EMAIL_DIR="$HTDOCS/wp-content/client-mu-plugins"
283-
elif [[ -d "$HTDOCS/wp-content/mu-plugins" ]]; then
284-
BLOCK_EMAIL_DIR="$HTDOCS/wp-content/mu-plugins"
285-
fi
286281

287282
hosts_block_email_dir=$(shyaml get-value "$GITHUB_BRANCH.block_emails_plugin_path" < "$hosts_file" 2>/dev/null || exit 0)
288283

289284
if [[ -n "$hosts_block_email_dir" ]]; then
290285
BLOCK_EMAIL_DIR="$HTDOCS/wp-content/$hosts_block_email_dir"
291-
elif [[ -n "$BLOCK_EMAILS_PLUGIN_PATH" ]]; then
292-
BLOCK_EMAIL_DIR="$HTDOCS/wp-content/$BLOCK_EMAILS_PLUGIN_PATH"
286+
elif [[ -d "$HTDOCS/wp-content/client-mu-plugins" ]]; then
287+
BLOCK_EMAIL_DIR="$HTDOCS/wp-content/client-mu-plugins"
288+
elif [[ -d "$HTDOCS/wp-content/mu-plugins" ]]; then
289+
BLOCK_EMAIL_DIR="$HTDOCS/wp-content/mu-plugins"
290+
else
291+
BLOCK_EMAIL_DIR="$HTDOCS/wp-content/mu-plugins"
292+
mkdir -p "$BLOCK_EMAIL_DIR"
293293
fi
294294

295+
# remove traling slash
295296
BLOCK_EMAIL_DIR="${BLOCK_EMAIL_DIR%/}"
296297

297298
# using this naming convention by default to load this plugin first in mu-plugin loading phase.
@@ -309,7 +310,7 @@ function block_emails() {
309310

310311
if [[ -d "$BLOCK_EMAIL_DIR" ]]; then
311312
rsync -av "/000-block-emails.php" "$BLOCK_EMAIL_PLUGIN_PATH"
312-
echo -e "\033[34mEMAIL BLOCK [Activated]: $BLOCK_EMAIL_PLUGIN_PATH \033[0m"
313+
echo -e "\033[34mEMAIL BLOCK [ACTIVATED]: $BLOCK_EMAIL_PLUGIN_PATH \033[0m"
313314
else
314315
echo -e "\033[31mEMAIL BLOCK [PATH ERROR]: $BLOCK_EMAIL_DIR doesn't exist.\033[0m"
315316

0 commit comments

Comments
 (0)