#!/bin/bash
# Setup script for buycocaineincanada.com website
# This script helps install the website files that were downloaded

echo "Setting up buycocaineincanada.com website files..."

# Check if download directory exists
if [ ! -d "download" ]; then
    echo "Error: download directory not found"
    exit 1
fi

# Create backup of existing files
if [ -f "info.php" ]; then
    cp info.php info.php.backup
fi

if [ -f "wp-config.php" ]; then
    cp wp-config.php wp-config.php.backup
fi

# Remove existing files (except the backup ones)
rm -f info.php test.txt wp-config.php

# Move new files from download directory
echo "Moving new website files..."
mv download/* .

# Set proper permissions
echo "Setting proper permissions..."
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod 644 wp-config.php

echo "Website installation complete!"
echo "Please verify database connection and restart Apache:"
echo "  /usr/local/cpanel/scripts/updateuserdomains"
echo "  systemctl restart httpd"