aboutsummaryrefslogtreecommitdiff
path: root/lib/bootstrap-definitions.php
diff options
context:
space:
mode:
authorPhilipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de>2024-09-24 10:53:31 +0200
committerPhilipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de>2024-09-24 10:53:31 +0200
commit4459dd7917f4d1c34f40bb68f0e991e9c3d53e4c (patch)
tree5c07151ae61276d334e88f6309c30d439a85c12e /lib/bootstrap-definitions.php
parentda0022e5c1abbf9825ae76debaabdff7e8623bb4 (diff)
parent97a188592c679890a25c37ab78463add76a52ff7 (diff)
Merge branch 'main' into issue-3911issue-3911
Diffstat (limited to 'lib/bootstrap-definitions.php')
-rw-r--r--lib/bootstrap-definitions.php53
1 files changed, 49 insertions, 4 deletions
diff --git a/lib/bootstrap-definitions.php b/lib/bootstrap-definitions.php
index 17f35d1..e3bf88a 100644
--- a/lib/bootstrap-definitions.php
+++ b/lib/bootstrap-definitions.php
@@ -1,10 +1,18 @@
<?php
+use DebugBar\DataCollector\ExceptionsCollector;
+use DebugBar\DataCollector\MemoryCollector;
+use DebugBar\DataCollector\MessagesCollector;
+use DebugBar\DataCollector\PhpInfoCollector;
+use DebugBar\DataCollector\RequestDataCollector;
+use DebugBar\DataCollector\TimeDataCollector;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
+use function DI\create;
+
return [
LoggerInterface::class => DI\factory(function () {
return new Logger('studip', [
@@ -14,13 +22,50 @@ return [
),
]);
}),
- StudipCache::class => DI\factory(function () {
- return StudipCacheFactory::getCache();
+ \Studip\Cache\Cache::class => DI\factory(function () {
+ return \Studip\Cache\Factory::getCache();
}),
- StudipPDO::class => DI\factory(function () {
+ PDO::class => DI\factory(function () {
return DBManager::get();
}),
- Trails_Dispatcher::class => DI\factory(function (ContainerInterface $container) {
+ Trails\Dispatcher::class => DI\factory(function (ContainerInterface $container) {
return new \StudipDispatcher($container);
}),
+ DebugBar\DebugBar::class => DI\factory(function (ContainerInterface $container) {
+ $debugBar = new DebugBar\DebugBar();
+ $debugBar->addCollector(new PhpInfoCollector());
+ $debugBar->addCollector(new RequestDataCollector());
+ $debugBar->addCollector(new MemoryCollector());
+ $debugBar->addCollector(new ExceptionsCollector());
+
+ // Future Improvements, not used/activated right now
+ # $debugBar->addCollector(new MessagesCollector());
+ $debugBar->addCollector(new TimeDataCollector());
+
+ $config = iterator_to_array(Config::getInstance()->getIterator());
+ ksort($config);
+ $debugBar->addCollector(new DebugBar\DataCollector\ConfigCollector($config));
+
+ $pdo = $container->get(PDO::class);
+ if ($pdo instanceof Studip\Debug\TraceableStudipPDO) {
+ $collector = new DebugBar\DataCollector\PDO\PDOCollector($pdo);
+ $debugBar->addCollector($collector);
+ }
+
+ return $debugBar;
+ }),
+ StudipPDO::class => DI\factory(function () {
+ $pdo = new StudipPDO(
+ "mysql:host={$GLOBALS['DB_STUDIP_HOST']};dbname={$GLOBALS['DB_STUDIP_DATABASE']};charset=utf8mb4",
+ $GLOBALS['DB_STUDIP_USER'],
+ $GLOBALS['DB_STUDIP_PASSWORD']
+ );
+
+ if (Studip\Debug\DebugBar::isActivated()) {
+ $pdo = new Studip\Debug\TraceableStudipPDO($pdo);
+ }
+
+ return $pdo;
+ }),
+ PluginManager::class => DI\factory([PluginManager::class, 'getInstance']),
];