Add cancel/back options to all user input prompts
Changes: - Added "0) Cancel" option to all menu prompts - Added "(or 0 to cancel)" to all text input prompts - Ensures users can back out of any operation at any time - Scripts affected: - website-error-analyzer.sh (scope selection, time range) - 500-error-tracker.sh (time range selection) - wordpress-cron-manager.sh (all domain/user input prompts, status checks) User Experience Improvements: - No more being trapped in prompts - Clear cancel instructions on every input - Consistent "Operation cancelled" messaging - Proper exit codes (0 for user cancellation) Tested: ✓ website-error-analyzer.sh - cancel on scope selection ✓ 500-error-tracker.sh - cancel on time selection ✓ wordpress-cron-manager.sh - cancel on domain/user input ✓ All cancellations return cleanly to menu 🤖 Generated with Claude Code https://claude.com/claude-code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -199,13 +199,13 @@ case "$choice" in
|
||||
2)
|
||||
# Disable wp-cron for specific domain
|
||||
echo ""
|
||||
echo -n "Enter domain name: "
|
||||
echo -n "Enter domain name (or 0 to cancel): "
|
||||
read -r domain
|
||||
|
||||
if [ -z "$domain" ]; then
|
||||
print_error "Domain cannot be empty"
|
||||
if [ -z "$domain" ] || [ "$domain" = "0" ]; then
|
||||
echo "Operation cancelled."
|
||||
press_enter
|
||||
exit 1
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Find WordPress installation for this domain
|
||||
@@ -289,13 +289,13 @@ case "$choice" in
|
||||
3)
|
||||
# Disable wp-cron for specific user
|
||||
echo ""
|
||||
echo -n "Enter cPanel username: "
|
||||
echo -n "Enter cPanel username (or 0 to cancel): "
|
||||
read -r target_user
|
||||
|
||||
if [ -z "$target_user" ]; then
|
||||
print_error "Username cannot be empty"
|
||||
if [ -z "$target_user" ] || [ "$target_user" = "0" ]; then
|
||||
echo "Operation cancelled."
|
||||
press_enter
|
||||
exit 1
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -d "/home/$target_user" ]; then
|
||||
@@ -432,16 +432,27 @@ case "$choice" in
|
||||
echo "Check wp-cron status for:"
|
||||
echo " 1) Specific domain"
|
||||
echo " 2) Specific user"
|
||||
echo " 0) Cancel"
|
||||
echo ""
|
||||
echo -n "Select [1]: "
|
||||
read -r check_choice
|
||||
check_choice="${check_choice:-1}"
|
||||
|
||||
if [ "$check_choice" = "1" ]; then
|
||||
if [ "$check_choice" = "0" ]; then
|
||||
echo "Operation cancelled."
|
||||
press_enter
|
||||
exit 0
|
||||
elif [ "$check_choice" = "1" ]; then
|
||||
echo ""
|
||||
echo -n "Enter domain name: "
|
||||
echo -n "Enter domain name (or 0 to cancel): "
|
||||
read -r domain
|
||||
|
||||
if [ -z "$domain" ] || [ "$domain" = "0" ]; then
|
||||
echo "Operation cancelled."
|
||||
press_enter
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Find WordPress for domain
|
||||
wp_config=""
|
||||
for userdata_file in /var/cpanel/userdata/*/main; do
|
||||
@@ -490,9 +501,15 @@ case "$choice" in
|
||||
|
||||
else
|
||||
echo ""
|
||||
echo -n "Enter cPanel username: "
|
||||
echo -n "Enter cPanel username (or 0 to cancel): "
|
||||
read -r check_user
|
||||
|
||||
if [ -z "$check_user" ] || [ "$check_user" = "0" ]; then
|
||||
echo "Operation cancelled."
|
||||
press_enter
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -d "/home/$check_user" ]; then
|
||||
print_error "User $check_user does not exist"
|
||||
press_enter
|
||||
@@ -537,13 +554,13 @@ case "$choice" in
|
||||
6)
|
||||
# Re-enable wp-cron for specific domain
|
||||
echo ""
|
||||
echo -n "Enter domain name: "
|
||||
echo -n "Enter domain name (or 0 to cancel): "
|
||||
read -r domain
|
||||
|
||||
if [ -z "$domain" ]; then
|
||||
print_error "Domain cannot be empty"
|
||||
if [ -z "$domain" ] || [ "$domain" = "0" ]; then
|
||||
echo "Operation cancelled."
|
||||
press_enter
|
||||
exit 1
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Find WordPress installation
|
||||
@@ -597,13 +614,13 @@ case "$choice" in
|
||||
7)
|
||||
# Re-enable wp-cron for specific user
|
||||
echo ""
|
||||
echo -n "Enter cPanel username: "
|
||||
echo -n "Enter cPanel username (or 0 to cancel): "
|
||||
read -r target_user
|
||||
|
||||
if [ -z "$target_user" ]; then
|
||||
print_error "Username cannot be empty"
|
||||
if [ -z "$target_user" ] || [ "$target_user" = "0" ]; then
|
||||
echo "Operation cancelled."
|
||||
press_enter
|
||||
exit 1
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -d "/home/$target_user" ]; then
|
||||
|
||||
Reference in New Issue
Block a user