Revert "CRITICAL FIXES: Apply essential improvements from beta branch to production"
This reverts commit eabddb553d.
This commit is contained in:
+14
-44
@@ -53,7 +53,7 @@ run_module() {
|
||||
echo ""
|
||||
echo -e "${RED}✗ Module not found: $category/$module${NC}"
|
||||
echo ""
|
||||
read -p "Press Enter to continue..." < /dev/tty 2>/dev/null || true
|
||||
read -p "Press Enter to continue..."
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -74,7 +74,7 @@ run_module() {
|
||||
echo -e "${RED}✗ Exited with code: $exit_code${NC}"
|
||||
fi
|
||||
echo ""
|
||||
read -p "Press Enter to continue..." < /dev/tty 2>/dev/null || true
|
||||
read -p "Press Enter to continue..."
|
||||
}
|
||||
|
||||
#############################################################################
|
||||
@@ -135,9 +135,7 @@ show_threat_analysis_menu() {
|
||||
handle_threat_analysis_menu() {
|
||||
while true; do
|
||||
show_threat_analysis_menu
|
||||
if ! read -r choice 2>/dev/null </dev/tty; then
|
||||
return 0
|
||||
fi
|
||||
read -r choice
|
||||
|
||||
case $choice in
|
||||
1) run_module "security" "bot-analyzer.sh" ;;
|
||||
@@ -171,9 +169,7 @@ show_live_monitoring_menu() {
|
||||
handle_live_monitoring_menu() {
|
||||
while true; do
|
||||
show_live_monitoring_menu
|
||||
if ! read -r choice 2>/dev/null </dev/tty; then
|
||||
return 0
|
||||
fi
|
||||
read -r choice
|
||||
|
||||
case $choice in
|
||||
1) run_module "security" "live-attack-monitor.sh" ;;
|
||||
@@ -205,9 +201,7 @@ show_log_viewers_menu() {
|
||||
handle_log_viewers_menu() {
|
||||
while true; do
|
||||
show_log_viewers_menu
|
||||
if ! read -r choice 2>/dev/null </dev/tty; then
|
||||
return 0
|
||||
fi
|
||||
read -r choice
|
||||
|
||||
case $choice in
|
||||
1) run_module "security" "tail-apache-access.sh" ;;
|
||||
@@ -238,9 +232,7 @@ show_security_actions_menu() {
|
||||
handle_security_actions_menu() {
|
||||
while true; do
|
||||
show_security_actions_menu
|
||||
if ! read -r choice 2>/dev/null </dev/tty; then
|
||||
return 0
|
||||
fi
|
||||
read -r choice
|
||||
|
||||
case $choice in
|
||||
1) run_module "security" "enable-cphulk.sh" ;;
|
||||
@@ -274,9 +266,7 @@ show_security_menu() {
|
||||
handle_security_menu() {
|
||||
while true; do
|
||||
show_security_menu
|
||||
if ! read -r choice 2>/dev/null </dev/tty; then
|
||||
return 0
|
||||
fi
|
||||
read -r choice
|
||||
|
||||
case $choice in
|
||||
1) handle_threat_analysis_menu ;;
|
||||
@@ -324,9 +314,7 @@ show_website_menu() {
|
||||
handle_website_menu() {
|
||||
while true; do
|
||||
show_website_menu
|
||||
if ! read -r choice 2>/dev/null </dev/tty; then
|
||||
return 0
|
||||
fi
|
||||
read -r choice
|
||||
|
||||
case $choice in
|
||||
1) run_module "website" "website-error-analyzer.sh" ;;
|
||||
@@ -379,9 +367,7 @@ show_performance_menu() {
|
||||
handle_performance_menu() {
|
||||
while true; do
|
||||
show_performance_menu
|
||||
if ! read -r choice 2>/dev/null </dev/tty; then
|
||||
return 0
|
||||
fi
|
||||
read -r choice
|
||||
|
||||
case $choice in
|
||||
1) run_module "performance" "mysql-query-analyzer.sh" ;;
|
||||
@@ -487,9 +473,7 @@ show_acronis_menu() {
|
||||
handle_backup_menu() {
|
||||
while true; do
|
||||
show_backup_menu
|
||||
if ! read -r choice 2>/dev/null </dev/tty; then
|
||||
return 0
|
||||
fi
|
||||
read -r choice
|
||||
|
||||
case $choice in
|
||||
1) handle_acronis_menu ;;
|
||||
@@ -504,9 +488,7 @@ handle_backup_menu() {
|
||||
handle_acronis_menu() {
|
||||
while true; do
|
||||
show_acronis_menu
|
||||
if ! read -r choice 2>/dev/null </dev/tty; then
|
||||
return 0
|
||||
fi
|
||||
read -r choice
|
||||
|
||||
case $choice in
|
||||
1) run_module "backup" "acronis-install.sh" ;;
|
||||
@@ -560,9 +542,7 @@ show_email_menu() {
|
||||
handle_email_menu() {
|
||||
while true; do
|
||||
show_email_menu
|
||||
if ! read -r choice 2>/dev/null </dev/tty; then
|
||||
return 0
|
||||
fi
|
||||
read -r choice
|
||||
|
||||
case $choice in
|
||||
1) run_module "email" "email-diagnostics.sh" ;;
|
||||
@@ -593,11 +573,6 @@ init_directories() {
|
||||
}
|
||||
|
||||
startup_detection() {
|
||||
# Initialize system detection first (required for proper reference database)
|
||||
if [ -z "${SYS_DETECTION_COMPLETE:-}" ]; then
|
||||
initialize_system_detection
|
||||
fi
|
||||
|
||||
if ! db_is_fresh; then
|
||||
clear
|
||||
print_banner "Server Management Toolkit - Initializing"
|
||||
@@ -633,7 +608,7 @@ startup_detection() {
|
||||
print_success "Detection complete! Cached for 1 hour."
|
||||
echo ""
|
||||
|
||||
read -p "Press Enter to continue..." < /dev/tty 2>/dev/null || true
|
||||
read -p "Press Enter to continue..."
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -647,12 +622,7 @@ main() {
|
||||
|
||||
while true; do
|
||||
show_main_menu
|
||||
|
||||
# Read from terminal (use /dev/tty directly for interaction)
|
||||
if ! read -r choice 2>/dev/null </dev/tty; then
|
||||
# No terminal available, return from function gracefully
|
||||
return 0
|
||||
fi
|
||||
read -r choice
|
||||
|
||||
case $choice in
|
||||
1) run_module "diagnostics" "system-health-check.sh" ;;
|
||||
|
||||
@@ -169,7 +169,8 @@ show_terminal_info() {
|
||||
# Create temporary session directory
|
||||
create_temp_session() {
|
||||
export SESSION_ID=$$
|
||||
export TEMP_SESSION_DIR=$(mktemp -d -t server-toolkit.XXXXXX)
|
||||
export TEMP_SESSION_DIR="/tmp/server-toolkit-${SESSION_ID}"
|
||||
mkdir -p "$TEMP_SESSION_DIR"
|
||||
|
||||
# Cleanup on exit
|
||||
trap '[ -n "$TEMP_SESSION_DIR" ] && rm -rf "$TEMP_SESSION_DIR" 2>/dev/null' EXIT INT TERM
|
||||
|
||||
+3
-6
@@ -162,8 +162,8 @@ build_databases_section() {
|
||||
# Build MySQL command with credentials if needed
|
||||
local mysql_cmd="mysql"
|
||||
if [ "$SYS_CONTROL_PANEL" = "plesk" ] && [ -f /etc/psa/.psa.shadow ]; then
|
||||
export MYSQL_PWD=$(cat /etc/psa/.psa.shadow)
|
||||
mysql_cmd="mysql -uadmin"
|
||||
local plesk_mysql_pass=$(cat /etc/psa/.psa.shadow)
|
||||
mysql_cmd="mysql -uadmin -p${plesk_mysql_pass}"
|
||||
fi
|
||||
|
||||
local total_dbs=$($mysql_cmd -Ns -e "SHOW DATABASES" 2>/dev/null | grep -v "^information_schema$\|^mysql$\|^performance_schema$\|^sys$" | wc -l)
|
||||
@@ -180,7 +180,7 @@ build_databases_section() {
|
||||
|
||||
local size_mb=$($mysql_cmd -Ns -e "SELECT ROUND(SUM(data_length + index_length) / 1024 / 1024, 2)
|
||||
FROM information_schema.TABLES
|
||||
WHERE table_schema=\`$db\`" 2>/dev/null)
|
||||
WHERE table_schema='$db'" 2>/dev/null)
|
||||
[ -z "$size_mb" ] && size_mb=0
|
||||
|
||||
local table_count=$($mysql_cmd -Ns "$db" -e "SHOW TABLES" 2>/dev/null | wc -l)
|
||||
@@ -190,9 +190,6 @@ build_databases_section() {
|
||||
|
||||
finish_progress
|
||||
echo "" >> "$SYSREF_DB"
|
||||
|
||||
# Clean up password environment variable
|
||||
unset MYSQL_PWD
|
||||
}
|
||||
|
||||
# Check domain HTTP/HTTPS status codes
|
||||
|
||||
Reference in New Issue
Block a user