Fix SCRIPT_DIR variable collision preventing PHP optimizer from running
CRITICAL BUG FIX: - PHP optimizer failed with 'php-config-manager.sh not found' error - Root cause: Multiple sourced libraries redefining SCRIPT_DIR variable - Sourcing chain: php-optimizer → php-detector → system-detect + user-manager - Each library was overwriting parent's SCRIPT_DIR causing /lib/lib/ double paths CHANGES: - php-optimizer.sh: Renamed SCRIPT_DIR → PHP_TOOLKIT_DIR (unique variable) - user-manager.sh: Renamed SCRIPT_DIR → _LIB_SRCDIR to avoid collision - php-optimizer.sh: Fixed detect_system() → initialize_system_detection() - Removed 2>/dev/null error suppression to see actual errors during debug RESULT: - Script now loads all libraries successfully - Menu displays correctly with all 9 options - System detection runs properly - Ready for testing Files modified: - lib/user-manager.sh (3 lines) - modules/performance/php-optimizer.sh (10 lines)
This commit is contained in:
@@ -4,12 +4,12 @@
|
||||
# Part of Server Toolkit - Phase 3: Main Interactive Script
|
||||
|
||||
# Source required libraries
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../.. && pwd)"
|
||||
source "$SCRIPT_DIR/lib/php-detector.sh" 2>/dev/null || { echo "ERROR: php-detector.sh not found"; exit 1; }
|
||||
source "$SCRIPT_DIR/lib/php-analyzer.sh" 2>/dev/null || { echo "ERROR: php-analyzer.sh not found"; exit 1; }
|
||||
source "$SCRIPT_DIR/lib/php-config-manager.sh" 2>/dev/null || { echo "ERROR: php-config-manager.sh not found"; exit 1; }
|
||||
source "$SCRIPT_DIR/lib/system-detect.sh" 2>/dev/null || { echo "ERROR: system-detect.sh not found"; exit 1; }
|
||||
source "$SCRIPT_DIR/lib/user-manager.sh" 2>/dev/null || { echo "ERROR: user-manager.sh not found"; exit 1; }
|
||||
PHP_TOOLKIT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../.. && pwd)"
|
||||
source "$PHP_TOOLKIT_DIR/lib/php-detector.sh" || { echo "ERROR: php-detector.sh not found"; exit 1; }
|
||||
source "$PHP_TOOLKIT_DIR/lib/php-analyzer.sh" || { echo "ERROR: php-analyzer.sh not found"; exit 1; }
|
||||
source "$PHP_TOOLKIT_DIR/lib/php-config-manager.sh" || { echo "ERROR: php-config-manager.sh not found"; exit 1; }
|
||||
source "$PHP_TOOLKIT_DIR/lib/system-detect.sh" || { echo "ERROR: system-detect.sh not found"; exit 1; }
|
||||
source "$PHP_TOOLKIT_DIR/lib/user-manager.sh" || { echo "ERROR: user-manager.sh not found"; exit 1; }
|
||||
|
||||
# Color codes (using safe echo -e)
|
||||
RED='\033[0;31m'
|
||||
@@ -1109,7 +1109,7 @@ restore_configurations() {
|
||||
|
||||
main() {
|
||||
# Detect system
|
||||
detect_system
|
||||
initialize_system_detection
|
||||
|
||||
# Check if running as root
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
|
||||
Reference in New Issue
Block a user