Skip to content

Commit 6dca123

Browse files
authored
Merge pull request #11 from magento-commerce/develop
Merge develop into 1.0
2 parents 86fc24f + 56b96f5 commit 6dca123

File tree

10 files changed

+58
-17
lines changed

10 files changed

+58
-17
lines changed

.travis.yml

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ jobs:
4646
env:
4747
- TEST_SUITE=functional
4848

49+
before_install:
50+
# https://github.com/kylekatarnls/update-helper/issues/9
51+
- if [ -n "${COMPOSER_VERSION}" ]; then travis_retry composer self-update ${COMPOSER_VERSION}; fi;
4952

5053
install:
5154
- composer config github-oauth.github.com ${GITHUB_TOKEN}

Model/Cache/Evictor.php

+43-8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class Evictor
2222
const DEFAULT_SLEEP_TIMEOUT = 20000;
2323
const CONFIG_PATH_ENABLED = 'cache_evict/enabled';
2424
const CONFIG_PATH_LIMIT = 'cache_evict/limit';
25+
const BACKEND_OPTION_KEY_SERVER = 'server';
26+
const BACKEND_OPTION_KEY_PORT = 'port';
27+
const BACKEND_OPTION_KEY_DATABASE = 'database';
2528

2629
/**
2730
* @var DeploymentConfig
@@ -60,11 +63,8 @@ public function evict(): int
6063
$name
6164
));
6265

63-
if (!isset(
64-
$cacheConfig['backend_options']['server'],
65-
$cacheConfig['backend_options']['port'],
66-
$cacheConfig['backend_options']['database']
67-
)) {
66+
$backendOptions = $this->getConfigBackendOptions((array)$cacheConfig);
67+
if (!$this->validateBackendOptions($backendOptions)) {
6868
$this->logger->debug(sprintf(
6969
'Cache config for database "%s" config is not valid',
7070
$name
@@ -74,9 +74,9 @@ public function evict(): int
7474
}
7575

7676
$dbKeys = $this->run(
77-
(string)$cacheConfig['backend_options']['server'],
78-
(int)$cacheConfig['backend_options']['port'],
79-
(int)$cacheConfig['backend_options']['database']
77+
(string)$backendOptions[self::BACKEND_OPTION_KEY_SERVER],
78+
(int)$backendOptions[self::BACKEND_OPTION_KEY_PORT],
79+
(int)$backendOptions[self::BACKEND_OPTION_KEY_DATABASE]
8080
);
8181
$evictedKeys += $dbKeys;
8282

@@ -86,6 +86,41 @@ public function evict(): int
8686
return $evictedKeys;
8787
}
8888

89+
/**
90+
* Get Cache Config Value
91+
*
92+
* @param array $cacheConfig
93+
* @return array
94+
*/
95+
private function getConfigBackendOptions(array $cacheConfig): array
96+
{
97+
$backendOptions = [];
98+
if (isset($cacheConfig['backend_options'])) {
99+
$backendOptions = $cacheConfig['backend_options'];
100+
}
101+
if (isset($cacheConfig['backend_options']['remote_backend_options'])) {
102+
$backendOptions = $cacheConfig['backend_options']['remote_backend_options'];
103+
}
104+
return (array)$backendOptions;
105+
}
106+
107+
/**
108+
* Validate Cache Configuration
109+
*
110+
* @param array $backendOptions
111+
* @return bool
112+
*/
113+
private function validateBackendOptions(array $backendOptions): bool
114+
{
115+
if (isset($backendOptions[self::BACKEND_OPTION_KEY_SERVER])
116+
&& isset($backendOptions[self::BACKEND_OPTION_KEY_PORT])
117+
&& isset($backendOptions[self::BACKEND_OPTION_KEY_DATABASE])
118+
) {
119+
return true;
120+
}
121+
return false;
122+
}
123+
89124
/**
90125
* @param string $host
91126
* @param int $port

Model/Cache/InvalidateLogger.php

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class InvalidateLogger extends \Magento\Framework\Cache\InvalidateLogger
5454
'acl_cache',
5555
'reflection',
5656
'db_ddl',
57+
'LOCKED_RECORD_INFO_SYSTEM_CONFIG',
5758
'all'
5859
];
5960

Model/Observer/CacheFlushAll.php

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function __construct(InvalidateLogger $logger)
3434
* Log cache flush action to a file
3535
*
3636
* @param Observer $observer
37+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3738
*/
3839
public function execute(Observer $observer)
3940
{

Model/UrlFixer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ public function run(Store $store, $url): string
2929
return preg_replace('|/magento/|', '/', $url, 1);
3030
}
3131

32-
return $url;
32+
return rtrim($url, '/');
3333
}
3434
}

Test/Functional/Acceptance/AcceptanceCest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function testPatches(\CliTester $I, \Codeception\Example $data): void
5050
{
5151
$this->prepareTemplate($I, $data['magentoVersion']);
5252
$this->removeESIfExists($I, $data['magentoVersion']);
53-
$I->runEceDockerCommand('build:compose --mode=production');
53+
$I->generateDockerCompose('--mode=production');
5454
$I->runDockerComposeCommand('run build cloud-build');
5555
$I->startEnvironment();
5656
$I->runDockerComposeCommand('run deploy cloud-deploy');

Test/Unit/Model/UrlFixerTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,17 @@ public function runDataProvider(): array
7474
return [
7575
'rewrites enabled, url without "magento" part' => [
7676
'http://example.com/',
77-
'http://example.com/',
77+
'http://example.com',
7878
],
7979
'rewrites disabled, url without "magento" part' => [
8080
'http://example.com/',
81-
'http://example.com/',
81+
'http://example.com',
8282
true,
8383
true,
8484
],
8585
'rewrites enabled, url with "magento" part' => [
8686
'http://example.com/magento/',
87-
'http://example.com/magento/',
87+
'http://example.com/magento',
8888
false,
8989
true,
9090
],
@@ -108,13 +108,13 @@ public function runDataProvider(): array
108108
],
109109
'rewrites disabled, url with "magento2" part' => [
110110
'http://example.com/magento2/',
111-
'http://example.com/magento2/',
111+
'http://example.com/magento2',
112112
true,
113113
false,
114114
],
115115
'rewrites disabled, with "magento" host' => [
116116
'http://magento.com/magento2/',
117-
'http://magento.com/magento2/',
117+
'http://magento.com/magento2',
118118
true,
119119
false,
120120
],

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/magento-cloud-components",
33
"description": "Cloud Components Module for Magento 2.x",
44
"type": "magento2-module",
5-
"version": "1.0.7",
5+
"version": "1.0.8",
66
"require": {
77
"php": "^7.0",
88
"ext-json": "*",

etc/di.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,6 @@
6666
</arguments>
6767
</type>
6868
<type name="Magento\Framework\Indexer\ActionInterface">
69-
<plugin name="cache_cleaner_after_reindex" type="Magento\CloudComponents\Model\Indexation\Logger" />
69+
<plugin name="cache_logger_after_reindex" type="Magento\CloudComponents\Model\Indexation\Logger" />
7070
</type>
7171
</config>

travis.php.ini

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
memory_limit = 4G

0 commit comments

Comments
 (0)