Add change tracking and history display to Option 5
- Initialize change tracking before applying optimizations - Log each change made during optimization process - Track before/after values for all modifications - Display detailed change log after optimization completes - Show recent change history from change tracker - Provides auditability and visibility into what changed Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1035,6 +1035,9 @@ optimize_all_domains() {
|
||||
cecho "${CYAN}Selected: ${#domains_to_apply[@]} domain(s)/user(s)${NC}"
|
||||
echo ""
|
||||
|
||||
# Initialize change tracking
|
||||
init_change_tracking 2>/dev/null || true
|
||||
|
||||
# Get all users
|
||||
local users
|
||||
users=$(list_all_users)
|
||||
@@ -1050,6 +1053,7 @@ optimize_all_domains() {
|
||||
local optimized_count=0
|
||||
local skipped_count=0
|
||||
declare -A optimization_summary
|
||||
declare -a changes_made_list
|
||||
|
||||
# Process each user
|
||||
while IFS= read -r username; do
|
||||
@@ -1150,6 +1154,10 @@ optimize_all_domains() {
|
||||
if [ "$changes_made" -gt 0 ]; then
|
||||
cecho " ${GREEN}✓${NC} Optimized ($changes_made changes): $changes_list"
|
||||
optimized_count=$((optimized_count + 1))
|
||||
|
||||
# Log the change
|
||||
log_change "$domain|$username" "pm.max_children" "$current_max_children" "$recommended_max_children" "Server-wide optimization" 2>/dev/null || true
|
||||
changes_made_list+=("$domain: $current_max_children → $recommended_max_children (freed ~$((( current_max_children - recommended_max_children ) * 20))MB)")
|
||||
else
|
||||
if [ -n "$changes_list" ]; then
|
||||
cecho " ${YELLOW}⊙${NC} Detected: $changes_list (manual intervention needed)"
|
||||
@@ -1199,7 +1207,35 @@ optimize_all_domains() {
|
||||
fi
|
||||
|
||||
echo ""
|
||||
cecho "${CYAN}═══════════════════════════════════════════════════════════════════${NC}"
|
||||
|
||||
# Display change history
|
||||
if [ "${#changes_made_list[@]}" -gt 0 ]; then
|
||||
cecho "${CYAN}─────────────────────────────────────────────────────────────────────${NC}"
|
||||
cecho "${WHITE}${BOLD}DETAILED CHANGES${NC}"
|
||||
cecho "${CYAN}─────────────────────────────────────────────────────────────────────${NC}"
|
||||
echo ""
|
||||
|
||||
for change in "${changes_made_list[@]}"; do
|
||||
cecho " ${GREEN}✓${NC} $change"
|
||||
done
|
||||
|
||||
echo ""
|
||||
|
||||
# Get recent change history from tracker
|
||||
local recent_changes
|
||||
recent_changes=$(get_change_history 2>/dev/null || echo "")
|
||||
|
||||
if [ -n "$recent_changes" ]; then
|
||||
cecho "${CYAN}─────────────────────────────────────────────────────────────────────${NC}"
|
||||
cecho "${WHITE}${BOLD}CHANGE HISTORY${NC}"
|
||||
cecho "${CYAN}─────────────────────────────────────────────────────────────────────${NC}"
|
||||
echo ""
|
||||
cecho "$recent_changes" | head -20 # Show last 20 changes
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
|
||||
cecho "${CYAN}═════════════════════════════════════════════════════════════════════${NC}"
|
||||
echo ""
|
||||
read -p "Press Enter to continue..."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user