#!/usr/bin/env bash
# What: lists the php versions this CWP server offers, one "N.N<TAB>/abs/path/to/php" per line, sorted (agent: ping
#       `php_versions` and `php_cli`). A version is an installed /opt/alt/php-fpm<NN> directory that holds a php-fpm binary
#       and whose /opt/alt/php<NN>/usr/bin/php CLI is there; ensure-website accepts exactly these. Prints nothing when
#       none is installed. Read only.
# Usage (root, called by hostpanel-ssh-key-agent): php-versions
# Exit: 0 always unless the arguments are wrong (2).
set -euo pipefail
HELPER_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=hp-common.sh
. "$HELPER_DIR/hp-common.sh"

[ $# -eq 0 ] || hp_die "$EXIT_BAD_ARGS" "usage: php-versions"
hp_php_versions
