From 73cd160bfc6e4a1b88f2117eb0c097a91ac5c753 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 14 Jan 2016 18:15:07 +0100 Subject: Switch to Symfony 3 structure --- bin/console | 29 ++++++++++ bin/doctrine | 1 + bin/doctrine-dbal | 1 + bin/doctrine-migrations | 1 + bin/doctrine.php | 1 + bin/poche.sqlite | Bin 393216 -> 0 bytes bin/security-checker | 1 + bin/symfony_requirements | 143 +++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 177 insertions(+) create mode 100644 bin/console create mode 120000 bin/doctrine create mode 120000 bin/doctrine-dbal create mode 120000 bin/doctrine-migrations create mode 120000 bin/doctrine.php delete mode 100644 bin/poche.sqlite create mode 120000 bin/security-checker create mode 100644 bin/symfony_requirements (limited to 'bin') diff --git a/bin/console b/bin/console new file mode 100644 index 00000000..49247c94 --- /dev/null +++ b/bin/console @@ -0,0 +1,29 @@ +#!/usr/bin/env php +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); diff --git a/bin/doctrine b/bin/doctrine new file mode 120000 index 00000000..0f72e36f --- /dev/null +++ b/bin/doctrine @@ -0,0 +1 @@ +../vendor/doctrine/orm/bin/doctrine \ No newline at end of file diff --git a/bin/doctrine-dbal b/bin/doctrine-dbal new file mode 120000 index 00000000..110e93c5 --- /dev/null +++ b/bin/doctrine-dbal @@ -0,0 +1 @@ +../vendor/doctrine/dbal/bin/doctrine-dbal \ No newline at end of file diff --git a/bin/doctrine-migrations b/bin/doctrine-migrations new file mode 120000 index 00000000..7184da71 --- /dev/null +++ b/bin/doctrine-migrations @@ -0,0 +1 @@ +../vendor/doctrine/migrations/bin/doctrine-migrations \ No newline at end of file diff --git a/bin/doctrine.php b/bin/doctrine.php new file mode 120000 index 00000000..b22b74da --- /dev/null +++ b/bin/doctrine.php @@ -0,0 +1 @@ +../vendor/doctrine/orm/bin/doctrine.php \ No newline at end of file diff --git a/bin/poche.sqlite b/bin/poche.sqlite deleted file mode 100644 index f2b79b68..00000000 Binary files a/bin/poche.sqlite and /dev/null differ diff --git a/bin/security-checker b/bin/security-checker new file mode 120000 index 00000000..85f6e8ed --- /dev/null +++ b/bin/security-checker @@ -0,0 +1 @@ +../vendor/sensiolabs/security-checker/security-checker \ No newline at end of file diff --git a/bin/symfony_requirements b/bin/symfony_requirements new file mode 100644 index 00000000..1eca6719 --- /dev/null +++ b/bin/symfony_requirements @@ -0,0 +1,143 @@ +#!/usr/bin/env php +getPhpIniConfigPath(); + +echo_title('Symfony2 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 Symfony2 projects'); +} else { + echo_block('error', 'ERROR', 'Your system is not ready to run Symfony2 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; +} -- cgit v1.2.3