Skip to content
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

Merged
merged 5 commits into from
May 30, 2018

Conversation

ravinderk
Copy link
Collaborator

@ravinderk ravinderk commented May 28, 2018

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:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows has proper inline documentation.

'Give_Addon_Update_Error',
sprintf(
__( 'You need Give version %s to update this plugin.', 'give' ),
Copy link
Collaborator Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ravinderk

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 ) : '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ravinderk

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

@raftaar1191
Copy link
Contributor

@ravinderk I tested this PR by updating the Give Add-on plus non-Give Plugin to. It's working as expected and awesome

image

*/
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 );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's parse this text instead:

Requires Give: 2.1

2018-05-28_13-03-35

Copy link
Member

@DevinWalker DevinWalker left a 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

@ravinderk
Copy link
Collaborator Author

@DevinWalker Changes done.

@DevinWalker DevinWalker merged commit 928ccd9 into release/2.1.4 May 30, 2018
@DevinWalker DevinWalker deleted the issues/3217 branch May 30, 2018 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants