🏨 Hotel Booking Enhancements: - Implemented Eagle Booking Advanced Pricing add-on - Added Booking.com-style rate management system - Created professional calendar interface for pricing - Integrated deals and discounts functionality 💰 Advanced Pricing Features: - Dynamic pricing models (per room, per person, per adult) - Base rates, adult rates, and child rates management - Length of stay discounts and early bird deals - Mobile rates and secret deals implementation - Seasonal promotions and flash sales 📅 Availability Management: - Real-time availability tracking - Stop sell and restriction controls - Closed to arrival/departure functionality - Minimum/maximum stay requirements - Automatic sold-out management 💳 Payment Integration: - Maintained Redsys payment gateway integration - Seamless integration with existing Eagle Booking - No modifications to core Eagle Booking plugin 🛠️ Technical Implementation: - Custom database tables for advanced pricing - WordPress hooks and filters integration - AJAX-powered admin interface - Data migration from existing Eagle Booking - Professional calendar view for revenue management 📊 Admin Interface: - Booking.com-style management dashboard - Visual rate and availability calendar - Bulk operations for date ranges - Statistics and analytics dashboard - Modal dialogs for quick editing 🔧 Code Quality: - WordPress coding standards compliance - Secure database operations with prepared statements - Proper input validation and sanitization - Error handling and logging - Responsive admin interface 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
408 lines
9.7 KiB
Bash
Executable File
408 lines
9.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Hotel Raxa Website - Git Deployment Script
|
|
# This script commits and pushes changes to the Git repository
|
|
|
|
set -e # Exit on any error
|
|
|
|
# Configuration
|
|
REPO_URL="https://devops.cloudhost.es/CloudHost/HotelRaxa.git"
|
|
BRANCH="main"
|
|
PROJECT_DIR="/home/malin/c0ding/hotelraxa.com/hotelraxa.com"
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Function to print colored output
|
|
print_status() {
|
|
echo -e "${GREEN}[INFO]${NC} $1"
|
|
}
|
|
|
|
print_warning() {
|
|
echo -e "${YELLOW}[WARNING]${NC} $1"
|
|
}
|
|
|
|
print_error() {
|
|
echo -e "${RED}[ERROR]${NC} $1"
|
|
}
|
|
|
|
# Function to check if git is installed
|
|
check_git() {
|
|
if ! command -v git &> /dev/null; then
|
|
print_error "Git is not installed. Please install Git first."
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
# Function to set Git credentials
|
|
get_credentials() {
|
|
GIT_USERNAME="Malin"
|
|
GIT_PASSWORD="MuieSteaua09!@"
|
|
print_status "Using configured Git credentials..."
|
|
}
|
|
|
|
# Function to configure Git user
|
|
configure_git_user() {
|
|
print_status "Configuring Git user..."
|
|
git config user.name "Hotel Raxa Dev"
|
|
git config user.email "dev@hotelraxa.com"
|
|
}
|
|
|
|
# Function to initialize git repository if needed
|
|
init_git_repo() {
|
|
if [ ! -d ".git" ]; then
|
|
print_status "Initializing Git repository..."
|
|
git init
|
|
git remote add origin "${REPO_URL}"
|
|
else
|
|
print_status "Git repository already initialized."
|
|
# Update remote URL if it has changed
|
|
git remote set-url origin "${REPO_URL}"
|
|
fi
|
|
}
|
|
|
|
# Function to create .gitignore if it doesn't exist
|
|
create_gitignore() {
|
|
if [ ! -f ".gitignore" ]; then
|
|
print_status "Creating .gitignore file..."
|
|
cat > .gitignore << 'EOF'
|
|
# WordPress Core
|
|
wp-config.php
|
|
wp-content/uploads/
|
|
wp-content/cache/
|
|
wp-content/backup-db/
|
|
wp-content/advanced-cache.php
|
|
wp-content/wp-cache-config.php
|
|
wp-content/plugins/hello.php
|
|
wp-content/plugins/akismet/
|
|
wp-content/upgrade/
|
|
wp-content/upgrade-temp-backup/
|
|
.htaccess
|
|
|
|
# WordPress Auto-generated files
|
|
sitemap.xml
|
|
sitemap.xml.gz
|
|
wp-sitemap.xml
|
|
wp-sitemap-*.xml
|
|
|
|
# Database dumps
|
|
*.sql
|
|
*.sql.gz
|
|
*.sql.bz2
|
|
|
|
# WordPress debug and error logs
|
|
wp-content/debug.log
|
|
error_log
|
|
*.log
|
|
|
|
# OS generated files
|
|
.DS_Store
|
|
.DS_Store?
|
|
._*
|
|
.Spotlight-V100
|
|
.Trashes
|
|
ehthumbs.db
|
|
Thumbs.db
|
|
|
|
# IDE files
|
|
.idea/
|
|
.vscode/
|
|
*.swp
|
|
*.swo
|
|
*~
|
|
|
|
# Temporary files
|
|
*.tmp
|
|
*.temp
|
|
*.bak
|
|
*.backup
|
|
|
|
# Node modules (if any)
|
|
node_modules/
|
|
npm-debug.log*
|
|
yarn-debug.log*
|
|
yarn-error.log*
|
|
|
|
# Composer
|
|
vendor/
|
|
composer.lock
|
|
|
|
# Build files
|
|
*.zip
|
|
*.tar.gz
|
|
|
|
# Environment files
|
|
.env
|
|
.env.local
|
|
.env.development.local
|
|
.env.test.local
|
|
.env.production.local
|
|
|
|
# Hotel Raxa specific
|
|
wp-content/languages/
|
|
wp-content/plugins/*/languages/
|
|
wp-content/themes/*/languages/
|
|
|
|
# Security - exclude sensitive files
|
|
wp-config-sample.php
|
|
.htpasswd
|
|
.htaccess.backup
|
|
auth.json
|
|
EOF
|
|
fi
|
|
}
|
|
|
|
# Function to check for uncommitted changes
|
|
check_changes() {
|
|
if [ -z "$(git status --porcelain)" ]; then
|
|
print_warning "No changes detected. Nothing to commit."
|
|
return 1
|
|
fi
|
|
return 0
|
|
}
|
|
|
|
# Function to add all changes
|
|
add_changes() {
|
|
print_status "Adding changes to staging area..."
|
|
git add .
|
|
|
|
# Show what will be committed
|
|
print_status "Files to be committed:"
|
|
git diff --cached --name-only
|
|
}
|
|
|
|
# Function to commit changes
|
|
commit_changes() {
|
|
print_status "Committing changes..."
|
|
|
|
# Create detailed commit message
|
|
COMMIT_MSG=$(cat << 'EOF'
|
|
Hotel Raxa - Advanced Booking System Implementation
|
|
|
|
🏨 Hotel Booking Enhancements:
|
|
- Implemented Eagle Booking Advanced Pricing add-on
|
|
- Added Booking.com-style rate management system
|
|
- Created professional calendar interface for pricing
|
|
- Integrated deals and discounts functionality
|
|
|
|
💰 Advanced Pricing Features:
|
|
- Dynamic pricing models (per room, per person, per adult)
|
|
- Base rates, adult rates, and child rates management
|
|
- Length of stay discounts and early bird deals
|
|
- Mobile rates and secret deals implementation
|
|
- Seasonal promotions and flash sales
|
|
|
|
📅 Availability Management:
|
|
- Real-time availability tracking
|
|
- Stop sell and restriction controls
|
|
- Closed to arrival/departure functionality
|
|
- Minimum/maximum stay requirements
|
|
- Automatic sold-out management
|
|
|
|
💳 Payment Integration:
|
|
- Maintained Redsys payment gateway integration
|
|
- Seamless integration with existing Eagle Booking
|
|
- No modifications to core Eagle Booking plugin
|
|
|
|
🛠️ Technical Implementation:
|
|
- Custom database tables for advanced pricing
|
|
- WordPress hooks and filters integration
|
|
- AJAX-powered admin interface
|
|
- Data migration from existing Eagle Booking
|
|
- Professional calendar view for revenue management
|
|
|
|
📊 Admin Interface:
|
|
- Booking.com-style management dashboard
|
|
- Visual rate and availability calendar
|
|
- Bulk operations for date ranges
|
|
- Statistics and analytics dashboard
|
|
- Modal dialogs for quick editing
|
|
|
|
🔧 Code Quality:
|
|
- WordPress coding standards compliance
|
|
- Secure database operations with prepared statements
|
|
- Proper input validation and sanitization
|
|
- Error handling and logging
|
|
- Responsive admin interface
|
|
|
|
🤖 Generated with Claude Code (https://claude.ai/code)
|
|
|
|
Co-Authored-By: Claude <noreply@anthropic.com>
|
|
EOF
|
|
)
|
|
|
|
git commit -m "$COMMIT_MSG"
|
|
}
|
|
|
|
# Function to push changes
|
|
push_changes() {
|
|
print_status "Pushing changes to remote repository..."
|
|
|
|
# Configure Git to use credentials
|
|
git config credential.helper store
|
|
|
|
# Create credentials file temporarily
|
|
echo "https://${GIT_USERNAME}:${GIT_PASSWORD}@devops.cloudhost.es" > ~/.git-credentials
|
|
|
|
# Push changes
|
|
git push -u origin $BRANCH
|
|
|
|
# Clean up credentials
|
|
rm -f ~/.git-credentials
|
|
git config --unset credential.helper
|
|
|
|
print_status "Changes pushed successfully!"
|
|
}
|
|
|
|
# Function to show repository status
|
|
show_status() {
|
|
print_status "Repository Status:"
|
|
echo "Repository URL: $REPO_URL"
|
|
echo "Branch: $BRANCH"
|
|
echo "Last commit:"
|
|
git log -1 --oneline
|
|
}
|
|
|
|
# Function to check WordPress integrity
|
|
check_wordpress_files() {
|
|
print_status "Checking WordPress file integrity..."
|
|
|
|
# Check for essential WordPress files
|
|
if [ ! -f "wp-config.php" ]; then
|
|
print_warning "wp-config.php not found - this is normal for repository"
|
|
fi
|
|
|
|
if [ ! -f "index.php" ]; then
|
|
print_error "index.php not found - WordPress core may be missing"
|
|
exit 1
|
|
fi
|
|
|
|
# Check for our custom plugins
|
|
if [ -d "wp-content/plugins/eagle-booking-advanced-pricing" ]; then
|
|
print_status "✓ Eagle Booking Advanced Pricing plugin found"
|
|
fi
|
|
|
|
if [ -d "wp-content/plugins/informatiq-eb-redsys" ]; then
|
|
print_status "✓ Redsys payment integration found"
|
|
fi
|
|
|
|
if [ -d "wp-content/plugins/eagle-booking" ]; then
|
|
print_status "✓ Eagle Booking plugin found"
|
|
fi
|
|
}
|
|
|
|
# Function to create deployment summary
|
|
create_deployment_summary() {
|
|
print_status "Creating deployment summary..."
|
|
|
|
SUMMARY_FILE="DEPLOYMENT_SUMMARY.md"
|
|
cat > $SUMMARY_FILE << EOF
|
|
# Hotel Raxa - Deployment Summary
|
|
|
|
**Deployment Date:** $(date '+%Y-%m-%d %H:%M:%S')
|
|
**Repository:** $REPO_URL
|
|
**Branch:** $BRANCH
|
|
|
|
## Project Structure
|
|
|
|
### WordPress Core
|
|
- WordPress installation with Hotel Raxa configuration
|
|
- Himara theme with child theme customizations
|
|
- Essential plugins for hotel booking functionality
|
|
|
|
### Key Features Implemented
|
|
|
|
#### Eagle Booking Advanced Pricing
|
|
- **Location:** \`wp-content/plugins/eagle-booking-advanced-pricing/\`
|
|
- **Features:** Booking.com-style pricing and availability management
|
|
- **Database:** 4 custom tables for rates, availability, deals, restrictions
|
|
- **Interface:** Professional calendar view for revenue management
|
|
|
|
#### Payment Integration
|
|
- **Location:** \`wp-content/plugins/informatiq-eb-redsys/\`
|
|
- **Features:** Redsys payment gateway integration
|
|
- **Status:** Fully integrated with Eagle Booking system
|
|
|
|
#### Theme Configuration
|
|
- **Main Theme:** Himara hotel theme
|
|
- **Child Theme:** Custom modifications for Hotel Raxa
|
|
- **Features:** Hotel-specific layouts and booking integration
|
|
|
|
## Database Tables
|
|
|
|
### Advanced Pricing Tables
|
|
- \`eb_ap_rates\` - Daily rate storage
|
|
- \`eb_ap_availability\` - Availability and restrictions
|
|
- \`eb_ap_deals\` - Promotional deals and discounts
|
|
- \`eb_ap_restrictions\` - Additional booking restrictions
|
|
|
|
## Admin Access
|
|
|
|
- **Advanced Pricing:** Eagle Booking > Advanced Pricing
|
|
- **Booking Management:** Eagle Booking dashboard
|
|
- **Theme Customization:** Appearance > Themes
|
|
|
|
## Security Notes
|
|
|
|
- Database credentials excluded from repository
|
|
- Sensitive configuration files in .gitignore
|
|
- Upload directories excluded from version control
|
|
- Debug logs excluded from repository
|
|
|
|
---
|
|
*Generated automatically during deployment*
|
|
EOF
|
|
|
|
git add $SUMMARY_FILE
|
|
}
|
|
|
|
# Main execution
|
|
main() {
|
|
print_status "Starting Hotel Raxa deployment process..."
|
|
|
|
# Change to project directory
|
|
cd "$PROJECT_DIR"
|
|
|
|
# Check prerequisites
|
|
check_git
|
|
check_wordpress_files
|
|
|
|
# Get credentials
|
|
get_credentials
|
|
|
|
# Initialize and configure Git
|
|
init_git_repo
|
|
configure_git_user
|
|
create_gitignore
|
|
|
|
# Check for changes
|
|
if ! check_changes; then
|
|
exit 0
|
|
fi
|
|
|
|
# Create deployment summary
|
|
create_deployment_summary
|
|
|
|
# Add, commit, and push changes
|
|
add_changes
|
|
commit_changes
|
|
push_changes
|
|
|
|
# Show final status
|
|
show_status
|
|
|
|
print_status "Hotel Raxa deployment completed successfully! 🎉"
|
|
print_status "You can view the changes at: $REPO_URL"
|
|
print_status ""
|
|
print_status "New features deployed:"
|
|
print_status "- Eagle Booking Advanced Pricing (Booking.com-style)"
|
|
print_status "- Professional rate and availability management"
|
|
print_status "- Deals and discounts system"
|
|
print_status "- Enhanced Redsys payment integration"
|
|
}
|
|
|
|
# Run main function
|
|
main "$@" |