Updated WP Installer Script

main
Anthony 2025-04-04 22:55:12 +08:00
parent ac5aa4886a
commit 088e1a08e2
2 changed files with 44 additions and 1 deletions

View File

@ -681,7 +681,7 @@ actions:
- cmd[cp]:
user: root
commands:
- bash -c 'cd /var/www/webroot/ROOT && /home/litespeed/mbmanager/install-wordpress.sh --wpusername="${settings.wpusername}" --wppassword="${settings.wppassword}" --wpemail="${settings.wpemail}"'
- bash /home/litespeed/mbmanager/install-wordpress.sh --wpusername="${settings.wpusername}" --wppassword="${settings.wppassword}" --wpemail="${settings.wpemail}"
- return:
type: info
message: "${response.out}"

View File

@ -245,6 +245,49 @@ wp config create \
--dbhost="$DB_HOST" \
--allow-root
# Verify that wp-config.php was created successfully
if [ ! -f "wp-config.php" ]; then
echo -e "${RED}Failed to create wp-config.php. Attempting alternative method...${NC}"
# Try alternative method using direct file creation
echo -e "${YELLOW}Attempting to create wp-config.php manually...${NC}"
cat > wp-config.php <<EOF
<?php
define( 'DB_NAME', '${DB_NAME}' );
define( 'DB_USER', '${DB_USER}' );
define( 'DB_PASSWORD', '${DB_PASSWORD}' );
define( 'DB_HOST', '${DB_HOST}' );
define( 'DB_CHARSET', 'utf8' );
define( 'DB_COLLATE', '' );
define( 'AUTH_KEY', '$(openssl rand -base64 48)' );
define( 'SECURE_AUTH_KEY', '$(openssl rand -base64 48)' );
define( 'LOGGED_IN_KEY', '$(openssl rand -base64 48)' );
define( 'NONCE_KEY', '$(openssl rand -base64 48)' );
define( 'AUTH_SALT', '$(openssl rand -base64 48)' );
define( 'SECURE_AUTH_SALT', '$(openssl rand -base64 48)' );
define( 'LOGGED_IN_SALT', '$(openssl rand -base64 48)' );
define( 'NONCE_SALT', '$(openssl rand -base64 48)' );
\$table_prefix = 'wp_';
define( 'WP_DEBUG', false );
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
require_once ABSPATH . 'wp-settings.php';
EOF
# Check if manual creation was successful
if [ ! -f "wp-config.php" ]; then
echo -e "${RED}Failed to create wp-config.php manually. Installation cannot continue.${NC}"
exit 1
fi
echo -e "${GREEN}Successfully created wp-config.php manually.${NC}"
fi
# Set proper permissions
echo -e "${YELLOW}Setting proper permissions...${NC}"
sudo chown -R litespeed:litespeed "$WP_ROOT"