Skip to content

Commit 9adbca7

Browse files
author
Oleksii Korshenko
authored
Merge pull request #1628 from magento-engcom/2.1-develop-prs
Public Pull Requests #11761 [BACKPORT 2.1] [TASK] Incorrect minimum memory_limit references have … by @lewisvoncken #11590 [Backport 2.1-develop] #11586 Fix duplicated crontab 2>&1 expression by @adrian-martinez-interactiv4 Fixed Public Issues #11322 User.ini files specify 768M - Docs recommend at least 1G #11586 Cron install / remove via command messes up stderr 2>&1 entries
2 parents 05bb680 + 808aac1 commit 9adbca7

File tree

8 files changed

+43
-19
lines changed

8 files changed

+43
-19
lines changed

.htaccess

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# All explanations you could find in .htaccess.sample file
22
DirectoryIndex index.php
33
<IfModule mod_php5.c>
4-
php_value memory_limit 768M
4+
php_value memory_limit 756M
55
php_value max_execution_time 18000
66
php_flag session.auto_start off
77
php_flag suhosin.session.cryptua off
88
</IfModule>
99
<IfModule mod_php7.c>
10-
php_value memory_limit 768M
10+
php_value memory_limit 756M
1111
php_value max_execution_time 18000
1212
php_flag session.auto_start off
1313
php_flag suhosin.session.cryptua off

.htaccess.sample

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ DirectoryIndex index.php
3636
############################################
3737
## adjust memory limit
3838

39-
php_value memory_limit 768M
39+
php_value memory_limit 756M
4040
php_value max_execution_time 18000
4141

4242
############################################
@@ -59,7 +59,7 @@ DirectoryIndex index.php
5959
############################################
6060
## adjust memory limit
6161

62-
php_value memory_limit 768M
62+
php_value memory_limit 756M
6363
php_value max_execution_time 18000
6464

6565
############################################

.user.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
memory_limit = 768M
1+
memory_limit = 756M
22
max_execution_time = 18000
33
session.auto_start = off
44
suhosin.session.cryptua = off

app/code/Magento/SampleData/Console/Command/SampleDataDeployCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ private function updateMemoryLimit()
137137
if (function_exists('ini_set')) {
138138
@ini_set('display_errors', 1);
139139
$memoryLimit = trim(ini_get('memory_limit'));
140-
if ($memoryLimit != -1 && $this->getMemoryInBytes($memoryLimit) < 768 * 1024 * 1024) {
141-
@ini_set('memory_limit', '768M');
140+
if ($memoryLimit != -1 && $this->getMemoryInBytes($memoryLimit) < 756 * 1024 * 1024) {
141+
@ini_set('memory_limit', '756M');
142142
}
143143
}
144144
}

lib/internal/Magento/Framework/Shell/CommandRenderer.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ class CommandRenderer implements CommandRendererInterface
1616
*/
1717
public function render($command, array $arguments = [])
1818
{
19+
$command = preg_replace('/(\s+2>&1)*(\s*\|)|$/', ' 2>&1$2', $command);
1920
$arguments = array_map('escapeshellarg', $arguments);
20-
$command = preg_replace('/\s?\||$/', ' 2>&1$0', $command);
21-
$command = vsprintf($command, $arguments);
22-
return $command;
21+
if (empty($arguments)) {
22+
return $command;
23+
}
24+
return vsprintf($command, $arguments);
2325
}
2426
}

lib/internal/Magento/Framework/Shell/Test/Unit/CommandRendererTest.php

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,40 @@
55
*/
66
namespace Magento\Framework\Shell\Test\Unit;
77

8-
use \Magento\Framework\Shell\CommandRenderer;
8+
use Magento\Framework\Shell\CommandRenderer;
99

1010
class CommandRendererTest extends \PHPUnit_Framework_TestCase
1111
{
12-
public function testRender()
12+
/**
13+
* @param $expectedCommand
14+
* @param $actualCommand
15+
* @param $testArguments
16+
* @dataProvider commandsDataProvider
17+
*/
18+
public function testRender($expectedCommand, $actualCommand, $testArguments)
1319
{
14-
$testArgument = 'argument';
15-
$testArgument2 = 'argument2';
1620
$commandRenderer = new CommandRenderer();
1721
$this->assertEquals(
18-
"php -r " . escapeshellarg($testArgument) . " 2>&1 | grep " . escapeshellarg($testArgument2) . " 2>&1",
19-
$commandRenderer->render('php -r %s | grep %s', [$testArgument, $testArgument2])
22+
$expectedCommand,
23+
$commandRenderer->render($actualCommand, $testArguments)
2024
);
2125
}
26+
27+
public function commandsDataProvider()
28+
{
29+
$testArgument = 'argument';
30+
$testArgument2 = 'argument2';
31+
32+
$expectedCommand = "php -r %s 2>&1 | grep %s 2>&1";
33+
$expectedCommandArgs = "php -r '" . $testArgument . "' 2>&1 | grep '" . $testArgument2 . "' 2>&1";
34+
35+
return [
36+
[$expectedCommand, 'php -r %s | grep %s', []],
37+
[$expectedCommand, 'php -r %s 2>&1 | grep %s', []],
38+
[$expectedCommand, 'php -r %s 2>&1 2>&1 | grep %s', []],
39+
[$expectedCommandArgs, 'php -r %s | grep %s', [$testArgument, $testArgument2]],
40+
[$expectedCommandArgs, 'php -r %s 2>&1 | grep %s', [$testArgument, $testArgument2]],
41+
[$expectedCommandArgs, 'php -r %s 2>&1 2>&1 | grep %s', [$testArgument, $testArgument2]],
42+
];
43+
}
2244
}

pub/.htaccess

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
############################################
3737
## Adjust memory limit
3838

39-
php_value memory_limit 768M
39+
php_value memory_limit 756M
4040
php_value max_execution_time 18000
4141

4242
############################################
@@ -59,7 +59,7 @@
5959
############################################
6060
## Adjust memory limit
6161

62-
php_value memory_limit 768M
62+
php_value memory_limit 756M
6363
php_value max_execution_time 18000
6464

6565
############################################

pub/.user.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
memory_limit = 768M
1+
memory_limit = 756M
22
max_execution_time = 18000
33
session.auto_start = off
44
suhosin.session.cryptua = off

0 commit comments

Comments
 (0)