Build modified streamline images

The official image from streamline does not currently work for the arm64
platform. As a temporary measure, the source code and docker build scripts
have been lifted from the official images and are used to build locally.

Some additional modifications are made to reduce overall image size, these
are documented in docker/README.md
This commit is contained in:
2024-03-10 16:17:50 -07:00
parent 2ffc3c408a
commit a424394109
13506 changed files with 1860172 additions and 6 deletions
@@ -0,0 +1,82 @@
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Logging;
use Doctrine\DBAL\Driver\Connection as ConnectionInterface;
use Doctrine\DBAL\Driver\Middleware\AbstractConnectionMiddleware;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\Driver\Statement as DriverStatement;
use Psr\Log\LoggerInterface;
final class Connection extends AbstractConnectionMiddleware
{
private LoggerInterface $logger;
/** @internal This connection can be only instantiated by its driver. */
public function __construct(ConnectionInterface $connection, LoggerInterface $logger)
{
parent::__construct($connection);
$this->logger = $logger;
}
public function __destruct()
{
$this->logger->info('Disconnecting');
}
public function prepare(string $sql): DriverStatement
{
return new Statement(
parent::prepare($sql),
$this->logger,
$sql,
);
}
public function query(string $sql): Result
{
$this->logger->debug('Executing query: {sql}', ['sql' => $sql]);
return parent::query($sql);
}
public function exec(string $sql): int
{
$this->logger->debug('Executing statement: {sql}', ['sql' => $sql]);
return parent::exec($sql);
}
/**
* {@inheritDoc}
*/
public function beginTransaction()
{
$this->logger->debug('Beginning transaction');
return parent::beginTransaction();
}
/**
* {@inheritDoc}
*/
public function commit()
{
$this->logger->debug('Committing transaction');
return parent::commit();
}
/**
* {@inheritDoc}
*/
public function rollBack()
{
$this->logger->debug('Rolling back transaction');
return parent::rollBack();
}
}
@@ -0,0 +1,75 @@
<?php
namespace Doctrine\DBAL\Logging;
use Doctrine\Deprecations\Deprecation;
use function microtime;
/**
* Includes executed SQLs in a Debug Stack.
*
* @deprecated
*/
class DebugStack implements SQLLogger
{
/**
* Executed SQL queries.
*
* @var array<int, array<string, mixed>>
*/
public $queries = [];
/**
* If Debug Stack is enabled (log queries) or not.
*
* @var bool
*/
public $enabled = true;
/** @var float|null */
public $start = null;
/** @var int */
public $currentQuery = 0;
public function __construct()
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/4967',
'DebugStack is deprecated.',
);
}
/**
* {@inheritDoc}
*/
public function startQuery($sql, ?array $params = null, ?array $types = null)
{
if (! $this->enabled) {
return;
}
$this->start = microtime(true);
$this->queries[++$this->currentQuery] = [
'sql' => $sql,
'params' => $params,
'types' => $types,
'executionMS' => 0,
];
}
/**
* {@inheritDoc}
*/
public function stopQuery()
{
if (! $this->enabled) {
return;
}
$this->queries[$this->currentQuery]['executionMS'] = microtime(true) - $this->start;
}
}
@@ -0,0 +1,58 @@
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Logging;
use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware;
use Psr\Log\LoggerInterface;
use SensitiveParameter;
final class Driver extends AbstractDriverMiddleware
{
private LoggerInterface $logger;
/** @internal This driver can be only instantiated by its middleware. */
public function __construct(DriverInterface $driver, LoggerInterface $logger)
{
parent::__construct($driver);
$this->logger = $logger;
}
/**
* {@inheritDoc}
*/
public function connect(
#[SensitiveParameter]
array $params
) {
$this->logger->info('Connecting with parameters {params}', ['params' => $this->maskPassword($params)]);
return new Connection(
parent::connect($params),
$this->logger,
);
}
/**
* @param array<string,mixed> $params Connection parameters
*
* @return array<string,mixed>
*/
private function maskPassword(
#[SensitiveParameter]
array $params
): array {
if (isset($params['password'])) {
$params['password'] = '<redacted>';
}
if (isset($params['url'])) {
$params['url'] = '<redacted>';
}
return $params;
}
}
@@ -0,0 +1,48 @@
<?php
namespace Doctrine\DBAL\Logging;
use Doctrine\Deprecations\Deprecation;
/**
* Chains multiple SQLLogger.
*
* @deprecated
*/
class LoggerChain implements SQLLogger
{
/** @var iterable<SQLLogger> */
private iterable $loggers;
/** @param iterable<SQLLogger> $loggers */
public function __construct(iterable $loggers = [])
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/4967',
'LoggerChain is deprecated',
);
$this->loggers = $loggers;
}
/**
* {@inheritDoc}
*/
public function startQuery($sql, ?array $params = null, ?array $types = null)
{
foreach ($this->loggers as $logger) {
$logger->startQuery($sql, $params, $types);
}
}
/**
* {@inheritDoc}
*/
public function stopQuery()
{
foreach ($this->loggers as $logger) {
$logger->stopQuery();
}
}
}
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Logging;
use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\Middleware as MiddlewareInterface;
use Psr\Log\LoggerInterface;
final class Middleware implements MiddlewareInterface
{
private LoggerInterface $logger;
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
}
public function wrap(DriverInterface $driver): DriverInterface
{
return new Driver($driver, $this->logger);
}
}
@@ -0,0 +1,32 @@
<?php
namespace Doctrine\DBAL\Logging;
use Doctrine\DBAL\Types\Type;
/**
* Interface for SQL loggers.
*
* @deprecated Use {@see \Doctrine\DBAL\Logging\Middleware} or implement
* {@see \Doctrine\DBAL\Driver\Middleware} instead.
*/
interface SQLLogger
{
/**
* Logs a SQL statement somewhere.
*
* @param string $sql SQL statement
* @param list<mixed>|array<string, mixed>|null $params Statement parameters
* @param array<int, Type|int|string|null>|array<string, Type|int|string|null>|null $types Parameter types
*
* @return void
*/
public function startQuery($sql, ?array $params = null, ?array $types = null);
/**
* Marks the last started query as stopped. This can be used for timing of queries.
*
* @return void
*/
public function stopQuery();
}
@@ -0,0 +1,100 @@
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Logging;
use Doctrine\DBAL\Driver\Middleware\AbstractStatementMiddleware;
use Doctrine\DBAL\Driver\Result as ResultInterface;
use Doctrine\DBAL\Driver\Statement as StatementInterface;
use Doctrine\DBAL\ParameterType;
use Doctrine\Deprecations\Deprecation;
use Psr\Log\LoggerInterface;
use function array_slice;
use function func_get_args;
use function func_num_args;
final class Statement extends AbstractStatementMiddleware
{
private LoggerInterface $logger;
private string $sql;
/** @var array<int,mixed>|array<string,mixed> */
private array $params = [];
/** @var array<int,int>|array<string,int> */
private array $types = [];
/** @internal This statement can be only instantiated by its connection. */
public function __construct(StatementInterface $statement, LoggerInterface $logger, string $sql)
{
parent::__construct($statement);
$this->logger = $logger;
$this->sql = $sql;
}
/**
* {@inheritDoc}
*
* @deprecated Use {@see bindValue()} instead.
*/
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null)
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5563',
'%s is deprecated. Use bindValue() instead.',
__METHOD__,
);
if (func_num_args() < 3) {
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5558',
'Not passing $type to Statement::bindParam() is deprecated.'
. ' Pass the type corresponding to the parameter being bound.',
);
}
$this->params[$param] = &$variable;
$this->types[$param] = $type;
return parent::bindParam($param, $variable, $type, ...array_slice(func_get_args(), 3));
}
/**
* {@inheritDoc}
*/
public function bindValue($param, $value, $type = ParameterType::STRING)
{
if (func_num_args() < 3) {
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5558',
'Not passing $type to Statement::bindValue() is deprecated.'
. ' Pass the type corresponding to the parameter being bound.',
);
}
$this->params[$param] = $value;
$this->types[$param] = $type;
return parent::bindValue($param, $value, $type);
}
/**
* {@inheritDoc}
*/
public function execute($params = null): ResultInterface
{
$this->logger->debug('Executing statement: {sql} (parameters: {params}, types: {types})', [
'sql' => $this->sql,
'params' => $params ?? $this->params,
'types' => $this->types,
]);
return parent::execute($params);
}
}