PATH:
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
clwpos
/
__pycache__
� �����>�� �r � d dl Z d dlZd dlmZ d dlmZ d dlmZmZm Z d dl mZ d dlm Z mZ d dlmZ dZd Zd ZdZdZd ZdZdZdZefZefZdeddfd�Zdeddfd�Zdefd�Zd(d�Z d(d�Z!defd�Z"d(d�Z#d(d�Z$defd�Z%d(d�Z&d(d�Z'd(d�Z(d� Z)d(d �Z*d(d!�Z+d(d"�Z,d(d#�Z-d$� Z.d%� Z/d&� Z0e1d'k r e0� � dS dS ))� N)�get_python_lib)�Path)�ALT_PHP_REDIS_ENABLE_UTILITY�INSTALL_CACHING_HOOKS_UTILITY�PHP_REDIS_ENABLE_UTILITY)�OBJECT_CACHE_FEATURE)�any_suite_allowed_on_server�is_module_allowed_for_user)�is_wpos_supportedz//etc/dnf/universal-hooks/multi_pkgs/transactionz-/etc/yum/universal-hooks/multi_pkgs/posttransz//etc/apt/universal-hooks/multi_pkgs/Post-Invokezalt-php__WILDCARD__-pecl-extzea-php__WILDCARD__zplesk-php__WILDCARD__z%/usr/share/cloudlinux/hooks/listenerszwpos_modify_user_hook.pyzwpos_user_dirs_hook.py� target_binary�returnc �� � | � � }|� dd�� � t |� � j }t ||� � }|� � � s|� |� � dS dS )zP Create hook dir and symlink the target binary if it doesn't exist yet. T)�parents�exist_okN)�mkdirr �name�exists� symlink_to�� path_providerr � hook_dir_path� hook_name�hook_full_paths �py/clwpos/wpos_hooks.py�_install_universal_hookr * s � � "�M�O�O�M�����t��4�4�4��]�#�#�(�I��-��3�3�N�� � �"�"� 1��!�!�-�0�0�0�0�0�1� 1� c � � | � � }t |� � j }t ||� � }|� � � r|� � � dS dS )z: Remove hook symlink if present (even if broken). N)r r � is_symlink�unlinkr s r �_uninstall_universal_hookr 6 sd � � "�M�O�O�M��]�#�#�(�I��-��3�3�N�� � �"�"� ��������� � r c � � t } t d� � � � � rt t | � � S t d� � � � � rt t | � � S t t | � � S )zL Get path to yum universal hooks directory with alt-php* hooks. � /etc/apt/� /etc/dnf/)�ALT_HOOK_DIRNAMEr r �UNIVERSAL_HOOK_PATH_APT�UNIVERSAL_HOOK_PATH_DNF�UNIVERSAL_HOOK_PATH_YUM��dir_names r �get_universal_hook_alt_php_pathr* A st � � �H��K�����!�!� 7��+�X�6�6�6� �k� � � !� !� #� #� 7��+�X�6�6�6��'��2�2�2r c �: � t t t � � dS )zo Install yum universal hook for configuring PHP redis after alt-php* package is installed/updated. N)r r* r � r r �"install_yum_universal_hook_alt_phpr- N s � � �;�=Y�Z�Z�Z�Z�Zr c �: � t t t � � dS �zB Remove yum universal hook for configuring PHP redis ext. N)r r* r r, r r �$uninstall_yum_universal_hook_alt_phpr0 V s � � �=�?[�\�\�\�\�\r c � � t } t d� � � � � rt t | � � S t d� � � � � rt t | � � S t t | � � S )zK Get path to yum universal hooks directory with ea-php* hooks. r"