HEX
Server: LiteSpeed
System: Linux server384.web-hosting.com 4.18.0-553.124.4.lve.el8.x86_64 #1 SMP Fri May 15 13:02:13 UTC 2026 x86_64
User: drivkxoj (2377)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/up2date_client/__pycache__/statistics.cpython-36.pyc
3

m��i�@s4ddlZddlmZmZdd�Zdd�Zdd�ZdS)	�N)�PIPE�PopencCsftjjd�std��d}t|dttd�}dd�|j�D�\}}|rPtd|����t|d	d�jd
��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|]}|j�j��qS�)�decode�strip)�.0�resultrr� /usr/lib/python3.6/statistics.py�
<listcomp>sz.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|j��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*y
t�}Wntk
r$t�}YnX|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