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: failed to execute unzip for all import/export #39

Merged

Conversation

david-bzh
Copy link

Checklist:

  • I've read the Contributing page.
  • I've created an issue and referenced it here #27 .
  • My code is tested.
  • My code follows the WordPress code style.
  • My code has proper inline documentation.

Description

I changed api call in POST for GET the api return seems more stable.

How has this been tested?

I have tested installation for :

  • wp-all-import-pro -> 4.7.6
  • wpai-acf-add-on -> 3.3.7
  • wpai-linkcloak-add-on -> 1.1.5
  • wpai-user-add-on -> 1.1.7
  • wpai-woocommerce-add-on -> 3.3.3
  • wp-all-export-pro -> 1.8.0
  • wpae-acf-add-on -> 1.0.4
  • wpae-woocommerce-add-on -> 1.0.5
  • wpae-user-add-on-pro -> 1.0.7

testing environment

  • php 7.4.30
  • Composer 2.4.1

@junaidbhura
Copy link
Owner

junaidbhura commented Sep 20, 2022

Hi @david-bzh thanks for the PR! Could you elaborate what your PR does, and how it improves stability?

If you look at wp-all-import-pro/classes/updater.php - you'll see wp_remote_post being used which essentially sends a POST not a GET. So the plugin itself uses a POST.

@david-bzh
Copy link
Author

Hi @junaidbhura thank you for your feedback, which allowed me to deepen on my problematic,

it seems that there were two problems for the failed to execute unzip.

Problème 1 : Api return of wp all export by request POST

request POST ( after )
Screenshot-1

This problem seems to be solved without really knowing how.

the posibile actions are :

  • We have activated the key on a wordpress ( this key never used ) .
  • Corectif of wp all import on their Api .

For my part I did not do anything else for this problem, request GET does not do any verification on the key

request GET
Screenshot-2

request POST
Screenshot-3

Problem 2 : defaut $arg_separator for fn http_build_query()

On a client server $arg_separator by default is & and not &

Screenshot-4

Solution 1 : change code

  • Force $arg_separator as http_build_query( $query_var, '', '&' )

Solution 2 : for the developer gist.github:

  • Create file composer.php.ini
arg_separator.input="&"
  • run cmd
php -n -c /usr/local/lib/composer.php.ini /usr/local/bin/composer.phar

Tell me if you want to do something else, sorry for the response time

@junaidbhura
Copy link
Owner

Thanks @david-bzh I think the & fix would be a good one to make here instead? https://github.com/junaidbhura/composer-wp-pro-plugins/blob/master/Http.php#L31 so that all the plugins can benefit from it?

    - Add '&' for the $arg_separator parameter
@david-bzh david-bzh force-pushed the fix-failed-to-execute-unzip branch from 9046d5d to 20ea644 Compare September 30, 2022 11:52
@david-bzh
Copy link
Author

Hi @junaidbhura , yes it is the best solution, I changed my commit with the new patches. Thanks !

@junaidbhura
Copy link
Owner

Thanks @david-bzh ! Let me test this out before merging!

@junaidbhura junaidbhura merged commit becbdde into junaidbhura:master Oct 9, 2022
@junaidbhura
Copy link
Owner

Looks good and merged thanks @david-bzh !

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.

3 participants