radishconcepts / WordPress-GitHub-Plugin-Updater

This class is meant to be used with your Github hosted WordPress plugins. The purpose of the class is to allow your WordPress plugin to be updated whenever you push out a new version of your plugin; similarly to the experience users know and love with the WordPress.org plugin repository.
https://github.com/jkudish/WordPress-GitHub-Plugin-Updater
822 stars 195 forks source link

Slugs/proper folder name confusion #68

Open stevelock opened 9 years ago

stevelock commented 9 years ago

Hi there,

I think there's some confusing mixup when comparing the plugin slug with the reponse slug in /updater.php:394.

$response->slug is actually just the folder name of the plugin (i.e.: github-updater), but $this->config['slug'] is the pugin's basename (folder name + plugin name, i.e.: github-updater/plugin.php). This leads to a false negative, returning on line 395 and causing wp-admin/update-core.php to show an empty list, when instead there should be a new update visible. I tried it with your example in plugin.php as well; and this also causes the same problem.

As far as I can tell, the issue is simply solved by changing if ( !isset( $response->slug ) || $response->slug != $this->config['slug'] ) into if ( !isset( $response->slug ) || $response->slug != $this->config['proper_folder_name'] )