Mini Shell

Direktori : /usr/share/cagefs/__pycache__/
Upload File :
Current File : //usr/share/cagefs/__pycache__/phpinivalidator.cpython-311.pyc

�

F��w����dZddlmZddlmZddlmZddlmZddlmZej��ddl	Tddl
Z
ddlZe
jd	��Z
d
�ZGd�de��ZdS)
z9
Module to validate the configuration file alt_phpXX.cfg
�)�absolute_import)�division)�print_function)�unicode_literals)�standard_library)�*Nzalt_php(\d)(\d)\.cfgc���t�tj�|����}|r)d�|�dd����SdS)zr
    function to get the version of the php file name alt_phpXX.cfg
    for example: 'alt_php55.cfg' => '5.5'
    �.��N)�ALTPHPVER_PATTERN�search�os�path�basename�join�group)�input_phpini_path�php_ver_searcheds  �c/builddir/build/BUILDROOT/cagefs-7.6.19-1.el9.cloudlinux.x86_64/usr/share/cagefs/phpinivalidator.py�get_php_verrs^��
)�/�/���0@�0@�AR�0S�0S�T�T���6��x�x�(�.�.�q�!�4�4�5�5�5�6�6�c�l�eZdZejd��Zejd��ZdZd
d�Zd�Z	d�Z
d�Zd	S)�PHPINIvalidatorz/(^Directive|Type|Range|Remark)\s*=\s*(.*\S)\s*$z@^([a-zA-Z0-9_.]+)\s*=\s*([^;="]+[^;=" \t]|".+"|[^;="])\s*(;.*)?$)�On�Off�0�1�True�False�/etc/cl.selector/php.confc�|�||_|�|j��|_g|_g|_g|_dS)N)�phpconf_path�
_load_phpconf�
_phpconf_data�unknown_options�invalid_values_options�invalid_options)�selfr#s  r�__init__zPHPINIvalidator.__init__)sA��(���!�/�/��0A�B�B���!���&(��#�!����rc�d�i}d}t|��}|D]�}|�d��r�|j�|�����}|s�G|�dd��\}}|dkr|}t
��||<�z||||<��|���|S)z�
        Load reference data.
        Gets a dictionary of the form; example:
        {'upload_max_filesize': {'Default':'2M', 'Type':'list', 'Range'; '2M,4M,8M,16M,32M,64M,128M,256M,512M,1G'}
        N�#rr�	Directive)�open�
startswith�DIRECTIVE_PATTERNr�rstripr�dict�close)	r)r#�phpconf_dict�directive_title�phpconf�phpconf_line�searched�directive_name�
directive_vals	         rr$zPHPINIvalidator._load_phpconf3s��������|�$�$��#�	N�	N�L��&�&�s�+�+�
���-�4�4�\�5H�5H�5J�5J�K�K�H��
��,4�N�N�1�a�,@�,@�)�N�M���,�,�"/��04����_�-�-�@M��_�-�n�=�=��
�
�����rc�
�g}g|_g|_g|_|D�]g}|}|�d��r|�|���0	|���}|�d��r|dz
}|j�|���	dd��\}}|�
|||���\}	}
|	s-|j�|�����n.|
s,|j�|�����n@#t$r3d}	d}
|j�|�����YnwxYw|	r|
sd|z}|�|����i|S)N�;�=rrr)r9r:�php_verF)r&r'r(r/�append�strip�endswith� CUSTOM_OPTIONS_DIRECTIVE_PATTERNrr�_validate_directive_val�AttributeError)r)�input_phpini_linesr>�output_phpini_lines�input_phpini_line�output_phpini_line�input_phpini_line1r9r:�is_valid_directive�is_valid_values           r�validatezPHPINIvalidator.validateLs��� ��!���&(��#�!���!3�	;�	;��!2�� �+�+�C�0�0�
�#�*�*�+=�>�>�>��
G�%6�%<�%<�%>�%>�"�%�.�.�s�3�3�.�&�#�-�&�04�0U�0\�0\�]o�0p�0p�0v�0v�wx�z{�0|�0|�-��
�59�5Q�5Q�ao�@M�W^�5Q�6_�6_�2�"�N�)�V��(�/�/�0A�0G�0G�0I�0I�J�J�J�J�*�V��3�:�:�;L�;R�;R�;T�;T�U�U�U���!�
G�
G�
G�%*�"�!&���$�+�+�,=�,C�,C�,E�,E�F�F�F�F�F�
G����'�
=�>�
=�%(�+<�%<�"��&�&�'9�:�:�:�:�"�"s�CD#�#:E �E c��|j�|��}|sdS|d}|�d��}|r�|�d��s|�d��r||d}|dd�}|dkr/|�d	��|�d	��krdSn�|dkr.|�d	��|�d	��krdSnX|�d	��}	|	d�d	|	d��}
|�d	��}|d�d	|d��}|
|krdS||jvrdS|d
kr||jvrdSn%|dkr||d
�d��vrdSdS)aG
        Validates directive for supplied PHP version
        :param directive_name: Directive name
        :param directive_val: Directive name
        :param php_ver: PHP version (3 digits) to check directive
        :return: Tuple (is_valid_directive, is_valid_value) - boolean flags validity of directive and value
        )FF�Type�Remark�>�<rrNr
�bool)TF�list�Range�,)TT)r%�getr/�split�BOOLEAN_VARIANTS)
r)r9r:r>�directive_data_dict�directive_data_type�remark�remark_znak�
remark_ver�remark_ver_parts�remark_ver_2digit�
php_ver_parts�php_ver_2digits
             rrCz'PHPINIvalidator._validate_directive_valms���#�0�4�4�^�D�D��"�	 ��<�1�&�9��$�(�(��2�2���	(�� � ��%�%�
(��):�):�3�)?�)?�
(�$�Q�i��#�A�B�B�Z�
��#�%�%��}�}�S�)�)�J�,<�,<�S�,A�,A�A�A�+�|�B�!�C�'�'��}�}�S�)�)�J�,<�,<�S�,A�,A�A�A�+�|��$*�<�<��#4�#4� �/?��/B�/B�/B�DT�UV�DW�DW�$X�!� '�
�
�c� 2� 2�
�,9�!�,<�,<�,<�m�A�>N�>N�!O��$��6�6�'�<���!3�3�3��<��&�(�(��D�$9�9�9�"�{�:�!�F�
*�
*��$7��$@�$F�$F�s�$K�$K�K�K�"�{��zrN)r!)�__name__�
__module__�__qualname__�re�compiler0rBrXr*r$rLrC�rrrr#s�������"��
�#U�V�V��'1�r�z�2u�'v�'v�$�?��"�"�"�"����2#�#�#�B3�3�3�3�3rr)�__doc__�
__future__rrrr�futurer�install_aliases�builtinsrerrfr
r�objectrrgrr�<module>rns�����'�&�&�&�&�&�������%�%�%�%�%�%�'�'�'�'�'�'�#�#�#�#�#�#� �� �"�"�"�����	�	�	�	�	�	�	�	��B�J�6�7�7��6�6�6�}�}�}�}�}�f�}�}�}�}�}r

Zerion Mini Shell 1.0