£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyÊ¦•êŽ…È®FÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~èŠ©ÊÇí`ÔÑ©úë™µ'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ó¼ãžªéUWŸÈË%DÒÕ¬ï‘]/Åcx  ‰ï2ß]ä6G[]S£ÔÏ¯rs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ                  ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<html>
3
۔*j                 @   s4   d dl Z d dlmZmZ dd Zdd Zdd ZdS )	    N)PIPEPopenc              C   sf   t jjdstdd} t| dttd}dd |j D \}}|rPtd| t|d	d j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stderrc             S   s   g | ]}|j  j qS  )decodestrip).0resultr   r    /usr/lib/python3.6/statistics.py
<listcomp>   s    z.get_users_count_from_cllib.<locals>.<listcomp>z-Failed to get users from CloudLinux library:    z, )	ospathexists
ValueErrorr   r   Zcommunicatelensplit)cmdZprocessoutputerrorsr   r   r   get_users_count_from_cllib   s    r   c              C   s   ddl m}  |  }t|j S )zY
    Fallback method to get the user count
    by looking into the /etc/passwd file.
    r   )ClPwd)Zup2date_client.clpwdr   r   Zget_uid_dict)r   pwdr   r   r   get_users_count_generic   s    r   c              C   s*   y
t  } W n tk
r$   t } Y nX | 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   )Zusers_countr   r   r   count_server_users"   s
    
r   )r   
subprocessr   r   r   r   r   r   r   r   r   <module>   s   
