ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib/python3.11/site-packages/xray/manager/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/xray/manager/__pycache__/custom.cpython-311.pyc

�

��f����dZddlmZddlmZddlmZddlmZ	ddl
mZddlm
Z
d	d
lmZmZd	dlmZd	dlmZmZGd
�de
��ZdS)zZ
This module contains classes implementing X-Ray Manager behaviour
for custom integration
�)�ChainMap)�Optional)�	PublicApi)�gettext)�
phpinfo_utils�)�BaseManager�)�XRayManagerError�XRayMissingDomain)�
DomainInfo)�user_mode_verification�with_fpm_reload_restrictedc
����eZdZdZddddddddddddd�Z�fd�Zdefd�Zed���Z	de
fd�Zee
d	edefd
�����Zdedefd�Zd
edeefd�Zdedefd�Zdedef�fd�Z�xZS)�
CustomManagerz0
    Manager supporting integration scripts
    N)�54�55�56�70�71�72�73�74�80�81�82�83c����t��j|i|��t��|_|jr|���|_dSttd�����)Nz.X-Ray is not supported by control panel vendor)	�super�__init__r�api�is_xray_integrated�get_all_domains�all_domainsr�_)�self�args�kwargs�	__class__s   ��J/opt/cloudlinux/venv/lib64/python3.11/site-packages/xray/manager/custom.pyr zCustomManager.__init__0sq��������$�)�&�)�)�)��;�;����"�	E�#�3�3�5�5�D����"��B�C�C�E�E�
E��returnc�6�t|j|j��S)za
        Get supported PHP versions
        :return: dict with custom supported versions
        )r�VERSIONS�VERSIONS_CUSTOM�r&s r*�supported_versionsz CustomManager.supported_versions:s ��
��
��,�.�.�	.r+c�v�|j���}|j}|�dS|�dd��S)zN
        Check the X-Ray feature status through the panel_info script
        NT�xrayF)r!�
panel_info�supported_cl_features�get)r&�_info�featuress   r*r"z CustomManager.is_xray_integratedBs>��
��#�#�%�%���.�����4��|�|�F�E�*�*�*r+c�8�|j�d���S)z9
        Collect domains from integration script
        T)�with_php)r!�domainsr0s r*r#zCustomManager.get_all_domainsNs���x�����.�.�.r+�domain_namec��	|j|}n;#t$r.|j�dd|i���t	|���wxYw|jrRt
j|j|���}t||�
d��|jd|j|j���St||j|j
j|j
j|j
j|j
j���}|j�d	||j|j��|S)
z<
        Retrieve PHP setting for given domain_name
        z#Domain does not exist on the serverr<)�extra)�domain�T)�name�panel_php_version�php_ini_scan_dir�is_selector_applied�user�	panel_fpm)rArErBrF�	is_native�ini_pathz@Retrieved domain info: domain %s owned by %s uses php version %s)r$�KeyError�logger�warningr�phpinfo_moder�get_php_configuration�ownerr
�get_full_php_version�absolute_ini_scan_dir�
is_php_fpm�php�version�fpmrGrH�inforErB)r&r<�domain_conf�config�domain_infos     r*�get_domain_infozCustomManager.get_domain_infoTsR��	1��*�;�7�K�K���	1�	1�	1��K���5�$�k�2�
 �
4�
4�
4�$�K�0�0�0�		1������	�"�8��!�"�$�$�$�F�� �"(�"=�"=�b�"A�"A�!'�!=�%)� �&� �+�
�
�
�

�%� � �&�"-�/�"9�%�/�-�%�/�3�$��1�
���K�	
����N���)�;�+H�	J�	J�	J��s	�
�8ArXc� �|jo|jS)z�
        Check if selector is enabled specifically for custom panels
        Required to be implemented by child classes
        :param domain_info: a DomainInfo object
        :return: True if yes, False otherwise
        )rGrF�r&rXs  r*�panel_specific_selector_enabledz-CustomManager.panel_specific_selector_enabled�s���$�B�[�-B�)B�Br+�dom_infoc��|jS)z+
        Retrieve FPM service name
        )rF)r&r]s  r*�fpm_service_namezCustomManager.fpm_service_name�s
���!�!r+c��|jS)zL
        Path to additional .ini files specific custom panel getter
        )rHr[s  r*�	_ini_pathzCustomManager._ini_path�s
���#�#r+c�j��|jr|jSt���|��}|�d��rm|j�d��sS|j}d|j��|_	|jp|}n#t$rYnwxYw||_|j�d|��|S)a�
        Resolve a path to directory for additional ini file.
        It depends on version set for domain and on selector
        NOTE:
        This method is overrided to manage php.d.location=selector resolving.
        In custom integration we do not know if PHP version is alt or not,
        it is set as just two digits.
        Thus, we only could rely on resolved path -- if it is '/opt/alt'.
        :param domain_info: a DomainInfo object
        :return: path to directory for ini files
        z/opt/altzalt-phpzIni path re-resolved as %s)	rCr�get_ini_path�
startswithrB�phpd_location_ini_path�
ValueErrorrJrU)r&rXrH�saved_panel_phpr)s    �r*rczCustomManager.get_ini_path�s�����'�	0��/�/��7�7�'�'��4�4��������	E�$/�$A�$L�$L��%�%�	E�*�;�O�,U�k�6S�,U�,U�K�)�
�&�=�I������
�
�
���
����-<�K�)��K���9�8�D�D�D��s�7	B�
B�
B)�__name__�
__module__�__qualname__�__doc__r/r rr1�propertyr"�dictr#rr�strr
rY�boolr\rr_rarc�
__classcell__)r)s@r*rrs����������������������
�
�O�E�E�E�E�E�.�H�.�.�.�.��	+�	+��X�	+�/��/�/�/�/���)�3�)�:�)�)�)� ����)�VC�:�C�$�C�C�C�C�"��"���
�"�"�"�"�$�Z�$�C�$�$�$�$��
��s����������r+rN)rk�collectionsr�typingr�clcommon.cpapi.plugins.vendorsrr3rr%�
xray.internalr�baser	�internal.exceptionsrr�internal.typesr
�internal.user_plugin_utilsrrr�r+r*�<module>rzs
����
!� � � � � �������4�4�4�4�4�4�������'�'�'�'�'�'�������E�E�E�E�E�E�E�E�'�'�'�'�'�'���������W�W�W�W�W�K�W�W�W�W�Wr+

Zerion Mini Shell 1.0