Your IP : 18.222.175.173


Current Path : /opt/imunify360/venv/lib64/python3.11/site-packages/imav/wordpress/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib64/python3.11/site-packages/imav/wordpress/__pycache__/cli.cpython-311.pyc

�

c1�g�
���dZddlZddlZddlZddlmZddlmZmZddl	m
Z
mZmZej
e��Zdeezfd�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��xK�tj|j��j}t	j|j|��}gt	j||j���d�d�tt���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�tj|j��j}t	j|j|��}gt	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
rrrrrrrrrrrrrrs     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��XK�tj|j��j}t	j|j|��}gt	j||j���d�d�}t	j	||��}t�d|����tj
|��}|jdkS)zJCheck if WordPress is installed and given site is accessible using WP CLI.�corezis-installedz#Checking if WordPress is installed r)r
rrrrrrrrrrr�
subprocess�run�
returncode)r	rrrr�results      r�is_wordpress_installedr*Ms������|�D�H�%�%�-�H��(���h�?�?�H��	�	�(�D�L�	1�	1����	��D�
�*�8�T�:�:�G�
�K�K�?�g�?�?�@�@�@�
�^�G�
$�
$�F����!�!r )�__doc__�loggingr
r&�defence360agent.utilsr�imav.model.wordpressrr�imav.wordpressrrr�	getLogger�__name__rrr#r*�r r�<module>r3s�����*����
�
�
�
�����+�+�+�+�+�+�6�6�6�6�6�6�6�6�����������
��	�8�	$�	$���}�v�5�����*�-�����&"�}�"�"�"�"�"�"r 

?>