Your IP : 18.222.175.173
�
c1�g�
� � � d Z ddlZddlZddlZddlmZ ddlmZmZ ddl m
Z
mZmZ ej
e� � Zdeez fd�Zdefd�Zdefd �ZdS )
u
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Copyright © 2019 Cloud Linux Software Inc.
This software is also available under ImunifyAV commercial license,
see <https://www.imunify360.com/legal/eula>
� N)� check_run)�
WordpressSite�WPSite)�PLUGIN_PATH�utils�PLUGIN_SLUG�sitec � �x K � t j | j � � j }t j | j |� � }g t j || j � � �d�d�t t � � �d�d�}t j ||� � }t �
d|� �� � t |� � � d{V �� dS )zFInstall the Imunify Security WordPress plugin on given WordPress site.�plugin�installz
--activatez--forcezInstalling wp plugin N)�pwd�getpwuid�uid�pw_namer �get_php_binary_path�domain�
wp_wrapper�docroot�strr �build_command_for_user�logger�infor �r �username�php_path�args�commands �G/opt/imunify360/venv/lib/python3.11/site-packages/imav/wordpress/cli.py�plugin_installr % s� � � � ��|�D�H�%�%�-�H��(���h�?�?�H�� � �(�D�L� 1� 1���� �� �K��� �
�� �
�D� �*�8�T�:�:�G�
�K�K�1��1�1�2�2�2�
�G�
�
���������� c � �^ K � t j | j � � j }t j | j |� � }g t j || j � � �d�d�t �d�d�}t j
||� � }t � d|� �� � t |� � � d{V �� dS )z;Deactivate the imunify-security wp plugin on given wp site.r �
deactivatez--uninstallz--allow-rootzDeactivating wp plugin N)r
r r r r r r r r r r r r r r s r �plugin_deactivater# : s� � � � ��|�D�H�%�%�-�H��(���h�?�?�H�� � �(�D�L� 1� 1���� �� � �
�� �
�D� �*�8�T�:�:�G�
�K�K�3�'�3�3�4�4�4�
�G�
�
���������r c � �X K � t j | j � � j }t j | j |� � }g t j || j � � �d�d�}t j ||� � }t � d|� �� � t j
|� � }|j dk S )zJCheck if WordPress is installed and given site is accessible using WP CLI.�corezis-installedz#Checking if WordPress is installed r )r
r r r r r r r r r r r �
subprocess�run�
returncode)r r r r r �results r �is_wordpress_installedr* M s� � � � ��|�D�H�%�%�-�H��(���h�?�?�H�� � �(�D�L� 1� 1���� ��D�
�*�8�T�:�:�G�
�K�K�?�g�?�?�@�@�@�
�^�G�
$�
$�F����!�!r )�__doc__�loggingr
r&