Closed calcosta closed 6 years ago
Thank you. The docs have been fixed
I just realized that using the new Plugin Loader via Application.php the shell command does not accept the short syntax any more.
bin/cake asset_compress build
gives an error Exception: Shell class for "AssetCompress" could not be found. in [/cakephp/src/Console/ShellDispatcher.php, line 327]
bin/cake asset_compress.asset_compress build
is still working fine.
This can be fixed if the Plugin is loaded 'the old way' via bootstrap.php in addition to the 'new way' in Application.php. But thats probably not the way to go :)
So maybe it's just fine if you could update the Wiki with the full shell syntax?
@calcosta I'll look into that, as both forms should work at long as you don't have a conflicting shell command somewhere else.
Shouldnt this be either or? With 3.6 now the old way doesnt work anymore (no asset URLs working)
Is this now a requirement to do like this?
What I dont get: Only issue is this plugin, for all others the former bootstrap.php loading still works and is fine. So this seems to create a strange and unexpected unicorn way here.
With 3.6 now the old way doesnt work anymore (no asset URLs working)
Are you saying that the middleware also does not work?
What I dont get: Only issue is this plugin, for all others the former bootstrap.php loading still works and is fine. So this seems to create a strange and unexpected unicorn way here.
I don't fully understand the context of these statements.
Yeah, the apps then break for some reason with the old syntax (bootstrap=>true in bootstrap Plugin::load()). So you must then use the new way as documented here. But only for this plugin. So something is weird.
So you must then use the new way as documented here. But only for this plugin. So something is weird.
The weirdness is that I removed all the files that the old plugin loading used. This problem should be resolved by cakephp/cakephp#12124. After 3.6.5 plugins using only the Plugin classes will work properly when loaded through Plugin::load()
.
I'm not able to reproduce the issue where bin/cake asset_compress build
doesn't work. I tried both with the ShellDispatcher
and CommandRunner
implementations.
This is my /src/Application.php file:
class Application extends BaseApplication
{
/**
* Setup the middleware your application will use.
*
* @param \Cake\Http\MiddlewareQueue $middleware The middleware queue to setup.
* @return \Cake\Http\MiddlewareQueue The updated middleware.
*/
public function middleware($middleware)
{
$middleware
// Catch any exceptions in the lower layers,
// and make an error page/response
->add(new ErrorHandlerMiddleware(Configure::read('Error.exceptionRenderer')))
// Handle plugin/theme assets like CakePHP normally does.
->add(new AssetMiddleware())
// Apply routing
->add(new RoutingMiddleware());
return $middleware;
}
/**
* {@inheritDoc}
*/
public function bootstrap()
{
parent::bootstrap();
// Load Asset Compress Plugin >= 3.4.0
$this->addPlugin('AssetCompress');
}
}
In /config/bootstrap.php I removed Plugin::load('AssetCompress', ['bootstrap' => true]);
And this is what I get when executing bin/cake asset_compress build
:
Exception: Shell class for "AssetCompress" could not be found. in [/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php, line 327]
while bin/cake asset_compress.asset_compress build
works fine.
I'm on Cake 3.6.4.
Ok. The reason you're seeing this error is that your bin/cake.php
needs to be updated. New style plugins require you to use CommandRunner
. You need to replace the contents of bin/cake.php
with this file.
Yep, now it's working again. Thank you very much!
Hi Mark, just want to give the info that the Installation guide in the Readme file/Wiki does not work any more since version 3.4.0.
should be changed to
Using the old method to load the plugin I get an error when requesting assets in debug mode.