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

WP Plugin Update Server with Bitbucket #1

Closed digitalbread closed 6 years ago

digitalbread commented 6 years ago

Hello, first thank you for the cool plugin. I'm anxious to get it working. Everything appears to be setup right on the server. My plugin is updating in packages when I retrieve it from remote. But even with the dummy plugin setup and the without license part filled out I get errors.

Could not determine if updates are available for Dummy Plugin. HTTP response code is 404 (expected: 200) puc_unexpected_response_code

I found on localhost (windows running xampp) the dummy-plugin causes white screen of death. if I change $dummy_plugin_updater = new WP_Plugin_Updater( 'https://my-domain.tld', FILE, plugin_dir_path( FILE ) );

$dummy_plugin_updater = new WP_Plugin_Updater( 'https://my-domain.tld', FILE, wp_normalize_path(plugin_dir_path( FILE )) ); it loads but still get the same error.

I think it's checking GITHUB instead of bitbucket but I'm not sure how that works.

I also can't figure out how to troubleshoot. I tried loading the endpoint with https://my-domain.tld/wp-content/plugins/wp-update-server/?update_action=get_metadata&plugin_id=dummy-plugin%2Fdummy-plugin.php according to meta_data url. On localhost it's completely botched on linux it seems right but won't load I get the same error either way

Could not determine if updates are available for Dummy Plugin. HTTP response code is 404 (expected: 200) puc_unexpected_response_code

LOCALHOST https://my-domain.tld/wp-content/plugins/wp-update-server/?update_action=get_metadata&plugin_id=C%3A%5CX%5CAAA_PHPSTORM_PROJECTS%5Cmylocaldev.dev.cc%5Cwp-content%5Cplugins%5Cdummy-plugin%5Cdummy-plugin.php

HOSTING SERVER WITH LINUX https://my-domain.tld/wp-content/plugins/wp-update-server/?update_action=get_metadata&plugin_id=dummy-plugin%2Fdummy-plugin.php

Not sure where to go from here. Thanks for your help. Russ

froger-me commented 6 years ago

Hello @digitalbread ! Thank you for reaching out.

To develop, integrate Plugin Update Checker and WP Update Server libraries, and test the plugin and its dummy plugins, I used a test server (Linux hosting) with a domain name and a subdomain - no work has been done with localhost, so I am not sure of the side effects there.

Note (not sure if that helps, but I thought I'd mention): one cannot use 1 install of Wordpress for both the server and the client - it is necessary to use 2 installs, because once the update process is starting, the client is put under maintenance. The server install of Wordpress acts as a proxy between the remote repository and the clients. Remote Repo > WP server > WP clients.

You are definitely right to point out path strings should be sanitised with wp_normalize_path to ensure portability - I will update the code ASAP.

In the meantime, would it be possible to let me know if the same issue occurs when not using localhost at all?

froger-me commented 6 years ago

Oh, and another thing: the URL to check for plugin updates is the following: https://my-domain.tld/wp-update-server/?update_action=get_metadata&plugin_id=dummy-plugin%2Fdummy-plugin.php It is a direct endpoint, without the wp-content/plugins/ part.

Visiting it should output a json response looking like:

{
    "name": "Dummy Plugin",
    "version": "1.0",
    "homepage": "https:\/\/domain.tld\/",
    "author": "Author Name",
    "author_homepage": "https:\/\/domain2.tld\/",
    "last_updated": "9999-99-99 99:99:99",
    "slug": "dummy-plugin",
    "request_time_elapsed": "0.000"
}
digitalbread commented 6 years ago

Hey @froger-me , thank you for responding. I hope I'm helpful improving this great plugin you've created. I know it's a lot of work.

So, I've setup everything all over again starting from scratch. My setup looks like this: WP Plugin Update Server + Software License Manager hosted in fresh WordPress install on Digital Ocean with Ubuntu 16. I also have the wppus-endpoint-optimizer.php in mu-plugins

(fyi - you have a typo on the Help page concerning the endpoint optimizer - it reads /srv/users/goodeggu/apps/digibreadapps/public/wp-contentmu-plugin/wppus-endpoint-optimiser.php you are missing a forward slash and I believe it should be mu-plugins not mu-plugin).

My dummy-plugin is in bitbucket private repo and I have the settings to use stable-branch. Everything works in WP Plugin Update Server when I update the plugin and request it in General screen.

As for localhost (i'm not installing wppus, I'm only testing dummy-plugin for updating),If this helps, I develop locally on Windows using Serverpress Desktop Server (Free version available - I highly recommend for testing plugin updates on localhost) this will reveal the path issue mentioned before. The endpoint link it tries to create is something like this https://my-domain.tld/wp-update-server/?update_action=get_metadata&plugin_id=C%3A%5CX%5CAAA_PHPSTORM_PROJECTS%5Cmydev.dev.cc%5Cwp-content%5Cplugins%5Cdummy-plugin%5Cdummy-plugin.php So getting plugin updates on localhost from WP Plugin Update Server doesn't work. However using this https://github.com/YahnisElsts/plugin-update-checker does work on localhost

Now since the initial upload of 1.1 I've created an update to 1.2 and pushed it to stable-branch. I went to wppus and retrieved it again under General and it shows 1.2.

I've installed my dummy-plugin v1.1 on a website hosted at MDDHosting (CPANEL on Linux) and when I click Check Updates I get this error: Could not determine if updates are available for Dummy Plugin. Failed to parse update metadata. Try validating your .json file with http://jsonlint.com/ puc-invalid-json When I click on View Details I get this: An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.

Thank you for the clarification on the endpoint but when I go the endpoint https://my-domain.tld/wp-update-server/?update_action=get_metadata&plugin_id=dummy-plugin%2Fdummy-plugin.php it is stripping out the "wp-update-server/" so I get https://my-domain.tld/?update_action=get_metadata&plugin_id=dummy-plugin%2Fdummy-plugin.php and the WordPress standard 404 page. I'm sure this is probably whats causing the issues above. I have only wppus and software license plugins activated. I've tried turning off permalinks and on back on (to post name) but same issue. Theme is only Twenty Seventeen.

I'll email you my actual server address and a link to my v1.1 dummy-plugin.zip so you can see what I'm seeing.

Thanks @froger-me

digitalbread commented 6 years ago

one more thing I found is that if i'm logged in and try to access the endpoint it does not strip the "wp-update-server/" permalink but still get the 404 page, if I'm logged out it strips. If I create a post or page with that permalink "wp-update-server/" it has the same behaviour. I've also tried with the optimization script both in and not it the mu-plugins folder.

After this testing I tried the plugin update from my MDDhosting site and get an new error: Could not determine if updates are available for Dummy Plugin. HTTP response code is 404 (expected: 200) puc_unexpected_response_code

froger-me commented 6 years ago

Let's follow up by email - I'll report here where relevant.

froger-me commented 6 years ago

'wp-plugin-update-server/wp-plugin-update-server.php' should be added to wppus-endpoint-optimizer.php - although help mentions the $wppus_always_active_plugins can be edited to preserve plugins execution during update checks, WPPUS should be included by default:

if ( ! $wppus_always_active_plugins ) {
    $wppus_always_active_plugins = array(
        // Your plugins here to keep active during update checks.
        // 'my-plugin-slug/my-plugin-file.php',
        // 'my-other-plugin-slug/my-other-plugin-file.php',
        'wp-plugin-update-server/wp-plugin-update-server.php'
    );
}

Fixed.

digitalbread commented 6 years ago

You're the man @froger-me it worked from my remote hosting but not localhost. I sent you an email and will open a new issue here. Thanks again for your promptness and great plugin. :+1: