https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /opt/alt/python37/lib/python3.7/site-packages/clwpos/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/alt/python37/lib/python3.7/site-packages/clwpos/__pycache__/stats.cpython-37.pyc
B

A�c-�@s�ddlZddlZddlmZddlmZddlmZddlm	Z	ddl
mZmZddl
mZddlmZe	d	�Zeeeed
�dd�Zeeeed
�d
d�Zdeeed�dd�Zdd�Zdd�ZdS)�N)�List)�cpapi)�drop_privileges)�
setup_logging)�get_allowed_modules�ALL_OPTIMIZATION_MODULES)�get_admin_options)�
UserConfigZclwpos_statistics)�user�checked_modules�returnc
Csfd}y*t|��t|�}|�|�}WdQRXWn2tk
r`}zt�dt|��|Sd}~XYnX|S)zW
    Calculates total count of sites with at least one enabled
    module per user
    rNz3Error while getting info from clwpos user config %s)rr	Z"get_enabled_sites_count_by_modules�	Exception�_loggerZwarning�str)r
r�countZuc�e�r�=/opt/alt/python37/lib/python3.7/site-packages/clwpos/stats.py�,get_sites_count_with_enabled_wpos_statisticss
rcsPyt�|�j}Wn tk
r0t�d|�dSXt|��t�fdd�|D��S)z:
    Checks if there are any allowed modules for user
    zUnable to get uid for %sFc3s|]}|�kVqdS)Nr)�.0Zchecked_module)�allowed_modulesrr�	<genexpr>3sz?get_users_count_with_allowed_wpos_statistics.<locals>.<genexpr>)�pwd�getpwnamZpw_uid�KeyErrorr�debugr�any)r
rZuidr)rr�,get_users_count_with_allowed_wpos_statistics)sr�allowed)�modules�kindcCsHd}t��}x6|D].}|dkr2t||�r@|d7}q|t||�7}qW|S)z�
    Returns total count of users with allowed wpos module
    or total count of sites with enabled wpos module
    for all panel users on server
    rr�)rZcpusersrr)rr Ztotal_countZpanel_usersr
rrr� _get_wpos_statistics_total_count6s


r"c
CsHy
t�}Wn2tk
r<}zt�dt|��dSd}~XYnX|�d�S)z0
    Obtains admin`s options, e.g show_icon
    z$Error when getting admin options: %si���NZ	show_icon)rr
r�errorr�get)Zoptionsrrrr�is_accelerate_wp_icon_enabledGs
r%cCs�tj�d�}t�}t�t�||d�}ttd�|dd<ttd�|dd<x4tD],}t|gd�|d|<t|gd�|d|<qNW|S)zj
    Returns current statistics with enabled sites/allowed users counters
    per module and in total
    z/var/lve/enable-wpos.flag)�
allowed_users�
enabled_sitesZis_accelerate_wp_flag_enabledr%rr&ZtotalZenabledr')�os�path�isfiler%�dictr"r)Zis_feature_flagZis_feature_icon_enabled�result�modulerrr�fill_current_wpos_statisticsSs"
r.)r)r(r�typingrZclcommonrZclcommon.clpwdrZclwpos.logsetuprZclwpos.optimization_modulesrrZclwpos.utilsrZclwpos.user.configr	rr�intrrr"r%r.rrrr�<module>s


https://t.me/AnonymousX5 - 2025