![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-analytics/ReportXml/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Analytics\ReportXml; use Magento\Framework\App\DeploymentConfig; use Magento\Framework\App\ResourceConnection\ConfigInterface as ResourceConfigInterface; use Magento\Framework\Config\ConfigOptionsListConstants; use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Framework\Model\ResourceModel\Type\Db\ConnectionFactoryInterface; /** * Creates connection instance for export according to existing one * * This connection does not use buffered statement, also this connection is not persistent */ class ConnectionFactory { /** * @var ResourceConfigInterface */ private $resourceConfig; /** * @var DeploymentConfig */ private $deploymentConfig; /** * @var ConnectionFactoryInterface */ private $connectionFactory; /** * @param ResourceConfigInterface $resourceConfig * @param DeploymentConfig $deploymentConfig * @param ConnectionFactoryInterface $connectionFactory */ public function __construct( ResourceConfigInterface $resourceConfig, DeploymentConfig $deploymentConfig, ConnectionFactoryInterface $connectionFactory ) { $this->resourceConfig = $resourceConfig; $this->deploymentConfig = $deploymentConfig; $this->connectionFactory = $connectionFactory; } /** * Creates one-time connection for export * * @param string $resourceName * @return AdapterInterface */ public function getConnection($resourceName) { $connectionName = $this->resourceConfig->getConnectionName($resourceName); $configData = $this->deploymentConfig->get( ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTIONS . '/' . $connectionName ); $configData['use_buffered_query'] = false; unset($configData['persistent']); $connection = $this->connectionFactory->create($configData); return $connection; } }