From cd0bf962db5b37874403014c886fe13ddfa4edfe Mon Sep 17 00:00:00 2001 From: Anthony Date: Tue, 24 Jun 2025 22:48:37 +0800 Subject: [PATCH] Updated wordpress instlal --- scripts/install-wordpress.sh | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/scripts/install-wordpress.sh b/scripts/install-wordpress.sh index cacd3c5..e95f2bc 100644 --- a/scripts/install-wordpress.sh +++ b/scripts/install-wordpress.sh @@ -607,10 +607,40 @@ if ! $SUDO_CMD $WP_EXECUTABLE core is-installed "${WP_RUN_ARGS[@]}"; then # Use determined $SUDO_CMD, $WP_EXECUTABLE, and $WP_RUN_ARGS $SUDO_CMD $WP_EXECUTABLE plugin delete akismet hello "${WP_RUN_ARGS[@]}" --quiet || warning "Could not delete default plugins (might not exist)." - # Install and activate LiteSpeed Cache plugin + # Install LiteSpeed Cache plugin (without activating yet) info "Installing LiteSpeed Cache plugin..." - if $SUDO_CMD $WP_EXECUTABLE plugin install litespeed-cache "${WP_RUN_ARGS[@]}" --activate; then - success "LiteSpeed Cache plugin installed and activated successfully." + if $SUDO_CMD $WP_EXECUTABLE plugin install litespeed-cache "${WP_RUN_ARGS[@]}"; then + success "LiteSpeed Cache plugin installed successfully." + + # Create necessary LiteSpeed Cache directories BEFORE activation + info "Creating LiteSpeed Cache directories before activation..." + LITESPEED_CACHE_DIR="$WP_ROOT/wp-content/litespeed" + if [[ ! -d "$LITESPEED_CACHE_DIR" ]]; then + sudo mkdir -p "$LITESPEED_CACHE_DIR" + sudo chown -R "${WEB_USER}:${WEB_GROUP}" "$LITESPEED_CACHE_DIR" + sudo chmod -R 755 "$LITESPEED_CACHE_DIR" + success "LiteSpeed Cache directory created: $LITESPEED_CACHE_DIR" + else + info "LiteSpeed Cache directory already exists: $LITESPEED_CACHE_DIR" + fi + + # Create subdirectories that the plugin commonly uses + for subdir in css js img tmp; do + SUBDIR_PATH="$LITESPEED_CACHE_DIR/$subdir" + if [[ ! -d "$SUBDIR_PATH" ]]; then + sudo mkdir -p "$SUBDIR_PATH" + sudo chown -R "${WEB_USER}:${WEB_GROUP}" "$SUBDIR_PATH" + sudo chmod -R 755 "$SUBDIR_PATH" + fi + done + + # Now activate the plugin after directories are ready + info "Activating LiteSpeed Cache plugin..." + if $SUDO_CMD $WP_EXECUTABLE plugin activate litespeed-cache "${WP_RUN_ARGS[@]}"; then + success "LiteSpeed Cache plugin activated successfully." + else + warning "Failed to activate LiteSpeed Cache plugin after installation." + fi # Configure basic LiteSpeed Cache settings info "Configuring basic LiteSpeed Cache settings..."