get('CMS_DSN'); if (!str_starts_with($dsn, 'mysql:') && !str_starts_with($dsn, 'sqlite:')) { throw new \RuntimeException('Dedicated CMS DSN required'); } $options = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_TIMEOUT => 5]; if (str_starts_with($dsn, 'mysql:') && $config->get('CMS_DB_SSL_CA') !== '') { $options[PDO::MYSQL_ATTR_SSL_CA] = $config->get('CMS_DB_SSL_CA'); $options[PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = true; } return new PDO($dsn, $config->get('CMS_DB_USER'), $config->get('CMS_DB_PASSWORD'), $options); } }