froger-me / wp-packages-update-server

WP Packages Update Server - Run Your Own Update Server for Plugins and Themes
GNU General Public License v3.0
141 stars 39 forks source link

Example not working #3

Closed atlet closed 5 years ago

atlet commented 5 years ago

I installed Dummy Plugin with licence, but I get folowing error: Unexpected Error! The query to retrieve the license data returned a malformed response.

If I look at developer console, I see javascritp error: image

Any hint how to resolve this issue?

froger-me commented 5 years ago

Hi @atlet ! Is it a new install of both WP Plugin Update Server and Dummy Plugin version 1.4, or is it an update from v1.3?

atlet commented 5 years ago

Hi @froger-me , it's a new install.

froger-me commented 5 years ago

I am investigating, I did not seem to be able to reproduce the javascript error just yet.

atlet commented 5 years ago

Do you need additional data?

froger-me commented 5 years ago

The malformed response error triggered by WP Package Updater library can occur when the server could not be contacted by the plugin that needs to be updated, but could also happen in other cases - it seems I need to change that part to include a more meaningful message.

To provide more data, could you please edit dummy-plugin/lib/wp-package-updater/class-wp-package-updater.php and change the following (lines 394 to 399):

if ( is_wp_error( $response ) ) {
    $license_data          = new stdClass();
    $license_data->message = __( 'Unexpected Error! The query to retrieve the license data returned a malformed response.', 'wp-package-updater' );

    return $license_data;
}

into:

if ( is_wp_error( $response ) ) {
    $license_data          = new stdClass();
    $license_data->message = $response->get_error_message();

    return $license_data;
}

... and then try again, see the message you get, and report here?

I do not know if it has any effect on the JS (I actually doubt it would), but at least I'd know what error you get and could reproduce the entire scenario.

atlet commented 5 years ago

Ok, problem is, that doesen't find url on my server (https://mysitexxx/wppus-license-api):

[status_code] => 404 [protocol_version] => 1.1 [success] => [redirects] => 0 [url] => https://mysitexxx/wppus-license-api/?action=activate&license_key=etr&allowed_domains=wordpress.loc&package_slug=mysuperplugin [history] => Array

I installed WP Plugin Update Server, do I need to install something else on update server?

froger-me commented 5 years ago

Do you happen to have Dummy Plugin and WP Plugin Update Server activated on the same WordPress install? If yes, that would be the issue - the WordPress install cannot be client and server at the same time. If not, please visit Settings > Permalinks on the WordPress install where WP Plugin Update Server is located to flush the URL rewrite rules - it may be the reason why you get a 404 error.

P.S.: to answer your question, you do not need to install anything else besides a fully configured WP Plugin Update Server on one hand, and the plugin to be updated (Dummy Plugin) on the other hand to get the plugin up and running.

atlet commented 5 years ago

Hi @froger-me, the problem where permalinks, I flushed, and now it's working fine. Dummp Plugin is installed on localhost and I'm getting timeout, but if I change sslverify to false, it's working fine.

Tnx for your help!

froger-me commented 5 years ago

@atlet Great! Glad it helped!