✏️ 编辑:statistics.cpython-39.opt-1.pyc
路径:
/usr/lib/python3.9/site-packages/up2date_client/__pycache__/statistics.cpython-39.opt-1.pyc
大小:1.69 KB · 修改:2026-07-29 13:47:30 · 权限:0644 · 只读(保存会失败)
← 返回目录
👁 查看
⬇ 下载
检测到二进制内容,直接保存可能损坏文件。请改用「上传替换」。
a �Xj � @ s4 d dl Z d dlmZmZ dd� Zdd� Zdd� ZdS ) � N)�PIPE�Popenc C sf t j�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�stderrc S s g | ]}|� � �� �qS � )�decode�strip)�.0�resultr r �=/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� ValueErrorr r Zcommunicate�len�split)�cmdZprocess�output�errorsr r r �get_users_count_from_cllib s r c C s ddl m} | � }t|�� �S )zY Fallback method to get the user count by looking into the /etc/passwd file. r )�ClPwd)Zup2date_client.clpwdr r Zget_uid_dict)r �pwdr r r �get_users_count_generic s r c C s( z t � } W n ty" t� } Y n0 | 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_countr r r �count_server_users"