Skip to content

Commit 9abd096

Browse files
committed
Update log dir creation logic
1 parent 196c7e3 commit 9abd096

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

modules/wp-debug-log-setup-module.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,19 @@ else
4343
printf "${GREEN}Added WP Debug post-start hooks in: ${BOLD}${CONFIG_FILE}${RESET}.\n"
4444
fi
4545

46-
LOG_DIR=$(dirname "$LOG_DIR_VALUE")
46+
LOG_DIR="$(dirname "$LOG_DIR_VALUE")"
4747

4848
# Create log directory if it doesn't exist
49-
if $LOG_DIR; then
50-
printf "${BLUE}Creating log directory...${RESET}\n"
51-
if [ -d $LOG_DIR ]; then
52-
printf "${YELLOW}The '/log' directory already exists. Skipping creation.${RESET}\n"
49+
if [ -n "$LOG_DIR" ]; then
50+
printf "${BLUE}Creating $LOG_DIR directory...${RESET}\n"
51+
if [ -d "$LOG_DIR" ]; then
52+
printf "${YELLOW}The '$LOG_DIR' directory already exists. Skipping creation.${RESET}\n"
5353
else
54-
mkdir $LOG_DIR;
54+
mkdir -p "$LOG_DIR"
5555
# Print success message
56-
printf "${GREEN}New directory created at: ${BOLD}/${LOG_DIR}${RESET}\n"
56+
printf "${GREEN}New directory created at: ${BOLD}${LOG_DIR}${RESET}\n"
5757
fi
58+
else
59+
printf "${RED}LOG_DIR_VALUE is not set. Skipping directory creation.${RESET}\n"
5860
fi
61+

0 commit comments

Comments
 (0)