HEX
Server: Apache
System: Linux www3.pit.tblive.com 5.14.0-687.38.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 12 17:19:12 EDT 2026 x86_64
User: awaldron (1020)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3.9/site-packages/up2date_client/__pycache__/statistics.cpython-39.pyc
a

�Xj�@s4ddlZddlmZmZdd�Zdd�Zdd�ZdS)	�N)�PIPE�PopencCsftj�d�std��d}t|dttd�}dd�|��D�\}}|rPtd|����t|d	d
��d��S)z�
    Get user count using the common CloudLinux library.
    This number is more accurate for systems
    with a control panel installed.
    z/opt/cloudlinux/venv/binz(CloudLinux virtual environment not foundzZ/opt/cloudlinux/venv/bin/python3 -c "from clcommon.cpapi import cpusers; print(cpusers())"T)�shell�stdout�stderrcSsg|]}|�����qS�)�decode�strip)�.0�resultrr�=/usr/lib/python3.9/site-packages/up2date_client/statistics.py�
<listcomp>�z.get_users_count_from_cllib.<locals>.<listcomp>z-Failed to get users from CloudLinux library: ����z, )	�os�path�exists�
ValueErrorrrZcommunicate�len�split)�cmdZprocess�output�errorsrrr�get_users_count_from_cllibsrcCsddlm}|�}t|���S)zY
    Fallback method to get the user count
    by looking into the /etc/passwd file.
    r)�ClPwd)Zup2date_client.clpwdrrZget_uid_dict)r�pwdrrr�get_users_count_genericsrcCs(z
t�}Wnty"t�}Yn0|S)z�
    Get the total count of users on the server.
    Tries the CloudLinux library first, falls back to generic method if it fails.
    )r�	Exceptionr)Zusers_countrrr�count_server_users"s

r)r�
subprocessrrrrrrrrr�<module>s