forked from Sylius/Sylius
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
249 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,11 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
use Doctrine\Common\Annotations\AnnotationRegistry; | ||
use Composer\Autoload\ClassLoader; | ||
|
||
/** @var ClassLoader $loader */ | ||
$loader = require __DIR__.'/../vendor/autoload.php'; | ||
|
||
// Intl stubs. | ||
if (!function_exists('intl_get_error_code')) { | ||
require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php'; | ||
} | ||
|
||
AnnotationRegistry::registerLoader(array($loader, 'loadClass')); | ||
AnnotationRegistry::registerLoader([$loader, 'loadClass']); | ||
|
||
return $loader; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
use Symfony\Component\Console\Input\ArgvInput; | ||
use Symfony\Component\Debug\Debug; | ||
|
||
// if you don't want to setup permissions the proper way, just uncomment the following PHP line | ||
// read http://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup | ||
// for more information | ||
//umask(0000); | ||
|
||
set_time_limit(0); | ||
|
||
/** @var Composer\Autoload\ClassLoader $loader */ | ||
$loader = require __DIR__.'/../app/autoload.php'; | ||
|
||
$input = new ArgvInput(); | ||
$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev'); | ||
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod'; | ||
|
||
if ($debug) { | ||
Debug::enable(); | ||
} | ||
|
||
$kernel = new AppKernel($env, $debug); | ||
$application = new Application($kernel); | ||
$application->run($input); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
require_once dirname(__FILE__).'/../var/SymfonyRequirements.php'; | ||
|
||
$lineSize = 70; | ||
$symfonyRequirements = new SymfonyRequirements(); | ||
$iniPath = $symfonyRequirements->getPhpIniConfigPath(); | ||
|
||
echo_title('Symfony Requirements Checker'); | ||
|
||
echo '> PHP is using the following php.ini file:'.PHP_EOL; | ||
if ($iniPath) { | ||
echo_style('green', ' '.$iniPath); | ||
} else { | ||
echo_style('warning', ' WARNING: No configuration file (php.ini) used by PHP!'); | ||
} | ||
|
||
echo PHP_EOL.PHP_EOL; | ||
|
||
echo '> Checking Symfony requirements:'.PHP_EOL.' '; | ||
|
||
$messages = array(); | ||
foreach ($symfonyRequirements->getRequirements() as $req) { | ||
/** @var $req Requirement */ | ||
if ($helpText = get_error_message($req, $lineSize)) { | ||
echo_style('red', 'E'); | ||
$messages['error'][] = $helpText; | ||
} else { | ||
echo_style('green', '.'); | ||
} | ||
} | ||
|
||
$checkPassed = empty($messages['error']); | ||
|
||
foreach ($symfonyRequirements->getRecommendations() as $req) { | ||
if ($helpText = get_error_message($req, $lineSize)) { | ||
echo_style('yellow', 'W'); | ||
$messages['warning'][] = $helpText; | ||
} else { | ||
echo_style('green', '.'); | ||
} | ||
} | ||
|
||
if ($checkPassed) { | ||
echo_block('success', 'OK', 'Your system is ready to run Symfony projects'); | ||
} else { | ||
echo_block('error', 'ERROR', 'Your system is not ready to run Symfony projects'); | ||
|
||
echo_title('Fix the following mandatory requirements', 'red'); | ||
|
||
foreach ($messages['error'] as $helpText) { | ||
echo ' * '.$helpText.PHP_EOL; | ||
} | ||
} | ||
|
||
if (!empty($messages['warning'])) { | ||
echo_title('Optional recommendations to improve your setup', 'yellow'); | ||
|
||
foreach ($messages['warning'] as $helpText) { | ||
echo ' * '.$helpText.PHP_EOL; | ||
} | ||
} | ||
|
||
echo PHP_EOL; | ||
echo_style('title', 'Note'); | ||
echo ' The command console could use a different php.ini file'.PHP_EOL; | ||
echo_style('title', '~~~~'); | ||
echo ' than the one used with your web server. To be on the'.PHP_EOL; | ||
echo ' safe side, please check the requirements from your web'.PHP_EOL; | ||
echo ' server using the '; | ||
echo_style('yellow', 'web/config.php'); | ||
echo ' script.'.PHP_EOL; | ||
echo PHP_EOL; | ||
|
||
exit($checkPassed ? 0 : 1); | ||
|
||
function get_error_message(Requirement $requirement, $lineSize) | ||
{ | ||
if ($requirement->isFulfilled()) { | ||
return; | ||
} | ||
|
||
$errorMessage = wordwrap($requirement->getTestMessage(), $lineSize - 3, PHP_EOL.' ').PHP_EOL; | ||
$errorMessage .= ' > '.wordwrap($requirement->getHelpText(), $lineSize - 5, PHP_EOL.' > ').PHP_EOL; | ||
|
||
return $errorMessage; | ||
} | ||
|
||
function echo_title($title, $style = null) | ||
{ | ||
$style = $style ?: 'title'; | ||
|
||
echo PHP_EOL; | ||
echo_style($style, $title.PHP_EOL); | ||
echo_style($style, str_repeat('~', strlen($title)).PHP_EOL); | ||
echo PHP_EOL; | ||
} | ||
|
||
function echo_style($style, $message) | ||
{ | ||
// ANSI color codes | ||
$styles = array( | ||
'reset' => "\033[0m", | ||
'red' => "\033[31m", | ||
'green' => "\033[32m", | ||
'yellow' => "\033[33m", | ||
'error' => "\033[37;41m", | ||
'success' => "\033[37;42m", | ||
'title' => "\033[34m", | ||
); | ||
$supports = has_color_support(); | ||
|
||
echo($supports ? $styles[$style] : '').$message.($supports ? $styles['reset'] : ''); | ||
} | ||
|
||
function echo_block($style, $title, $message) | ||
{ | ||
$message = ' '.trim($message).' '; | ||
$width = strlen($message); | ||
|
||
echo PHP_EOL.PHP_EOL; | ||
|
||
echo_style($style, str_repeat(' ', $width).PHP_EOL); | ||
echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT).PHP_EOL); | ||
echo_style($style, str_pad($message, $width, ' ', STR_PAD_RIGHT).PHP_EOL); | ||
echo_style($style, str_repeat(' ', $width).PHP_EOL); | ||
} | ||
|
||
function has_color_support() | ||
{ | ||
static $support; | ||
|
||
if (null === $support) { | ||
if (DIRECTORY_SEPARATOR == '\\') { | ||
$support = false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI'); | ||
} else { | ||
$support = function_exists('posix_isatty') && @posix_isatty(STDOUT); | ||
} | ||
} | ||
|
||
return $support; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.