need a CakePlugin::loadAllExcept() to make life easier #2045

Closed
lh-import opened this Issue Oct 11, 2013 · 7 comments

Projects

None yet

4 participants

Created by kimsia, 13th Feb 2013. (originally Lighthouse ticket #3620):


What I did

I was trying out the Mark Story AssetCompress plugin when I realized that I no longer can use CakePlugin::loadAll();

I needed to load all the Plugins I have one by one and then load AssetCompress AFTER the lines

Configure::write('Dispatcher.filters', array(
'AssetDispatcher',
'CacheDispatcher'
));

CakePlugin::load('AssetCompress', array('bootstrap' => true));

What happened

There was no way for me do a simple
CakePlugin::loadAllExcept("AssetCompress");

What I expected to happen

Hopefully version 3 allows this kind of blacklist calling for CakePlugin::load method

13th Feb 2013, Mark Story said:


Why not just loadAll after the filters are set. Or you can use App::objects() and array_diff to get what you want.

13th Feb 2013, Ceeram said:


or you can use CakePlugin::unload()

13th Feb 2013, kimsia said:


Good ideas! Thank you all. :)

I will use CakePlugin::unload() first instead.

Member

I would prefer an option for loadAll instead of adding a new method to disable the loading of a certain plugin:

CakePlugin::loadAll(array(
    'Blog' => false,
    'ContactManager' => array('bootstrap' => true),
    'WebmasterTools' => array('bootstrap' => true, 'routes' => true),
));

Where Blog will not be loaded.
May be that's more clear:

CakePlugin::loadAll(array(
    'Blog' => 'disabled',
    'ContactManager' => array('bootstrap' => true),
    'WebmasterTools' => array('bootstrap' => true, 'routes' => true),
));

Or use an additional sub array?

CakePlugin::loadAll(array(
    'ContactManager' => array('bootstrap' => true),
    'WebmasterTools' => array('bootstrap' => true, 'routes' => true),
   'disabled'  => array('Blog')
));
Owner

What about just not using loadAll()?

Member
ADmad commented Oct 17, 2013

In reference to the initial post, doing

CakePlugin::loadAll();
CakePlugin::load('AssetCompress', array('bootstrap' => true));

works just fine afaik. So I don't see the need for any changes.

Member
ADmad commented Apr 19, 2014

Closing as the extra method seems unnecessary.

@ADmad ADmad closed this Apr 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment