Compare commits
2 Commits
2dd5ba0422
...
17fa38f349
| Author | SHA1 | Date | |
|---|---|---|---|
| 17fa38f349 | |||
| 7a44ff81d4 |
@@ -514,13 +514,26 @@ find_fpm_pool_config() {
|
|||||||
local username="$1"
|
local username="$1"
|
||||||
local domain="$2"
|
local domain="$2"
|
||||||
|
|
||||||
# Try using existing function if available
|
local pool_config=""
|
||||||
if type find_fpm_pool_config_internal >/dev/null 2>&1; then
|
|
||||||
find_fpm_pool_config_internal "$username" "$domain"
|
# Try cPanel paths first (most common)
|
||||||
return $?
|
# cPanel typically names pools after the domain
|
||||||
|
if [ -n "$domain" ]; then
|
||||||
|
pool_config=$(find /opt/cpanel/ea-php*/root/etc/php-fpm.d/ -name "$domain.conf" 2>/dev/null | head -1)
|
||||||
|
[ -n "$pool_config" ] && { echo "$pool_config"; return 0; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Fallback: search common locations
|
# Try username
|
||||||
|
pool_config=$(find /opt/cpanel/ea-php*/root/etc/php-fpm.d/ -name "$username.conf" 2>/dev/null | head -1)
|
||||||
|
[ -n "$pool_config" ] && { echo "$pool_config"; return 0; }
|
||||||
|
|
||||||
|
# Try matching any domain under this user
|
||||||
|
if [ -n "$domain" ]; then
|
||||||
|
pool_config=$(find /opt/cpanel/ea-php*/root/etc/php-fpm.d/ -name "*$domain*" 2>/dev/null | head -1)
|
||||||
|
[ -n "$pool_config" ] && { echo "$pool_config"; return 0; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Try Debian/Ubuntu paths
|
||||||
local common_paths=(
|
local common_paths=(
|
||||||
"/etc/php-fpm.d/${username}.conf"
|
"/etc/php-fpm.d/${username}.conf"
|
||||||
"/etc/php/7.4/fpm/pool.d/${username}.conf"
|
"/etc/php/7.4/fpm/pool.d/${username}.conf"
|
||||||
|
|||||||
+19
-5
@@ -454,7 +454,7 @@ find_domain_owner() {
|
|||||||
|
|
||||||
case "${SYS_CONTROL_PANEL:-unknown}" in
|
case "${SYS_CONTROL_PANEL:-unknown}" in
|
||||||
cpanel)
|
cpanel)
|
||||||
grep "^${domain}:" /etc/trueuserdomains 2>/dev/null | cut -d: -f2
|
grep "^${domain}:" /etc/trueuserdomains 2>/dev/null | cut -d: -f2 | tr -d ' '
|
||||||
;;
|
;;
|
||||||
plesk)
|
plesk)
|
||||||
if command_exists mysql && [ -f /etc/psa/.psa.shadow ]; then
|
if command_exists mysql && [ -f /etc/psa/.psa.shadow ]; then
|
||||||
@@ -482,17 +482,31 @@ find_domain_access_log() {
|
|||||||
local owner
|
local owner
|
||||||
owner=$(find_domain_owner "$domain")
|
owner=$(find_domain_owner "$domain")
|
||||||
if [ -n "$owner" ]; then
|
if [ -n "$owner" ]; then
|
||||||
find "/home/${owner}/public_html" -maxdepth 2 -name "access_log*" -type f 2>/dev/null | head -1
|
# Try access-logs directory first (follows symlinks)
|
||||||
|
local log_file
|
||||||
|
log_file=$(find -L "/home/${owner}/access-logs" -type f -name "*${domain}*" 2>/dev/null | head -1)
|
||||||
|
|
||||||
|
# If not found, try Apache domlogs directory directly
|
||||||
|
if [ -z "$log_file" ] && [ -d "/etc/apache2/logs/domlogs" ]; then
|
||||||
|
log_file=$(find "/etc/apache2/logs/domlogs" -type f -name "*${domain}*" 2>/dev/null | head -1)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If not found, try public_html
|
||||||
|
if [ -z "$log_file" ] && [ -d "/home/${owner}/public_html" ]; then
|
||||||
|
log_file=$(find "/home/${owner}/public_html" -maxdepth 2 -type f -name "access_log*" 2>/dev/null | head -1)
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$log_file"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
plesk)
|
plesk)
|
||||||
find "/var/www/vhosts/${domain}/statistics/logs" -name "access_log*" -type f 2>/dev/null | head -1
|
find "/var/www/vhosts/${domain}/statistics/logs" -type f -name "access_log*" 2>/dev/null | head -1
|
||||||
;;
|
;;
|
||||||
interworx)
|
interworx)
|
||||||
find "/home/*/public_html/${domain}" -name "access_log*" -type f 2>/dev/null | head -1
|
find "/home/*/public_html/${domain}" -type f -name "access_log*" 2>/dev/null | head -1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
find /var/log -name "*${domain}*access*log*" -type f 2>/dev/null | head -1
|
find /var/log -type f -name "*${domain}*access*log*" 2>/dev/null | head -1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user