Updated wordpress instlal

main
Anthony 2025-06-24 22:48:37 +08:00
parent d31d09fd79
commit cd0bf962db
1 changed files with 33 additions and 3 deletions

View File

@ -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..."