YahnisElsts / wp-update-server

A custom update API for WordPress plugins and themes. Intended to be used in conjunction with my plugin-update-checker library.
MIT License
824 stars 176 forks source link

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

Open janeks opened 4 years ago

janeks commented 4 years ago

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 commented 4 years ago

Here are some things to try:

janeks commented 3 years ago

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 commented 3 years ago

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);