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

Error when try viewing plugin version details #344

Closed
Phreshhh opened this issue Feb 12, 2020 · 11 comments
Closed

Error when try viewing plugin version details #344

Phreshhh opened this issue Feb 12, 2020 · 11 comments

Comments

@Phreshhh
Copy link

Hi!

Thanks for the lib, its a great work and very useful for many dev.

I have a bit problem, with the details part.

I am developing my own plugin and now built in your lib.
If i click on plugin version details link, then it gives me error: Plugin not found.

Query Monitor:

The message above was triggered by Core.

Call stack:

wp_die()
    wp-admin/includes/plugin-install.php:513
    install_plugin_information()
    wp-includes/class-wp-hook.php:286
    do_action('install_plugins_pre_plugin-information')
    wp-admin/plugin-install.php:70

I try some other slug to check it whats wrong but, i didn't.

$myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
	'http://example.com/path/to/details.json',
	__FILE__, //Full path to the main plugin file or functions.php.
	'unique-plugin-or-theme-slug'
);

If i change the slug to a plugin what is installed from wp repo, then works the info popup, but all other not.

I think, the problem is the new WordPress restricted download updates form unknown hosts.
I find a possible solution for the problem in another repo pull request.
Needs the Plugin name also..

Please check and try to reconstruct the problem, and if this plugin name extend not solve the problem, i try to help find the solution.

Thanks

@YahnisElsts
Copy link
Owner

Is the code that calls buildUpdateChecker in the main plugin file (that is, the one that contains the plugin header), or a different file? If it's in a different file, that can cause problems with viewing and installing updates, so you'll need to replace __FILE__ with the full path to the main file.

@Phreshhh
Copy link
Author

Phreshhh commented Feb 12, 2020

Is the code that calls buildUpdateChecker in the main plugin file (that is, the one that contains the plugin header), or a different file?

Is in the main file (just the plugin-update-checker folder moved to an "inc" folder).

Plugin header (replaced to dummy text, but the text format is stilled):

/*
 *	Plugin Name: PluginName
 *	Plugin URI: https://mydomain.hu/pluginname/
 *	Description: Hungarian utf8 text.
 *	Version: 1.0.0
 *	Author: Phresh
 *	Author URI: https://mydomain.hu/
 *	License: GPL
 *
*/

The checker's code at bottom of the plugin main file:

require 'inc/plugin-update-checker/plugin-update-checker.php';
$myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
	'https://mydomain.hu/wp-plugins/pluginname/pluginname-update-info.json',
	__FILE__, //Full path to the main plugin file or functions.php.
	'pluginname'
);

The info.json path is ok, cuz' the update works, just the info popup not.

@YahnisElsts
Copy link
Owner

All right, that's good. Here's another idea: try opening the "view details" link in a new tab. Check the link URL: does the slug shown in the URL match the slug in your code? Try replacing the slug with the name of the plugin's directory (for example, if the main file is example-plugin/plugin.php then the directory is example-plugin). Does that produce a different result?

I think, the problem is the new WordPress restricted download updates form unknown hosts.

I think WordPress has something like that, yes, but PUC is supposed to already handle that.

@Phreshhh
Copy link
Author

Yes, all matching.
Plugin name: PhreshService
Directory and main file: wp-content/plugins/phreshservice/phreshservice.php
Information popup url: wp-admin/plugin-install.php?tab=plugin-information&plugin=phreshservice&section=changelog&TB_iframe=true&width=600&height=800

Error msg is written the first comment.

I dont know whats wrong..

@YahnisElsts
Copy link
Owner

Could it be a capitalization issue? You mentioned that the plugin name is "PhreshService". Is the plugin directory name phreshservice (all lowercase) or is it PhreshService (mixed case)? How about the plugin file name - is that all lowercase? There are (rare) situations where that matters. For best cross-platform compatibility, I would recommend using only lowercase characters in the plugin directory name and the plugin file name.

@Phreshhh
Copy link
Author

Nope.. :(

The plugin name is capitalized only in the header information:

/*
 *	Plugin Name: PluginName
...

the directory, and the file name of course full lowercase.

I change to lowercase for a test the plugin name in the header info and the "name" in the info.json on the server file also, but nothing (so all lowercase on all place, not works too). The problem is still there.

So i wrote back in the header and the .json.

@YahnisElsts
Copy link
Owner

Unfortunately, I don't have any more ideas at the moment.

Is there a chance you could create a minimal plugin that reproduces the issue? That is, make a plugin that just initialises the update checker in the same way as your real plugin and doesn't do anything else (give it a different name and slug). See if it also has the same problem when you click the "view details" link. If it does, post the plugin code here. I'll install it on a test site and see if I can figure out what's causing the problem.

@Phreshhh
Copy link
Author

Yeah, i test with a purged version for a while, so i send to you a copy.
plugin.zip

Thank you very much for your help and time.

@YahnisElsts
Copy link
Owner

Thank you for the example plugin. It seems to work fine on my site (WP 5.4-alpha). Here's what I see when I click the "View version 1.1.1 details" link:

phresh-test

This suggests that the problem is not with the update checker or your plugin, but with something else that's happening on your site or server. It could be a compatibility issue or a plugin/theme conflict. Please try temporarily deactivating all other plugins and switching to the default theme. Does that fix the problem? Also, what WordPress version are you using?

@Phreshhh
Copy link
Author

Holy sh|t... I dont belive..

Yeah, U R right.
In a public server works fine.
The problem is my pc localhost server and/or 5.6 low php version. Thanks and sorry for waste your time.

At least, once a time maybe this thread is help someone else too, who like develop on localhost... :D

@YahnisElsts
Copy link
Owner

All right, no worries. I'll close this now.

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

No branches or pull requests

2 participants