diff --git a/application/Config/App.php b/application/Config/App.php
index ef0ebee97507..15b20003c850 100644
--- a/application/Config/App.php
+++ b/application/Config/App.php
@@ -264,30 +264,6 @@ class App extends BaseConfig
*/
public $CSPEnabled = false;
- /*
- |--------------------------------------------------------------------------
- | Debug Toolbar
- |--------------------------------------------------------------------------
- | The Debug Toolbar provides a way to see information about the performance
- | and state of your application during that page display. By default it will
- | NOT be displayed under production environments, and will only display if
- | CI_DEBUG is true, since if it's not, there's not much to display anyway.
- |
- | toolbarMaxHistory = Number of history files, 0 for none or -1 for unlimited
- |
- */
- public $toolbarCollectors = [
- 'CodeIgniter\Debug\Toolbar\Collectors\Timers',
- 'CodeIgniter\Debug\Toolbar\Collectors\Database',
- 'CodeIgniter\Debug\Toolbar\Collectors\Logs',
- 'CodeIgniter\Debug\Toolbar\Collectors\Views',
- // 'CodeIgniter\Debug\Toolbar\Collectors\Cache',
- 'CodeIgniter\Debug\Toolbar\Collectors\Files',
- 'CodeIgniter\Debug\Toolbar\Collectors\Routes',
- 'CodeIgniter\Debug\Toolbar\Collectors\Events',
- ];
- public $toolbarMaxHistory = 20;
-
/*
|--------------------------------------------------------------------------
| Application Salt
diff --git a/application/Config/Events.php b/application/Config/Events.php
index 7ea37d329934..8b2fcd4a4e89 100644
--- a/application/Config/Events.php
+++ b/application/Config/Events.php
@@ -29,6 +29,7 @@
{
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
- // Handles the display of the toolbar itself. MUST remain here for toolbar to be displayed.
- Events::on('pre_system', 'CodeIgniter\Debug\Toolbar::eventHandler');
+ Events::on('pre_system', function () {
+ Services::toolbar()->respond();
+ });
}
diff --git a/application/Config/Toolbar.php b/application/Config/Toolbar.php
new file mode 100644
index 000000000000..7b59691527c1
--- /dev/null
+++ b/application/Config/Toolbar.php
@@ -0,0 +1,31 @@
+getPerformanceStats();
- $data = $toolbar->run(
- $stats['startTime'],
- $stats['totalTime'],
- $request,
- $response
- );
-
- helper('filesystem');
-
- // Updated to time() so we can get history
- $time = time();
-
- if (! is_dir(WRITEPATH . 'debugbar'))
- {
- mkdir(WRITEPATH . 'debugbar', 0777);
- }
-
- write_file(WRITEPATH . 'debugbar/' . 'debugbar_' . $time, $data, 'w+');
-
- $format = $response->getHeaderLine('content-type');
-
- // Non-HTML formats should not include the debugbar
- // then we send headers saying where to find the debug data
- // for this response
- if ($request->isAJAX() || strpos($format, 'html') === false)
- {
- return $response->setHeader('Debugbar-Time', (string)$time)
- ->setHeader('Debugbar-Link', site_url("?debugbar_time={$time}"))
- ->getBody();
- }
-
- $script = PHP_EOL
- . ''
- . ''
- . ''
- . PHP_EOL;
-
- if (strpos($response->getBody(), '