Skip to content

Commit fd14697

Browse files
composer.json update
1 parent 8611433 commit fd14697

10 files changed

+174
-534
lines changed

.gitmodules

-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +0,0 @@
1-
[submodule "src/Oro"]
2-
path = src/Oro
3-
url = [email protected]:laboro/platform.git
4-
[submodule "src/OroPackages/src/Oro/Bundle/EntitySerializedFieldsBundle"]
5-
path = src/OroPackages/src/Oro/Bundle/EntitySerializedFieldsBundle
6-
url = [email protected]:laboro/OroEntitySerializedFieldsBundle.git
7-
[submodule "src/OroB2B"]
8-
path = src/OroB2B
9-
url = [email protected]:laboro/commerce.git

app/check.php

+114-34
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,141 @@
22

33
require_once dirname(__FILE__).'/SymfonyRequirements.php';
44

5+
$lineSize = 70;
56
$symfonyRequirements = new SymfonyRequirements();
6-
77
$iniPath = $symfonyRequirements->getPhpIniConfigPath();
88

9-
echo "********************************\n";
10-
echo "* *\n";
11-
echo "* Symfony requirements check *\n";
12-
echo "* *\n";
13-
echo "********************************\n\n";
14-
15-
echo $iniPath ? sprintf("* Configuration file used by PHP: %s\n\n", $iniPath) : "* WARNING: No configuration file (php.ini) used by PHP!\n\n";
9+
echo_title('Symfony2 Requirements Checker');
1610

