Closed zomars closed 6 years ago
Have you updated to the latest? Should be fixed by #12
And I just realized I still have the old version compare in the route checker too... Are you on 3.3 or 3.2?
I'm on 3.2.11 and I'm afraid I can't do composer update
ATM. I'm afraid it will break because of local extensions.
Ok what version of the extension are you on? If you can't update can apply the changes manually? If so I'll paste right here what you'll need to change
Who woulda thought bolt changing the backed extension mount point would cause so much havoc haha
I'm on 1.1.1 :)
Ok if you can go to this line https://github.com/cdowdy/bolt-tinypng/blob/4013b712bc42ad7660870ecece5ada0fdbdb1fd3/src/TinyPNGExtension.php#L72 and reverse them. That is
if ( Version::compare('3.3.0', '>=')) {
return [
'/extend/tinypng' => new TinyPNGBackendController($config),
];
} else {
return [
'/extensions/tinypng' => new TinyPNGBackendController($config),
];
}
For some reason the logic is reversed and I'll get an actual update for the extension tomorrow to fix it properly!
second thought I decided to fire up my laptop and the version compare for bolt is still really wonky.
For your use case on bolt 3.2.x you can use this for a quick fix:
in this method: https://github.com/cdowdy/bolt-tinypng/blob/4013b712bc42ad7660870ecece5ada0fdbdb1fd3/src/TinyPNGExtension.php#L67-L79
protected function registerBackendControllers() {
$config = $this->getConfig();
return [
'/extend/tinypng' => new TinyPNGBackendController($config),
];
}
I'm putting the below here so I can think it out haha....
when getting the file path for both bolt 3.2.x and 3.3.x we need to do a version compare and reverse the logic.
That means instead of thinking the below code says "my current bolt version is greater than or equal too 3.3.0" with a bolt install of 3.3.0
if (Version::compare( '3.3.0', '>=')) {
// the new filepath for bolt 3.3 +
return $this->app['path_resolver']->resolve('files');
} else {
// the old resources for bolt less than 3.3 so anyting 3.2 or "older"
return $this->app['resources']->getPath( 'filespath' );
}
we need to flip it:
if (Version::compare( '3.3.0', '>=')) {
return $this->app['resources']->getPath( 'filespath' );
} else {
return $this->app['path_resolver']->resolve('files');
}
For some reason the same 'reversed' logic isn't working to register a backend controllers route
hey @zomars I think I knocked this one out ... I'll put a release out here in a bit if you could try it out and let me know that'd be great! Thanks!
I get my site's 404 when trying to open the extension route:
/bolt/extend/tinypng/files