File: //opt/cloudlinux/venv/lib64/python3.11/site-packages/clwpos/php/__pycache__/alt_php.cpython-311.pyc
�
�4j
� � � d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ d dl m
Z
dZd
defd�Z
d ee
fd
�Zd� Zd� ZdS )� )�absolute_importN)�List)� is_ubuntu)�PHPz/usr/bin/selectorctl�alt_php_identifierc �r � |�d| � dd� � � d�}n|}t � � sdnd}|r|nt } || | d � d| d � �t j � ||� � |t j � |d � � t j � |d
� � �� � S )Nz/opt/�-�/zusr/lib64/php/modules/z%usr/lib/x86_64-linux-gnu/php/modules/����.���zusr/bin/phpzlink/conf/default.ini)�
identifier�version�modules_dir�dir�bin�ini)�replacer r �os�path�join)r � root_path�base_cls�php_root_dir�modules_base_dirs �I/opt/cloudlinux/venv/lib64/python3.11/site-packages/clwpos/php/alt_php.py�create_generic_phpr
s� � ���F�1�9�9�#�s�C�C�F�F�F��� ��7@�{�{�o�/�/�Ho��#�,�x�x��H��8�%�%�b�)�D�D�,>�r�,B�D�D��G�L�L��/?�@�@���G�L�L��}�5�5��G�L�L��'>�?�?�
� � � � �returnc �( � d} t j d� � }g }t j | � � D ]d}|� |� � s�t d|� �� � }t j � |j � � s�O|� |� � �e|S )u�
Get list of installed alt-php versions.
Skip /opt/alt/phpNN dirs whose php binary is missing — otherwise
callers like PHP.is_extension_loaded() crash with FileNotFoundError.
z/opt/altz
^php\d{2}$zalt-)
�re�compiler �listdir�matchr r �existsr �append)�alt_dir�pattern�alt_php_versions�dirname�php_versions r �get_alt_php_versionsr, ! s� � � �G��j��'�'�G����:�g�&�&� -� -���}�}�W�%�%� ��(�)9��)9�)9�:�:���w�~�~�k�o�.�.� ������,�,�,�,��r c
� � g }t j t dd|gdd�� � j }|r1d� |� � � � d� � D � � }|s|� d|� � dS |� d t | � � |t |� � � � |D ]\}t j t d
d� | � � d|d|gdd�� � }|� dt |� � |� � �]dS )
z\
To turn off extensions in selector for avoiding them loading in separate places!!!
z--list-usersz --versionT��capture_output�textc �: � g | ]}|�|� � � ��S � )�strip)�.0�lines r �
<listcomp>z/disable_selector_extensions.<locals>.<listcomp>= s&