관리-도구
편집 파일: smart_advice_plugin_helpers.cpython-311.pyc
� b��fC � � � d dl Z d dlZd dlZd dlmZ d dlmZmZ d dlmZ d dl m Z d dlmZ d dlmZ d dlmZ G d � d e� � Zd� Zd� Zd � Zd� Zd� Zd� ZdS )� N)�Enum)�datetime� timedelta)�docroot)�wp_get_constant)�gettext)�user_context)� disable_quotac � � e Zd ZdZdZdZdZdS )�PluginStatusesa� INSTALLED = plugin exists in MU directory ERROR = plugin should have been installed: there are advices w/o incompatibility and created_at > 2days (wordpress-install cron expected to trigger install) NOT_INSTALLED = plugin does not exist in MU directory: in ideal world it means whether there are no compatible advices or wordpress-plugin install cron has not worked yet � INSTALLED�ERROR� NOT_INSTALLEDN)�__name__� __module__�__qualname__�__doc__r r r � � �W/opt/cloudlinux/venv/lib64/python3.11/site-packages/xray/smart_advice_plugin_helpers.pyr r s) � � � � � � � � �I��E�#�M�M�Mr r c �� � t j � |� � rdS t j | � � }t |j |j � � 5 t � � 5 t j |� � nQ# t $ rD}t j d|t |� � � � t t d� � � � �d}~ww xY w ddd� � n# 1 swxY w Y ddd� � dS # 1 swxY w Y dS )z5 Creates MU plugin dir if does not exist yet Nz<Failed creating must use plugin folder. Path: %s. Reason: %sz%Unable to create MU plugins directory)�os�path�isdir�pwd�getpwnamr �pw_uid�pw_gidr �makedirs�OSError�logging�error�str� ValueError�_)�user� mu_plugin_dir� user_data�es r �"create_mu_plugins_dir_if_not_existr* $ s� � � �w�}�}�]�#�#� �����T�"�"�I� �i�&� �(8� 9� 9� I� I�=�?�?� I� I� I��K� �&�&�&�&��� I� I� I��M�X�'��Q��� 1� 1� 1� �Q�F�G�G�H�H�H����� I���� '�I� I� I� I� I� I� I� I� I� I� I���� I� I� I� I� I� I� I� I� I� I� I� I� I� I� I� I���� I� I� I� I� I� IsZ �C,�C�!A6�5C�6 C� ?B?�?C�C�C,�C �C,�C �C,�,C0�3C0c �� � d}t j | � � }t |j |j � � 5 t |dd�� � }n9# t $ r,}t j dt |� � � � Y d}~nd}~ww xY w|sM t |dd�� � }n9# t $ r,}t j dt |� � � � Y d}~nd}~ww xY wddd� � n# 1 swxY w Y |S )z0 Gets path to directory with MU plugins N�WPMU_PLUGIN_DIRT)�raise_exceptionz3Unable to read WPMU_PLUGIN_DIR constant, "error=%s"�WP_CONTENT_DIRz2Unable to read WP_CONTENT_DIR constant, "error=%s") r r r r r r � Exceptionr! r"