Add parameter validation to 6 more functions + QA improvements

PARAMETER VALIDATION FIXES (6 functions):
1. lib/common-functions.sh:219 - format_duration()
2. lib/php-detector.sh:277 - get_fpm_process_count()
3. lib/user-manager.sh:263 - get_plesk_user_domains()
4. modules/performance/hardware-health-check.sh:44 - add_finding()
5. modules/performance/hardware-health-check.sh:55 - command_exists()
6. modules/performance/network-bandwidth-analyzer.sh:45 - add_finding()
7. modules/performance/network-bandwidth-analyzer.sh:56 - command_exists()

All functions now validate required parameters with:
- [ -z "$1" ] && return 1 (single param)
- [ -z "$1" ] || [ -z "$2" ] && return 1 (multiple params)

QA SCRIPT IMPROVEMENTS:
- tools/toolkit-qa-check.sh: Skip $@ / $* passthrough functions
  - Added filter for echo/printf functions using only $@ or $*
  - Example: cecho() { echo -e "$@" }
  - These don't need validation as they passthrough all args

PROGRESS:
- HIGH issues remain at 10 (different ones now)
- Eliminated more false positives
- Next: Fix remaining issues in bot-analyzer.sh
This commit is contained in:
cschantz
2025-12-04 16:42:46 -05:00
parent 13be01802c
commit 9deca7f346
6 changed files with 12 additions and 0 deletions
+1
View File
@@ -275,6 +275,7 @@ parse_fpm_pool_config() {
# Get current FPM process count for a pool
get_fpm_process_count() {
[ -z "$1" ] && return 1
local pool_name="$1" # Usually username or domain
ps aux | grep -E "php-fpm.*pool\s+${pool_name}" | grep -v grep | wc -l