17-
echo "** ATTENTION **\n";
18-
echo "* The PHP CLI can use a different php.ini file\n";
19-
echo "* than the one used with your web server.\n";
20-
if ('\\' == DIRECTORY_SEPARATOR) {
21-
echo "* (especially on the Windows platform)\n";
11+
echo '> PHP is using the following php.ini file:'.PHP_EOL;
12+
if ($iniPath) {
13+
echo_style('green', ' '.$iniPath);
14+
} else {
15+
echo_style('warning', ' WARNING: No configuration file (php.ini) used by PHP!');
2216
}
23-
echo "* To be on the safe side, please also launch the requirements check\n";
24-
echo "* from your web server using the web/config.php script.\n";
2517

26-
echo_title('Mandatory requirements');
18+
echo PHP_EOL.PHP_EOL;
19+
20+
echo '> Checking Symfony requirements:'.PHP_EOL.' ';
2721

28-
$checkPassed = true;
22+
$messages = array();
2923
foreach ($symfonyRequirements->getRequirements() as $req) {
3024
/** @var $req Requirement */
31-
echo_requirement($req);
32-
if (!$req->isFulfilled()) {
33-
$checkPassed = false;
25+
if ($helpText = get_error_message($req, $lineSize)) {
26+
echo_style('red', 'E');
27+
$messages['error'][] = $helpText;
28+
} else {
29+
echo_style('green', '.');
3430
}
3531
}
3632

37-
echo_title('Optional recommendations');
33+
$checkPassed = empty($messages['error']);
3834

3935
foreach ($symfonyRequirements->getRecommendations() as $req) {
40-
echo_requirement($req);
36+
if ($helpText = get_error_message($req, $lineSize)) {
37+
echo_style('yellow', 'W');
38+
$messages['warning'][] = $helpText;
39+
} else {
40+
echo_style('green', '.');
41+
}
42+
}
43+
44+
if ($checkPassed) {
45+
echo_block('success', 'OK', 'Your system is ready to run Symfony2 projects');
46+
} else {
47+
echo_block('error', 'ERROR', 'Your system is not ready to run Symfony2 projects');
48+
49+
echo_title('Fix the following mandatory requirements', 'red');
50+
51+
foreach ($messages['error'] as $helpText) {
52+
echo ' * '.$helpText.PHP_EOL;
53+
}
4154
}
4255

56+
if (!empty($messages['warning'])) {
57+
echo_title('Optional recommendations to improve your setup', 'yellow');
58+
59+
foreach ($messages['warning'] as $helpText) {
60+
echo ' * '.$helpText.PHP_EOL;
61+
}
62+
}
63+
64+
echo PHP_EOL;
65+
echo_style('title', 'Note');
66+
echo ' The command console could use a different php.ini file'.PHP_EOL;
67+
echo_style('title', '~~~~');
68+
echo ' than the one used with your web server. To be on the'.PHP_EOL;
69+
echo ' safe side, please check the requirements from your web'.PHP_EOL;
70+
echo ' server using the ';
71+
echo_style('yellow', 'web/config.php');
72+
echo ' script.'.PHP_EOL;
73+
echo PHP_EOL;
74+
4375
exit($checkPassed ? 0 : 1);
4476

45-
/**
46-
* Prints a Requirement instance
47-
*/
48-
function echo_requirement(Requirement $requirement)
77+
function get_error_message(Requirement $requirement, $lineSize)
4978
{
50-
$result = $requirement->isFulfilled() ? 'OK' : ($requirement->isOptional() ? 'WARNING' : 'ERROR');
51-
echo ' ' . str_pad($result, 9);
52-
echo $requirement->getTestMessage() . "\n";
53-
54-
if (!$requirement->isFulfilled()) {
55-
echo sprintf(" %s\n\n", $requirement->getHelpText());
79+
if ($requirement->isFulfilled()) {
80+
return;
5681
}
82+
83+
$errorMessage = wordwrap($requirement->getTestMessage(), $lineSize - 3, PHP_EOL.' ').PHP_EOL;
84+
$errorMessage .= ' > '.wordwrap($requirement->getHelpText(), $lineSize - 5, PHP_EOL.' > ').PHP_EOL;
85+
86+
return $errorMessage;
5787
}
5888

59-
function echo_title($title)
89+
function echo_title($title, $style = null)
6090
{
61-
echo "\n** $title **\n\n";
91+
$style = $style ?: 'title';
92+
93+
echo PHP_EOL;
94+
echo_style($style, $title.PHP_EOL);
95+
echo_style($style, str_repeat('~', strlen($title)).PHP_EOL);
96+
echo PHP_EOL;
97+
}
98+
99+
function echo_style($style, $message)
100+
{
101+
// ANSI color codes
102+
$styles = array(
103+
'reset' => "\033[0m",
104+
'red' => "\033[31m",
105+
'green' => "\033[32m",
106+
'yellow' => "\033[33m",
107+
'error' => "\033[37;41m",
108+
'success' => "\033[37;42m",
109+
'title' => "\033[34m",
110+
);
111+
$supports = has_color_support();
112+
113+
echo($supports ? $styles[$style] : '').$message.($supports ? $styles['reset'] : '');
114+
}
115+
116+
function echo_block($style, $title, $message)
117+
{
118+
$message = ' '.trim($message).' ';
119+
$width = strlen($message);
120+
121+
echo PHP_EOL.PHP_EOL;
122+
123+
echo_style($style, str_repeat(' ', $width).PHP_EOL);
124+
echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT).PHP_EOL);
125+
echo_style($style, str_pad($message, $width, ' ', STR_PAD_RIGHT).PHP_EOL);
126+
echo_style($style, str_repeat(' ', $width).PHP_EOL);
127+
}
128+
129+
function has_color_support()
130+
{
131+
static $support;
132+
133+
if (null === $support) {
134+
if (DIRECTORY_SEPARATOR == '\\') {
135+
$support = false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI');
136+
} else {
137+
$support = function_exists('posix_isatty') && @posix_isatty(STDOUT);
138+
}
139+
}
140+
141+
return $support;
62142
}

app/phpunit.xml.dist

-121
This file was deleted.

app/phpunit.xml.dist.coverage

-74
This file was deleted.

0 commit comments

Comments
 (0)