hp | d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z m
Z
mZ ddlm
Z
mZ ddlmZmZmZ ddlmZ dd lmZ ej e Zd
edefdZd
edefdZdedefdZdefdZdefdZ defdZ!defdZ"defdZ#defdZ$defdZ%defdZ& ed defd Z'd Z(defdZ)dS )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 .
Copyright © 2019 Cloud Linux Software Inc.
This software is also available under ImunifyAV commercial license,
see
N)Path)
StrictVersion) check_run
CheckRunErrorasync_lru_cache)PLUGIN_PATHPLUGIN_SLUG)build_command_for_userget_php_binary_path
wp_wrapper)log_message)WPSiteversion_strreturnc t | t sdS | }|sdS t | dS # t $ r Y dS w xY w)z1Validate if a string is a valid semantic version.FT)
isinstancestrstripr
ValueError)r trimmed_strs G/opt/imunify360/venv/lib/python3.11/site-packages/imav/wordpress/cli.py_validate_semverr - su k3'' u ##%%K uk"""t uus A
AAoutputc b | sdS | }|sdS t | dk r+|d }t | r|S t | dk r+|d }t | r|S t dd| iddd
dS )z
Extract version from WP CLI output, trying both first and last parts.
Args:
output: The raw output from WP CLI
Returns:
The extracted version string or None if no valid version found
Nr zMFailed to extract valid semver version from WP CLI output. Output: '{output}'r warning wordpressz#wp-plugin-version-extraction-failed)format_argslevel componentfingerprint)splitlenr r r
)r parts
first_part last_parts r _extract_version_from_outputr( ? s t
LLNNE t 5zzA~~1X^^%%
J'' 5zzA~~"IOO%% I&&