Skip to content

Commit c1901a0

Browse files
committed
Sync with SE 3.1
1 parent 70aad81 commit c1901a0

File tree

9 files changed

+138
-79
lines changed

9 files changed

+138
-79
lines changed

app/autoload.php

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,13 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
if (!$loader = include __DIR__.'/../vendor/autoload.php') {
13-
$nl = PHP_SAPI === 'cli' ? PHP_EOL : '<br />';
14-
echo "$nl$nl";
15-
die('You must set up the project dependencies.'.$nl.
16-
'Run the following commands in '.dirname(__DIR__).':'.$nl.$nl.
17-
'curl -s http://getcomposer.org/installer | php'.$nl.
18-
'php composer.phar install'.$nl);
19-
}
20-
2112
use Doctrine\Common\Annotations\AnnotationRegistry;
13+
use Composer\Autoload\ClassLoader;
2214

23-
// intl
24-
if (!function_exists('intl_get_error_code')) {
25-
require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
26-
27-
$loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
28-
}
15+
/**
16+
* @var ClassLoader $loader
17+
*/
18+
$loader = require __DIR__.'/../vendor/autoload.php';
2919

3020
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
3121

app/config/routing_dev.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,5 @@ _profiler:
66
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
77
prefix: /_profiler
88

9-
_configurator:
10-
resource: '@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml'
11-
prefix: /_configurator
12-
139
_main:
1410
resource: routing.yml
15-
16-

app/console

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
#!/usr/bin/env php
22
<?php
33

4+
use Symfony\Bundle\FrameworkBundle\Console\Application;
5+
use Symfony\Component\Console\Input\ArgvInput;
6+
use Symfony\Component\Debug\Debug;
7+
48
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
59
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
610
//umask(0000);
711

812
set_time_limit(0);
913

10-
require_once __DIR__.'/bootstrap.php.cache';
11-
require_once __DIR__.'/AppKernel.php';
12-
13-
use Symfony\Bundle\FrameworkBundle\Console\Application;
14-
use Symfony\Component\Console\Input\ArgvInput;
14+
/**
15+
* @var Composer\Autoload\ClassLoader $loader
16+
*/
17+
$loader = require __DIR__.'/../app/autoload.php';
1518

1619
$input = new ArgvInput();
1720
$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
1821
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
1922

23+
if ($debug) {
24+
Debug::enable();
25+
}
26+
2027
$kernel = new AppKernel($env, $debug);
2128
$application = new Application($kernel);
2229
$application->run($input);

app/phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
processIsolation="false"
1212
stopOnFailure="false"
1313
syntaxCheck="false"
14-
bootstrap="tests/bootstrap.php" >
14+
bootstrap="autoload.php">
1515

1616
<testsuites>
1717
<testsuite name="Project Test Suite">

app/tests/bootstrap.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
}
1111
],
1212
"autoload": {
13-
"psr-0": { "": "src/" }
13+
"psr-4": { "": "src/" },
14+
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
15+
},
16+
"autoload-dev": {
17+
"classmap": [ "app/tests/WebTestCase.php" ]
1418
},
1519
"repositories": [
1620
{

web/app.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,22 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
require_once __DIR__.'/../app/bootstrap.php.cache';
13-
require_once __DIR__.'/../app/AppKernel.php';
14-
//require_once __DIR__.'/../app/AppCache.php';
15-
1612
use Symfony\Component\HttpFoundation\Request;
1713

14+
/**
15+
* @var Composer\Autoload\ClassLoader
16+
*/
17+
$loader = require __DIR__.'/../app/autoload.php';
18+
include_once __DIR__.'/../app/bootstrap.php.cache';
19+
1820
$kernel = new AppKernel('prod', false);
1921
$kernel->loadClassCache();
2022
//$kernel = new AppCache($kernel);
23+
24+
25+
// When using the HttpCache, you need to call the method in your front
26+
// controller instead of relying on the configuration parameter
27+
//Request::enableHttpMethodParameterOverride();
2128
$request = Request::createFromGlobals();
2229
$response = $kernel->handle($request);
2330
$response->send();

web/app_dev.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,29 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
12+
use Symfony\Component\HttpFoundation\Request;
13+
use Symfony\Component\Debug\Debug;
14+
15+
// If you don't want to setup permissions the proper way, just uncomment the following PHP line
16+
// read http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup
17+
// for more information
1318
//umask(0000);
1419

1520
// This check prevents access to debug front controllers that are deployed by accident to production servers.
1621
// Feel free to remove this, extend it, or make something more sophisticated.
1722
if (isset($_SERVER['HTTP_CLIENT_IP'])
1823
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
19-
|| !in_array(@$_SERVER['REMOTE_ADDR'], array(
20-
'127.0.0.1',
21-
'::1',
22-
'172.22.22.1',
23-
))
24+
|| !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server')
2425
) {
2526
header('HTTP/1.0 403 Forbidden');
2627
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
2728
}
2829

29-
require_once __DIR__.'/../app/bootstrap.php.cache';
30-
require_once __DIR__.'/../app/AppKernel.php';
31-
32-
use Symfony\Component\HttpFoundation\Request;
30+
/**
31+
* @var Composer\Autoload\ClassLoader $loader
32+
*/
33+
$loader = require __DIR__.'/../app/autoload.php';
34+
Debug::enable();
3335

3436
$kernel = new AppKernel('dev', true);
3537
$kernel->loadClassCache();

web/config.php

Lines changed: 92 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
<?php
22

3+
/*
4+
* ************** CAUTION **************
5+
*
6+
* DO NOT EDIT THIS FILE as it will be overridden by Composer as part of
7+
* the installation/update process. The original file resides in the
8+
* SensioDistributionBundle.
9+
*
10+
* ************** CAUTION **************
11+
*/
12+
313
if (!isset($_SERVER['HTTP_HOST'])) {
414
exit('This script cannot be run from the CLI. Run it from a browser.');
515
}
@@ -25,10 +35,86 @@
2535
<head>
2636
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
2737
<meta name="robots" content="noindex,nofollow" />
28-
<title>Symfony Configuration</title>
38+
<title>Symfony Configuration Checker</title>
2939
<link rel="stylesheet" href="bundles/framework/css/structure.css" media="all" />
3040
<link rel="stylesheet" href="bundles/framework/css/body.css" media="all" />
31-
<link rel="stylesheet" href="bundles/sensiodistribution/webconfigurator/css/install.css" media="all" />
41+
<style type="text/css">
42+
/* styles copied from bundles/sensiodistribution/webconfigurator/css/install.css */
43+
body {
44+
font-size: 14px;
45+
font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
46+
}
47+
.sf-reset h1.title {
48+
font-size: 45px;
49+
padding-bottom: 30px;
50+
}
51+
.sf-reset h2 {
52+
font-weight: bold;
53+
color: #FFFFFF;
54+
/* Font is reset to sans-serif (like body) */
55+
font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
56+
margin-bottom: 10px;
57+
background-color: #aacd4e;
58+
padding: 2px 4px;
59+
display: inline-block;
60+
text-transform: uppercase;
61+
}
62+
.sf-reset ul a,
63+
.sf-reset ul a:hover {
64+
background: url(../images/blue-arrow.png) no-repeat right 6px;
65+
padding-right: 10px;
66+
}
67+
.sf-reset ul, ol {
68+
padding-left: 20px;
69+
}
70+
.sf-reset li {
71+
padding-bottom: 18px;
72+
}
73+
.sf-reset ol li {
74+
list-style-type: decimal;
75+
}
76+
.sf-reset ul li {
77+
list-style-type: none;
78+
}
79+
.sf-reset .symfony-blocks-install {
80+
overflow: hidden;
81+
}
82+
.sf-reset .symfony-install-continue {
83+
font-size: 0.95em;
84+
padding-left: 0;
85+
}
86+
.sf-reset .symfony-install-continue li {
87+
padding-bottom: 10px;
88+
}
89+
.sf-reset .ok {
90+
color: #fff;
91+
font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
92+
background-color: #6d6;
93+
padding: 10px;
94+
margin-bottom: 20px;
95+
}
96+
.sf-reset .ko {
97+
background-color: #d66;
98+
}
99+
.version {
100+
text-align: right;
101+
font-size: 10px;
102+
margin-right: 20px;
103+
}
104+
.sf-reset a,
105+
.sf-reset li a {
106+
color: #08C;
107+
text-decoration: none;
108+
}
109+
.sf-reset a:hover,
110+
.sf-reset li a:hover {
111+
color: #08C;
112+
text-decoration: underline;
113+
}
114+
.sf-reset textarea {
115+
padding: 7px;
116+
}
117+
</style>
32118
</head>
33119
<body>
34120
<div id="content">
@@ -62,11 +148,10 @@
62148
<div class="sf-reset">
63149
<div class="block">
64150
<div class="symfony-block-content">
65-
<h1 class="title">Welcome!</h1>
66-
<p>Welcome to your new Symfony project.</p>
151+
<h1 class="title">Configuration Checker</h1>
67152
<p>
68-
This script will guide you through the basic configuration of your project.
69-
You can also do the same by editing the ‘<strong>app/config/parameters.yml</strong>’ file directly.
153+
This script analyzes your system to check whether is
154+
ready to run Symfony applications.
70155
</p>
71156

72157
<?php if (count($majorProblems)): ?>
@@ -103,14 +188,10 @@
103188
<?php endif; ?>
104189

105190
<?php if (!count($majorProblems) && !count($minorProblems)): ?>
106-
<p class="ok">Your configuration looks good to run Symfony.</p>
191+
<p class="ok">All checks passed successfully. Your system is ready to run Symfony applications.</p>
107192
<?php endif; ?>
108193

109194
<ul class="symfony-install-continue">
110-
<?php if (!count($majorProblems)): ?>
111-
<li><a href="app_dev.php/_configurator/">Configure your Symfony Application online</a></li>
112-
<li><a href="app_dev.php/">Bypass configuration and go to the Welcome page</a></li>
113-
<?php endif; ?>
114195
<?php if (count($majorProblems) || count($minorProblems)): ?>
115196
<li><a href="config.php">Re-check configuration</a></li>
116197
<?php endif; ?>

0 commit comments

Comments
 (0)