HEX
Server: LiteSpeed
System: Linux ws4.angoweb.net 5.14.0-611.13.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 11 04:57:59 EST 2025 x86_64
User: tswangoe (2287)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/xray/manager/__pycache__/custom.cpython-37.pyc
B

�*Ud~�@spdZddlmZddlmZddlmZddlmZddl	m
Z
dd	lmZdd
l
mZmZGdd�de�Zd
S)zZ
This module contains classes implementing X-Ray Manager behaviour
for custom integration
�)�ChainMap)�Optional)�	PublicApi�)�BaseManager�)�XRayManagerError)�
DomainInfo)�user_mode_verification�with_fpm_reload_restrictedcs�eZdZdZddddddddddd�
Zed��fdd�Zed�dd	�Ze	d
d��Z
ed�dd
�Ze
eeed�dd���Zeed�dd�Zeeed�dd�Zeed�dd�Zeed��fdd�Z�ZS)�
CustomManagerz0
    Manager supporting integration scripts
    N)
�54Z55Z56Z70Z71Z72Z73Z74�80Z81)�	system_idcs2t��|�t�|_|jr&|��|_ntd��dS)Nz.X-Ray is not supported by control panel vendor)�super�__init__r�api�is_xray_integrated�get_all_domains�all_domainsr)�selfr)�	__class__��D/opt/alt/python37/lib/python3.7/site-packages/xray/manager/custom.pyr,szCustomManager.__init__)�returncCst|j|j�S)za
        Get supported PHP versions
        :return: dict with custom supported versions
        )r�VERSIONS�VERSIONS_CUSTOM)rrrr�supported_versions5sz CustomManager.supported_versionscCs(|j��}|j}|dkrdS|�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�featuresrrrr=s

z CustomManager.is_xray_integratedcCs|jjdd�S)z9
        Collect domains from integration script
        T)�with_php)r�domains)rrrrrIszCustomManager.get_all_domains)�domain_namercCs�y|j|}Wn<tk
rJ|jjdd|id�td|�d�dd��YnXt||j|jj|jj	|jj
|jjd�}|j�d	||j
|j�|S)
z<
        Retrieve PHP setting for given domain_name
        z#Domain does not exist on the serverr&)�extrazDomain 'z' does not exist on this serveriV)�errno)�name�user�panel_php_version�	panel_fpm�	is_native�ini_pathz@Retrieved domain info: domain %s owned by %s uses php version %s)r�KeyError�logger�warningrr	�owner�php�version�fpmr-r.�infor*r+)rr&Zdomain_conf�domain_inforrr�get_domain_infoOs(
zCustomManager.get_domain_info)r7rcCs|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
        )r-r,)rr7rrr�panel_specific_selector_enabledlsz-CustomManager.panel_specific_selector_enabled)�dom_inforcCs|jS)z+
        Retrieve FPM service name
        )r,)rr:rrr�fpm_service_nameuszCustomManager.fpm_service_namecCs|jS)zL
        Path to additional .ini files specific custom panel getter
        )r.)rr7rrr�	_ini_path{szCustomManager._ini_pathcsrt��|�}|�d�rn|j�d�sn|j}d|j��|_y|jp@|}Wntk
rXYnX||_|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)r�get_ini_path�
startswithr+�phpd_location_ini_path�
ValueErrorr0r6)rr7r.Zsaved_panel_php)rrrr=�szCustomManager.get_ini_path)�__name__�
__module__�__qualname__�__doc__r�strrrr�propertyr�dictrr
rr	r8�boolr9rr;r<r=�
__classcell__rr)rrrs,		rN)rD�collectionsr�typingrZclcommon.cpapi.plugins.vendorsr�baserZinternal.exceptionsrZinternal.typesr	Zinternal.user_plugin_utilsr
rrrrrr�<module>s