diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-01-14 18:15:07 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-01-15 09:35:39 +0100 |
commit | 73cd160bfc6e4a1b88f2117eb0c097a91ac5c753 (patch) | |
tree | c5ccc9fa57f243126538ae8d9a2f8c459c08bd8c /bin | |
parent | 1d405d0e62a708928bccd2222ebd89d4804231f9 (diff) | |
download | wallabag-73cd160bfc6e4a1b88f2117eb0c097a91ac5c753.tar.gz wallabag-73cd160bfc6e4a1b88f2117eb0c097a91ac5c753.tar.zst wallabag-73cd160bfc6e4a1b88f2117eb0c097a91ac5c753.zip |
Switch to Symfony 3 structure
Diffstat (limited to 'bin')
-rw-r--r-- | bin/console | 29 | ||||
l--------- | bin/doctrine | 1 | ||||
l--------- | bin/doctrine-dbal | 1 | ||||
l--------- | bin/doctrine-migrations | 1 | ||||
l--------- | bin/doctrine.php | 1 | ||||
-rw-r--r-- | bin/poche.sqlite | bin | 393216 -> 0 bytes | |||
l--------- | bin/security-checker | 1 | ||||
-rw-r--r-- | bin/symfony_requirements | 143 |
8 files changed, 177 insertions, 0 deletions
diff --git a/bin/console b/bin/console new file mode 100644 index 00000000..49247c94 --- /dev/null +++ b/bin/console | |||
@@ -0,0 +1,29 @@ | |||
1 | #!/usr/bin/env php | ||
2 | <?php | ||
3 | |||
4 | use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
5 | use Symfony\Component\Console\Input\ArgvInput; | ||
6 | use Symfony\Component\Debug\Debug; | ||
7 | |||
8 | // if you don't want to setup permissions the proper way, just uncomment the following PHP line | ||
9 | // read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information | ||
10 | //umask(0000); | ||
11 | |||
12 | set_time_limit(0); | ||
13 | |||
14 | /** | ||
15 | * @var Composer\Autoload\ClassLoader $loader | ||
16 | */ | ||
17 | $loader = require __DIR__.'/../app/autoload.php'; | ||
18 | |||
19 | $input = new ArgvInput(); | ||
20 | $env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev'); | ||
21 | $debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod'; | ||
22 | |||
23 | if ($debug) { | ||
24 | Debug::enable(); | ||
25 | } | ||
26 | |||
27 | $kernel = new AppKernel($env, $debug); | ||
28 | $application = new Application($kernel); | ||
29 | $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 --- a/bin/poche.sqlite +++ /dev/null | |||
Binary files 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 @@ | |||
1 | #!/usr/bin/env php | ||
2 | <?php | ||
3 | |||
4 | require_once dirname(__FILE__).'/../var/SymfonyRequirements.php'; | ||
5 | |||
6 | $lineSize = 70; | ||
7 | $symfonyRequirements = new SymfonyRequirements(); | ||
8 | $iniPath = $symfonyRequirements->getPhpIniConfigPath(); | ||
9 | |||
10 | echo_title('Symfony2 Requirements Checker'); | ||
11 | |||
12 | echo '> PHP is using the following php.ini file:'.PHP_EOL; | ||
13 | if ($iniPath) { | ||
14 | echo_style('green', ' '.$iniPath); | ||
15 | } else { | ||
16 | echo_style('warning', ' WARNING: No configuration file (php.ini) used by PHP!'); | ||
17 | } | ||
18 | |||
19 | echo PHP_EOL.PHP_EOL; | ||
20 | |||
21 | echo '> Checking Symfony requirements:'.PHP_EOL.' '; | ||
22 | |||
23 | $messages = array(); | ||
24 | foreach ($symfonyRequirements->getRequirements() as $req) { | ||
25 | /** @var $req Requirement */ | ||
26 | if ($helpText = get_error_message($req, $lineSize)) { | ||
27 | echo_style('red', 'E'); | ||
28 | $messages['error'][] = $helpText; | ||
29 | } else { | ||
30 | echo_style('green', '.'); | ||
31 | } | ||
32 | } | ||
33 | |||
34 | $checkPassed = empty($messages['error']); | ||
35 | |||
36 | foreach ($symfonyRequirements->getRecommendations() as $req) { | ||
37 | if ($helpText = get_error_message($req, $lineSize)) { | ||
38 | echo_style('yellow', 'W'); | ||
39 | $messages['warning'][] = $helpText; | ||
40 | } else { | ||
41 | echo_style('green', '.'); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | if ($checkPassed) { | ||
46 | echo_block('success', 'OK', 'Your system is ready to run Symfony2 projects'); | ||
47 | } else { | ||
48 | echo_block('error', 'ERROR', 'Your system is not ready to run Symfony2 projects'); | ||
49 | |||
50 | echo_title('Fix the following mandatory requirements', 'red'); | ||
51 | |||
52 | foreach ($messages['error'] as $helpText) { | ||
53 | echo ' * '.$helpText.PHP_EOL; | ||
54 | } | ||
55 | } | ||
56 | |||
57 | if (!empty($messages['warning'])) { | ||
58 | echo_title('Optional recommendations to improve your setup', 'yellow'); | ||
59 | |||
60 | foreach ($messages['warning'] as $helpText) { | ||
61 | echo ' * '.$helpText.PHP_EOL; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | echo PHP_EOL; | ||
66 | echo_style('title', 'Note'); | ||
67 | echo ' The command console could use a different php.ini file'.PHP_EOL; | ||
68 | echo_style('title', '~~~~'); | ||
69 | echo ' than the one used with your web server. To be on the'.PHP_EOL; | ||
70 | echo ' safe side, please check the requirements from your web'.PHP_EOL; | ||
71 | echo ' server using the '; | ||
72 | echo_style('yellow', 'web/config.php'); | ||
73 | echo ' script.'.PHP_EOL; | ||
74 | echo PHP_EOL; | ||
75 | |||
76 | exit($checkPassed ? 0 : 1); | ||
77 | |||
78 | function get_error_message(Requirement $requirement, $lineSize) | ||
79 | { | ||
80 | if ($requirement->isFulfilled()) { | ||
81 | return; | ||
82 | } | ||
83 | |||
84 | $errorMessage = wordwrap($requirement->getTestMessage(), $lineSize - 3, PHP_EOL.' ').PHP_EOL; | ||
85 | $errorMessage .= ' > '.wordwrap($requirement->getHelpText(), $lineSize - 5, PHP_EOL.' > ').PHP_EOL; | ||
86 | |||
87 | return $errorMessage; | ||
88 | } | ||
89 | |||
90 | function echo_title($title, $style = null) | ||
91 | { | ||
92 | $style = $style ?: 'title'; | ||
93 | |||
94 | echo PHP_EOL; | ||
95 | echo_style($style, $title.PHP_EOL); | ||
96 | echo_style($style, str_repeat('~', strlen($title)).PHP_EOL); | ||
97 | echo PHP_EOL; | ||
98 | } | ||
99 | |||
100 | function echo_style($style, $message) | ||
101 | { | ||
102 | // ANSI color codes | ||
103 | $styles = array( | ||
104 | 'reset' => "\033[0m", | ||
105 | 'red' => "\033[31m", | ||
106 | 'green' => "\033[32m", | ||
107 | 'yellow' => "\033[33m", | ||
108 | 'error' => "\033[37;41m", | ||
109 | 'success' => "\033[37;42m", | ||
110 | 'title' => "\033[34m", | ||
111 | ); | ||
112 | $supports = has_color_support(); | ||
113 | |||
114 | echo($supports ? $styles[$style] : '').$message.($supports ? $styles['reset'] : ''); | ||
115 | } | ||
116 | |||
117 | function echo_block($style, $title, $message) | ||
118 | { | ||
119 | $message = ' '.trim($message).' '; | ||
120 | $width = strlen($message); | ||
121 | |||
122 | echo PHP_EOL.PHP_EOL; | ||
123 | |||
124 | echo_style($style, str_repeat(' ', $width).PHP_EOL); | ||
125 | echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT).PHP_EOL); | ||
126 | echo_style($style, str_pad($message, $width, ' ', STR_PAD_RIGHT).PHP_EOL); | ||
127 | echo_style($style, str_repeat(' ', $width).PHP_EOL); | ||
128 | } | ||
129 | |||
130 | function has_color_support() | ||
131 | { | ||
132 | static $support; | ||
133 | |||
134 | if (null === $support) { | ||
135 | if (DIRECTORY_SEPARATOR == '\\') { | ||
136 | $support = false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI'); | ||
137 | } else { | ||
138 | $support = function_exists('posix_isatty') && @posix_isatty(STDOUT); | ||
139 | } | ||
140 | } | ||
141 | |||
142 | return $support; | ||
143 | } | ||