-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(install): verify addon Give dependency before update #3217 #3268
Conversation
includes/actions.php
Outdated
'Give_Addon_Update_Error', | ||
sprintf( | ||
__( 'You need Give version %s to update this plugin.', 'give' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DevinWalker Need you help to update this text
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give version %s is required to update this add-on.
*/ | ||
function __construct( $file_url ) { | ||
$this->file_url = $file_url; | ||
$this->file_content = ! empty( $this->file_url ) ? file_get_contents( $this->file_url ) : ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In WordPress, we have a specific function to retrieve the content from URL
We should used that in place of Core PHP functions
https://codex.wordpress.org/Function_API/wp_remote_retrieve_body
@ravinderk I tested this PR by updating the Give Add-on plus non-Give Plugin to. It's working as expected and awesome |
*/ | ||
public function requires_at_least() { | ||
// Regex to extract Give core minimum version from the readme.txt file. | ||
preg_match('|Give requires at least:(.*)|i', $this->file_content, $_requires_at_least ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the parsed text
@DevinWalker Changes done. |
Description
This pr will resolve #3217
How Has This Been Tested?
I tested this pr by updating multiple licensed Give addon.
Testing video: https://drive.google.com/file/d/1Jrdy9wQdiQirzid0CncdGmO9RyiSoECL/view?
usp=sharing
Snippet link: https://givewp.slack.com/files/U1DDJMUTV/FAWLZ3GSD/give_pull_3268.php
Checklist: