context.php: add PDO and database to context

This commit is contained in:
Zankaria 2024-11-26 00:34:03 +01:00
parent 72e2d02cca
commit 8d8957cfeb

View file

@ -2,6 +2,7 @@
namespace Vichan;
use Vichan\Data\Driver\CacheDriver;
use Vichan\Data\ReportQueries;
defined('TINYBOARD') or exit;
@ -33,6 +34,12 @@ function build_context(array $config): Context {
CacheDriver::class => function($c) {
// Use the global for backwards compatibility.
return \cache::getCache();
},
\PDO::class => function($c) {
global $pdo;
// Ensure the PDO is initialized.
sql_open();
return $pdo;
}
]);
}