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

WP is looking for plugin icon in the old locattion. #78

Open
janeks opened this issue Jun 30, 2020 · 3 comments
Open

WP is looking for plugin icon in the old locattion. #78

janeks opened this issue Jun 30, 2020 · 3 comments

Comments

@janeks
Copy link

janeks commented Jun 30, 2020

WordPress Updates plugin icon URL points to
.../update-server/icons/plugin-slug-256x256.png
instead of
.../update-server/package-assests/icons/plugin-slug-256x256.png

I have the latest version of both update server and plugin updater. There is a class that extends Wpup_UpdateServer. It's used for license validation. There seems to be nothing related to icons location. Otherwise everything works just fine.

Must be doing something wrong but I don't know what.

@YahnisElsts
Copy link
Owner

Here are some things to try:

  • Try the master branch. The release version is out of date and only the master has the latest features and fixes.
  • Open the metadata URL in the browser and verify that the JSON response shows the correct URLs.
    • If it does, go to the "Plugins" page and click the "Check for updates" link under the plugin description to refresh update information.
    • If it doesn't, check if the class that extends the server happens to override generateAssetUrl(), findFirstAsset(), or $this->assetDirectories. All of those could affect the icon URLs.

@janeks
Copy link
Author

janeks commented Jan 10, 2021

Still no luck.

--- Debug output. Request Info button. -------------------------

[banners] => stdClass Object
(
[low] => https://domain-name.net/wp-update-server/banners/plugin-slug-772x250.png
)
[icons] => Array
(
[1x] => https://domain-name.net/wp-update-server/icons/plugin-slug-128x128.png
[2x] => https://domain-name.net/wp-update-server/icons/plugin-slug-256x256.png
)

--- my custom class -----------------------

class myClass extends Wpup_UpdateServer {
protected $serverDirectory;
public function __construct( $serverUrl = null, $serverDirectory = null ) {
parent::__construct( $serverUrl );
$this->serverDirectory = $serverDirectory;
}

--- UpdateServer.php -----------------------

protected function generateBannerUrl($relativeFileName) {
	return $this->generateAssetUrl('banners', $relativeFileName);
}

@YahnisElsts
Copy link
Owner

I've looked at the relevant code once more, and I noticed a bug: when $serverDirectory uses backslashes as directory separators - which is the default on Windows - the update server may generate incorrect URLs for banner and icons exactly like you've shown above. I just committed a patch that should fix this bug - please give it a try.

Note that if you custom class changes $this->serverDirectory to a non-null value, make sure to pass it through the new $this->normalizeFilePath() method. For example:

$this->serverDirectory = $this->normalizeFilePath($somePath);

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