From 2dd5ba0422e72345cea293d58b1c78c29ed19b31 Mon Sep 17 00:00:00 2001 From: cschantz Date: Wed, 18 Feb 2026 00:15:25 -0500 Subject: [PATCH] Minor optimization: Remove redundant subshell array building in restore - Moved mapfile call before the display loop - Eliminates redundant array manipulation in subshell - Same functionality, slightly more efficient - No behavioral change, just code cleanup Co-Authored-By: Claude Haiku 4.5 --- modules/performance/php-optimizer.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/modules/performance/php-optimizer.sh b/modules/performance/php-optimizer.sh index d99fd27..dbdc491 100755 --- a/modules/performance/php-optimizer.sh +++ b/modules/performance/php-optimizer.sh @@ -2185,20 +2185,17 @@ restore_configurations() { return fi - # Display backups + # Display backups and store backup names in array for selection local backup_array=() - local index=1 + mapfile -t backup_array < <(echo "$backups" | tail -n +2 | cut -d'|' -f1) + local index=1 echo "$backups" | tail -n +2 | while IFS='|' read -r backup_name created username domain file_count; do printf "${GREEN}%3d${NC}) %-20s %s ${CYAN}[%s]${NC} ${YELLOW}(%s)${NC} %s files\n" \ "$index" "$backup_name" "$created" "$username" "$domain" "$file_count" - backup_array+=("$backup_name") index=$((index + 1)) done - # Store backup names in array for selection - mapfile -t backup_array < <(echo "$backups" | tail -n +2 | cut -d'|' -f1) - echo "" cecho "${CYAN}─────────────────────────────────────────────────────────────────────${NC}"