#!/bin/bash # Staging server deployment commands echo "๐Ÿ” Setting up TEC template deployment..." # Get active theme ACTIVE_THEME=$(wp theme status --format=csv | grep "active" | cut -d',' -f1) echo "Active theme: $ACTIVE_THEME" # Create theme directory structure THEME_PATH="/var/www/html/wp-content/themes/$ACTIVE_THEME" TEC_THEME_DIR="$THEME_PATH/tribe-events/community" PARTIALS_DIR="$TEC_THEME_DIR/partials" echo "๐Ÿ“ Creating theme directories..." mkdir -p "$TEC_THEME_DIR" mkdir -p "$PARTIALS_DIR" # Copy enhanced template echo "๐Ÿ“‹ Copying enhanced template..." if [ -f "/var/www/html/wp-content/plugins/hvac-community-events/templates/community-edit-event-enhanced.php" ]; then cp "/var/www/html/wp-content/plugins/hvac-community-events/templates/community-edit-event-enhanced.php" \ "$TEC_THEME_DIR/edit-event.php" echo "โœ… Enhanced template copied to theme" else echo "โŒ Enhanced template not found in plugin" exit 1 fi # Copy partials echo "๐Ÿ“‹ Copying template partials..." PLUGIN_PARTIALS_DIR="/var/www/html/wp-content/plugins/hvac-community-events/templates/partials" if [ -d "$PLUGIN_PARTIALS_DIR" ]; then cp -r "$PLUGIN_PARTIALS_DIR"/* "$PARTIALS_DIR/" echo "โœ… Template partials copied" # List copied files echo "๐Ÿ“‚ Copied partials:" ls -la "$PARTIALS_DIR/" else echo "โŒ Partials directory not found" exit 1 fi # Set proper permissions echo "๐Ÿ” Setting permissions..." chown -R www-data:www-data "$TEC_THEME_DIR" chmod -R 644 "$TEC_THEME_DIR"/*.php chmod -R 644 "$PARTIALS_DIR"/*.php # Verify deployment echo "๐Ÿ” Verifying deployment..." if [ -f "$TEC_THEME_DIR/edit-event.php" ]; then echo "โœ… Enhanced template deployed successfully" else echo "โŒ Template deployment failed" exit 1 fi # Count partials PARTIAL_COUNT=$(ls -1 "$PARTIALS_DIR"/*.php 2>/dev/null | wc -l) if [ "$PARTIAL_COUNT" -eq 4 ]; then echo "โœ… All 4 template partials deployed successfully" else echo "โš ๏ธ Only $PARTIAL_COUNT partials found (expected 4)" fi # Clear caches echo "๐Ÿงน Clearing caches..." wp cache flush if command -v wp-cli >/dev/null 2>&1; then wp rewrite flush fi echo "๐ŸŽ‰ TEC template deployment completed!" echo "" echo "๐Ÿ“ Deployed files:" echo " - Theme template: $TEC_THEME_DIR/edit-event.php" echo " - Partials: $PARTIALS_DIR/" echo "" echo "๐Ÿ”— Test URL: https://upskill-staging.measurequick.com/events/network/add"