2020-08-04 11:25:22 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Config;
|
2020-05-27 18:46:16 +02:00
|
|
|
|
|
|
|
use CodeIgniter\Events\Events;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* --------------------------------------------------------------------
|
|
|
|
* Application Events
|
|
|
|
* --------------------------------------------------------------------
|
|
|
|
* Events allow you to tap into the execution of the program without
|
|
|
|
* modifying or extending core files. This file provides a central
|
|
|
|
* location to define your events, though they can always be added
|
|
|
|
* at run-time, also, if needed.
|
|
|
|
*
|
|
|
|
* You create code that can execute by subscribing to events with
|
|
|
|
* the 'on()' method. This accepts any form of callable, including
|
|
|
|
* Closures, that will be executed when the event is triggered.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* Events::on('create', [$myInstance, 'myMethod']);
|
|
|
|
*/
|
|
|
|
|
|
|
|
Events::on('pre_system', function () {
|
2020-06-10 15:00:12 +00:00
|
|
|
if (ENVIRONMENT !== 'testing') {
|
|
|
|
while (\ob_get_level() > 0) {
|
|
|
|
\ob_end_flush();
|
|
|
|
}
|
2020-05-27 18:46:16 +02:00
|
|
|
|
2020-06-10 15:00:12 +00:00
|
|
|
\ob_start(function ($buffer) {
|
|
|
|
return $buffer;
|
|
|
|
});
|
|
|
|
}
|
2020-05-27 18:46:16 +02:00
|
|
|
|
2020-06-10 15:00:12 +00:00
|
|
|
/*
|
|
|
|
* --------------------------------------------------------------------
|
|
|
|
* Debug Toolbar Listeners.
|
|
|
|
* --------------------------------------------------------------------
|
|
|
|
* If you delete, they will no longer be collected.
|
|
|
|
*/
|
|
|
|
if (ENVIRONMENT !== 'production') {
|
|
|
|
Events::on(
|
|
|
|
'DBQuery',
|
|
|
|
'CodeIgniter\Debug\Toolbar\Collectors\Database::collect'
|
|
|
|
);
|
|
|
|
Services::toolbar()->respond();
|
|
|
|
}
|
2020-05-27 18:46:16 +02:00
|
|
|
});
|