Item12392: Add a "preload" plugin handler to the Foswiki plugin API.
Priority: Enhancement
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Engine
Component:
Branches: trunk
Sometimes a decision can be made very early whether to allow a request to proceed or not; for example, on the basis of server resources, or information from the request. At the moment the earliest a decision can be made by a plugin is in the
earlyInitHandler
, which isn't early at al. By the time is is called the Store, the Prefs and the logged-in user are all set up - pointless, if a simple check is going to reject or shortcut the request in some way.
By splitting up some code in the
Plugins.pm
I was able to divide the plugin initialisation process so that plugins can be initiated very very early. This allows the addition of a new handler - I called it
preload
- that can perform this sort of check.
All other functionality is identical, and code performance is not impacted measurably.
I propose to check this in for 1.2.0
See
Development.AddEarlyPluginHandler for feature proposal.
If you want to try it, there's an implementation in the patch file attached.
--
CrawfordCurrie - 13 Feb 2013
Some fixing in
Item12440.
--
MichaelDaum - 18 Mar 2013
Correction to cure test failures
--
CrawfordCurrie - 23 Mar 2013