Answer the question
In order to leave comments, you need to log in
[Solved] Kohana 3 code execution on shutdown?
I'm just getting acquainted with the kohana, and therefore I may be asking stupidity.
It is necessary to execute some code at the moment the script ends, i.e. regardless of which controller was executed and whether it was executed at all. In Kohana 2.x, Event::add('system.shutdown', ...) was intended for this purpose, which allowed registering a custom event at the moment the kohana shuts down. In Kohana 3, I did not find anything like this. An attempt to use the standard for php register_shutdown_function failed, because by this time the kohana had time to clean up some of its classes, for example, remove Request:: $initial, etc. But they are needed for functionality.
The question is, is there a standard way for Kohana 3.x to execute its code after processing an arbitrary controller and before the kohana itself exits?
upd:Thank you all, in the end I decided to stop at redefining controller-> after.
Answer the question
In order to leave comments, you need to log in
Easy way: create a file application/kohana.php, in it:
class Kohana extends Kohana_Core{
public static function shutdown_handler(){
// тут делаете что хотите
return parent::shutdown_handler();
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question