fuel / core

Fuel PHP Framework - The core of the Fuel v1 framework
http://fuelphp.com
813 stars 345 forks source link

Reversed routing to non-active modules #224

Closed jschreuder closed 11 years ago

jschreuder commented 13 years ago

Currently Module routes are only loaded for active modules, shouldn't we have these routes available for all loaded modules? Including those loaded through Fuel::add_module()? Not for normal routing of course, but to support reversed routing for them.

Also, I don't think there are currently any docs on this and as I've never used it I'm not really the person to write those.

Here's the forum issue where this became a point: http://www.fuelphp.com/forums/topics/view/2409

dhrrgn commented 13 years ago

Still thinking of a way to handle this...not entirely sure yet.

nerdsrescueme commented 13 years ago

Would it make sense to keep some sort of framework level module cache? Perhaps you could glob the modules directory and make a hash of it... then based on that hash create a cached routes file to be looked up for non-active module requests? Seems like an ugly work-around... but it's better than always loading each routes file on every request. That's assuming you want to route to modules that haven't even been added on "this" request...

WanWizard commented 13 years ago

That had been removed in the past, and for a reason. Have you properly tested this?

It might also conflict now with the way module routes are loaded in the request itself, that contains additional logic. I suspect that no longer works because the module routes will already be present?

dhrrgn commented 13 years ago

What was the reason for the removal? I will take another look this afternoon. As it is I think you may be right, it is probably adding double routes now when routing to a module. However, this doesn't "break" it right now...just an issue that needs fixed.

I am reopening the issue until this is resolved.

WanWizard commented 13 years ago

Good question, it's been a long time ago (commit history stops when you created submodules, and it was before that)

dhrrgn commented 13 years ago

I have rolled back this commit and moved to the v1.1-dev milestone while we figure out what implications this has on the system as a whole.

Ref https://github.com/fuel/core/commit/8f693945a0d64b9beac4a00c792f77428f6bee0d