Skip to content

Commit 50c16e0

Browse files
author
Mohammad HAJ SALEM
committed
🔀 merge upstream/2.3-develop
2 parents 73482be + 33b92f6 commit 50c16e0

File tree

1,437 files changed

+51872
-3206
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,437 files changed

+51872
-3206
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ addons:
1111
firefox: "46.0"
1212
hosts:
1313
- magento2.travis
14+
services:
15+
- rabbitmq
1416
language: php
1517
php:
1618
- 7.0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=develop)](https://travis-ci.org/magento/magento2)
1+
[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=2.3-develop)](https://travis-ci.org/magento/magento2)
22
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
33
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/magento-2/localized.png)](https://crowdin.com/project/magento-2)
44
<h2>Welcome</h2>

app/code/Magento/AdminNotification/etc/db_schema.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9-
xsi:noNamespaceSchemaLocation="urn:magento:setup:Model/Declaration/Schema/etc/schema.xsd">
9+
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
1010
<table name="adminnotification_inbox" resource="default" engine="innodb" comment="Adminnotification Inbox">
1111
<column xsi:type="int" name="notification_id" padding="10" unsigned="true" nullable="false" identity="true"
1212
comment="Notification id"/>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Amqp\Model;
7+
8+
/**
9+
* {@inheritdoc}
10+
*
11+
* @deprecated 100.2.0
12+
*/
13+
class Config extends \Magento\Framework\Amqp\Config
14+
{
15+
16+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Amqp\Model;
7+
8+
use Magento\Framework\MessageQueue\ConfigInterface as QueueConfig;
9+
use Magento\Framework\Communication\ConfigInterface as CommunicationConfigInterface;
10+
use Magento\Framework\MessageQueue\Publisher\ConfigInterface as PublisherConfig;
11+
use Magento\Framework\MessageQueue\Rpc\ResponseQueueNameBuilder;
12+
13+
/**
14+
* {@inheritdoc}
15+
*
16+
* @deprecated 100.2.0
17+
*/
18+
class Exchange extends \Magento\Framework\Amqp\Exchange
19+
{
20+
/**
21+
* Initialize dependencies.
22+
*
23+
* @param Config $amqpConfig
24+
* @param QueueConfig $queueConfig
25+
* @param CommunicationConfigInterface $communicationConfig
26+
* @param int $rpcConnectionTimeout
27+
*
28+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
29+
*/
30+
public function __construct(
31+
Config $amqpConfig,
32+
QueueConfig $queueConfig,
33+
CommunicationConfigInterface $communicationConfig,
34+
$rpcConnectionTimeout = self::RPC_CONNECTION_TIMEOUT
35+
) {
36+
parent::__construct(
37+
$amqpConfig,
38+
$this->getPublisherConfig(),
39+
$this->getResponseQueueNameBuilder(),
40+
$communicationConfig,
41+
$rpcConnectionTimeout
42+
);
43+
}
44+
45+
/**
46+
* Get publisher config.
47+
*
48+
* @return PublisherConfig
49+
*
50+
* @deprecated 100.2.0
51+
*/
52+
private function getPublisherConfig()
53+
{
54+
return \Magento\Framework\App\ObjectManager::getInstance()->get(PublisherConfig::class);
55+
}
56+
57+
/**
58+
* Get response queue name builder.
59+
*
60+
* @return ResponseQueueNameBuilder
61+
*
62+
* @deprecated 100.2.0
63+
*/
64+
private function getResponseQueueNameBuilder()
65+
{
66+
return \Magento\Framework\App\ObjectManager::getInstance()->get(ResponseQueueNameBuilder::class);
67+
}
68+
}

app/code/Magento/Amqp/Model/Queue.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Amqp\Model;
7+
8+
/**
9+
* {@inheritdoc}
10+
*
11+
* @deprecated 100.2.0
12+
*/
13+
class Queue extends \Magento\Framework\Amqp\Queue
14+
{
15+
16+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Amqp\Model;
7+
8+
use Magento\Framework\Amqp\Topology\ExchangeInstaller;
9+
use Magento\Framework\Amqp\Topology\QueueInstaller;
10+
use Magento\Framework\MessageQueue\ConfigInterface as QueueConfig;
11+
use Magento\Framework\Communication\ConfigInterface as CommunicationConfig;
12+
use Magento\Framework\MessageQueue\Topology\ConfigInterface as TopologyConfig;
13+
use Magento\Framework\Amqp\ConfigPool;
14+
use Magento\Framework\Amqp\ConnectionTypeResolver;
15+
use Magento\Framework\Amqp\TopologyInstaller;
16+
17+
/**
18+
* Class Topology creates topology for Amqp messaging
19+
*
20+
* @deprecated 100.2.0
21+
*/
22+
class Topology extends TopologyInstaller
23+
{
24+
/**
25+
* Type of exchange
26+
*
27+
* @deprecated
28+
*/
29+
const TOPIC_EXCHANGE = 'topic';
30+
31+
/**
32+
* Amqp connection
33+
*/
34+
const AMQP_CONNECTION = 'amqp';
35+
36+
/**
37+
* Durability for exchange and queue
38+
*
39+
* @deprecated
40+
*/
41+
const IS_DURABLE = true;
42+
43+
/**
44+
* Initialize dependencies
45+
*
46+
* @param Config $amqpConfig
47+
* @param QueueConfig $queueConfig
48+
* @param CommunicationConfig $communicationConfig
49+
* @param \Psr\Log\LoggerInterface $logger
50+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
51+
*/
52+
public function __construct(
53+
Config $amqpConfig,
54+
QueueConfig $queueConfig,
55+
CommunicationConfig $communicationConfig,
56+
\Psr\Log\LoggerInterface $logger
57+
) {
58+
parent::__construct(
59+
\Magento\Framework\App\ObjectManager::getInstance()->get(TopologyConfig::class),
60+
\Magento\Framework\App\ObjectManager::getInstance()->get(ExchangeInstaller::class),
61+
\Magento\Framework\App\ObjectManager::getInstance()->get(ConfigPool::class),
62+
\Magento\Framework\App\ObjectManager::getInstance()->get(QueueInstaller::class),
63+
\Magento\Framework\App\ObjectManager::getInstance()->get(ConnectionTypeResolver::class),
64+
$logger
65+
);
66+
}
67+
}

app/code/Magento/Amqp/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Amqp
2+
3+
**Amqp** provides functionality to publish/consume messages with Amqp.
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Amqp\Setup;
7+
8+
use Magento\Framework\Config\Data\ConfigData;
9+
use Magento\Framework\Config\File\ConfigFilePool;
10+
use Magento\Framework\Setup\ConfigOptionsListInterface;
11+
use Magento\Framework\Setup\Option\TextConfigOption;
12+
use Magento\Framework\App\DeploymentConfig;
13+
14+
/**
15+
* Deployment configuration options needed for Setup application
16+
*/
17+
class ConfigOptionsList implements ConfigOptionsListInterface
18+
{
19+
/**
20+
* Input key for the options
21+
*/
22+
const INPUT_KEY_QUEUE_AMQP_HOST = 'amqp-host';
23+
const INPUT_KEY_QUEUE_AMQP_PORT = 'amqp-port';
24+
const INPUT_KEY_QUEUE_AMQP_USER = 'amqp-user';
25+
const INPUT_KEY_QUEUE_AMQP_PASSWORD = 'amqp-password';
26+
const INPUT_KEY_QUEUE_AMQP_VIRTUAL_HOST = 'amqp-virtualhost';
27+
const INPUT_KEY_QUEUE_AMQP_SSL = 'amqp-ssl';
28+
29+
/**
30+
* Path to the values in the deployment config
31+
*/
32+
const CONFIG_PATH_QUEUE_AMQP_HOST = 'queue/amqp/host';
33+
const CONFIG_PATH_QUEUE_AMQP_PORT = 'queue/amqp/port';
34+
const CONFIG_PATH_QUEUE_AMQP_USER = 'queue/amqp/user';
35+
const CONFIG_PATH_QUEUE_AMQP_PASSWORD = 'queue/amqp/password';
36+
const CONFIG_PATH_QUEUE_AMQP_VIRTUAL_HOST = 'queue/amqp/virtualhost';
37+
const CONFIG_PATH_QUEUE_AMQP_SSL = 'queue/amqp/ssl';
38+
39+
/**
40+
* Default values
41+
*/
42+
const DEFAULT_AMQP_HOST = '';
43+
const DEFAULT_AMQP_PORT = '5672';
44+
const DEFAULT_AMQP_USER = '';
45+
const DEFAULT_AMQP_PASSWORD = '';
46+
const DEFAULT_AMQP_VIRTUAL_HOST = '/';
47+
const DEFAULT_AMQP_SSL = '';
48+
49+
/**
50+
* @var ConnectionValidator
51+
*/
52+
private $connectionValidator;
53+
54+
/**
55+
* Constructor
56+
*
57+
* @param ConnectionValidator $connectionValidator
58+
*/
59+
public function __construct(ConnectionValidator $connectionValidator)
60+
{
61+
$this->connectionValidator = $connectionValidator;
62+
}
63+
64+
/**
65+
* {@inheritdoc}
66+
*/
67+
public function getOptions()
68+
{
69+
return [
70+
new TextConfigOption(
71+
self::INPUT_KEY_QUEUE_AMQP_HOST,
72+
TextConfigOption::FRONTEND_WIZARD_TEXT,
73+
self::CONFIG_PATH_QUEUE_AMQP_HOST,
74+
'Amqp server host',
75+
self::DEFAULT_AMQP_HOST
76+
),
77+
new TextConfigOption(
78+
self::INPUT_KEY_QUEUE_AMQP_PORT,
79+
TextConfigOption::FRONTEND_WIZARD_TEXT,
80+
self::CONFIG_PATH_QUEUE_AMQP_PORT,
81+
'Amqp server port',
82+
self::DEFAULT_AMQP_PORT
83+
),
84+
new TextConfigOption(
85+
self::INPUT_KEY_QUEUE_AMQP_USER,
86+
TextConfigOption::FRONTEND_WIZARD_TEXT,
87+
self::CONFIG_PATH_QUEUE_AMQP_USER,
88+
'Amqp server username',
89+
self::DEFAULT_AMQP_USER
90+
),
91+
new TextConfigOption(
92+
self::INPUT_KEY_QUEUE_AMQP_PASSWORD,
93+
TextConfigOption::FRONTEND_WIZARD_TEXT,
94+
self::CONFIG_PATH_QUEUE_AMQP_PASSWORD,
95+
'Amqp server password',
96+
self::DEFAULT_AMQP_PASSWORD
97+
),
98+
new TextConfigOption(
99+
self::INPUT_KEY_QUEUE_AMQP_VIRTUAL_HOST,
100+
TextConfigOption::FRONTEND_WIZARD_TEXT,
101+
self::CONFIG_PATH_QUEUE_AMQP_VIRTUAL_HOST,
102+
'Amqp virtualhost',
103+
self::DEFAULT_AMQP_VIRTUAL_HOST
104+
),
105+
new TextConfigOption(
106+
self::INPUT_KEY_QUEUE_AMQP_SSL,
107+
TextConfigOption::FRONTEND_WIZARD_TEXT,
108+
self::CONFIG_PATH_QUEUE_AMQP_SSL,
109+
'Amqp SSL',
110+
self::DEFAULT_AMQP_SSL
111+
),
112+
];
113+
}
114+
115+
/**
116+
* {@inheritdoc}
117+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
118+
*/
119+
public function createConfig(array $data, DeploymentConfig $deploymentConfig)
120+
{
121+
$configData = new ConfigData(ConfigFilePool::APP_ENV);
122+
123+
if (!$this->isDataEmpty($data, self::INPUT_KEY_QUEUE_AMQP_HOST)) {
124+
$configData->set(self::CONFIG_PATH_QUEUE_AMQP_HOST, $data[self::INPUT_KEY_QUEUE_AMQP_HOST]);
125+
if (!$this->isDataEmpty($data, self::INPUT_KEY_QUEUE_AMQP_PORT)) {
126+
$configData->set(self::CONFIG_PATH_QUEUE_AMQP_PORT, $data[self::INPUT_KEY_QUEUE_AMQP_PORT]);
127+
}
128+
if (!$this->isDataEmpty($data, self::INPUT_KEY_QUEUE_AMQP_USER)) {
129+
$configData->set(self::CONFIG_PATH_QUEUE_AMQP_USER, $data[self::INPUT_KEY_QUEUE_AMQP_USER]);
130+
}
131+
if (!$this->isDataEmpty($data, self::INPUT_KEY_QUEUE_AMQP_PASSWORD)) {
132+
$configData->set(self::CONFIG_PATH_QUEUE_AMQP_PASSWORD, $data[self::INPUT_KEY_QUEUE_AMQP_PASSWORD]);
133+
}
134+
if (!$this->isDataEmpty($data, self::INPUT_KEY_QUEUE_AMQP_VIRTUAL_HOST)) {
135+
$configData->set(
136+
self::CONFIG_PATH_QUEUE_AMQP_VIRTUAL_HOST,
137+
$data[self::INPUT_KEY_QUEUE_AMQP_VIRTUAL_HOST]
138+
);
139+
}
140+
if (!$this->isDataEmpty($data, self::INPUT_KEY_QUEUE_AMQP_SSL)) {
141+
$configData->set(self::CONFIG_PATH_QUEUE_AMQP_SSL, $data[self::INPUT_KEY_QUEUE_AMQP_SSL]);
142+
}
143+
}
144+
145+
return [$configData];
146+
}
147+
148+
/**
149+
* {@inheritdoc}
150+
*/
151+
public function validate(array $options, DeploymentConfig $deploymentConfig)
152+
{
153+
$errors = [];
154+
155+
if (isset($options[self::INPUT_KEY_QUEUE_AMQP_HOST])
156+
&& $options[self::INPUT_KEY_QUEUE_AMQP_HOST] !== '') {
157+
$result = $this->connectionValidator->isConnectionValid(
158+
$options[self::INPUT_KEY_QUEUE_AMQP_HOST],
159+
$options[self::INPUT_KEY_QUEUE_AMQP_PORT],
160+
$options[self::INPUT_KEY_QUEUE_AMQP_USER],
161+
$options[self::INPUT_KEY_QUEUE_AMQP_PASSWORD],
162+
$options[self::INPUT_KEY_QUEUE_AMQP_VIRTUAL_HOST]
163+
);
164+
165+
if (!$result) {
166+
$errors[] = "Could not connect to the Amqp Server.";
167+
}
168+
}
169+
170+
return $errors;
171+
}
172+
173+
/**
174+
* Check if data ($data) with key ($key) is empty
175+
*
176+
* @param array $data
177+
* @param string $key
178+
* @return bool
179+
*/
180+
private function isDataEmpty(array $data, $key)
181+
{
182+
if (isset($data[$key]) && $data[$key] !== '') {
183+
return false;
184+
}
185+
186+
return true;
187+
}
188+
}

0 commit comments

Comments
 (0)