Skip to content

Commit fb3a9e8

Browse files
committed
feature symfony#81 Add check.php file for access from web (bocharsky-bw, javiereguiluz)
This PR was merged into the master branch. Discussion ---------- Add check.php file for access from web This PR takes the work made by @bocharsky-bw in symfony#74 and applies the look-and-feel of the Symfony Demo application to better integrate it. ### No errors - Before ![before_ok](https://cloud.githubusercontent.com/assets/73419/8523007/1b62e224-23f3-11e5-9efc-3ba6bd874545.png) ### No errors - After ![after-ok](https://cloud.githubusercontent.com/assets/73419/8522991/147879d8-23f3-11e5-8158-006744863e24.png) ### Errors - Before ![before-ko](https://cloud.githubusercontent.com/assets/73419/8523014/22518c66-23f3-11e5-9059-c4ad9941617b.png) ### Errors - After ![after-ko](https://cloud.githubusercontent.com/assets/73419/8523017/2a22993a-23f3-11e5-89d0-18c2ced9ddc4.png) Commits ------- d88ef7b Added a note about in the README about the new requirements checked 6972191 Minor change to allow sub-directory installation 2295159 Add check.php file for access from web 2128178 Add check.php file for access from web
2 parents fa03473 + d88ef7b commit fb3a9e8

File tree

4 files changed

+177
-2
lines changed

4 files changed

+177
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ Requirements
1111
* PDO-SQLite PHP extension enabled;
1212
* and the [usual Symfony application requirements](http://symfony.com/doc/current/reference/requirements.html).
1313

14+
If unsure about meeting these requirements, download the demo application and
15+
browse the `http://localhost:8000/check.php` script to get more detailed
16+
information.
17+
1418
Installation
1519
------------
1620

app/Resources/assets/scss/main.scss

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,26 @@ footer {
154154
}
155155
}
156156

157+
//
158+
// Page: 'Technical Requirements Checker'
159+
// --------------------------------------------------
160+
body#requirements_checker {
161+
header h1 {
162+
margin-bottom: 0;
163+
margin-top: 0;
164+
165+
span {
166+
font-size: 120%;
167+
opacity: .7;
168+
padding: 0 5px;
169+
}
170+
}
171+
172+
.panel li {
173+
margin-bottom: 1em;
174+
}
175+
}
176+
157177
//
158178
// Page: 'homepage'
159179
// --------------------------------------------------

web/check.php

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
<?php
2+
3+
if (!isset($_SERVER['HTTP_HOST'])) {
4+
exit('This script cannot be run from the console. Run it from a browser.');
5+
}
6+
7+
if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1'))) {
8+
header('HTTP/1.0 403 Forbidden');
9+
exit('This script is only accessible from localhost.');
10+
}
11+
12+
require_once dirname(__FILE__).'/../app/SymfonyRequirements.php';
13+
14+
$symfonyRequirements = new SymfonyRequirements();
15+
16+
$majorProblems = $symfonyRequirements->getFailedRequirements();
17+
$minorProblems = $symfonyRequirements->getFailedRecommendations();
18+
19+
?>
20+
21+
<!DOCTYPE html>
22+
<html>
23+
<head>
24+
<meta charset="UTF-8" />
25+
<title>Symfony Demo Application</title>
26+
<link rel="stylesheet" href="css/app.css">
27+
<link rel="icon" type="image/x-icon" href="favicon.ico" />
28+
</head>
29+
30+
<body id="requirements_checker">
31+
<header>
32+
<div class="navbar navbar-default navbar-static-top" role="navigation">
33+
<div class="container">
34+
<div class="navbar-header">
35+
<h1 class="navbar-brand">
36+
Symfony Demo Application <span>/</span> Technical Requirements Checker
37+
</span>
38+
</div>
39+
</div>
40+
</div>
41+
</header>
42+
43+
<div class="container body-container">
44+
<div class="row">
45+
<div id="main" class="col-sm-9">
46+
<div class="row">
47+
<?php if (count($majorProblems)): ?>
48+
<div class="panel panel-danger">
49+
<div class="panel-heading">
50+
<h3 class="panel-title">
51+
<i class="fa fa-exclamation-circle"></i>
52+
Fix these problems before continuing
53+
</h3>
54+
</div>
55+
<div class="panel-body">
56+
<p>These <strong>mandatory requirements</strong> must be fixed before running Symfony applications:</p>
57+
58+
<ol>
59+
<?php foreach ($majorProblems as $problem): ?>
60+
<li><?php echo $problem->getHelpHtml() ?></li>
61+
<?php endforeach; ?>
62+
</ol>
63+
</div>
64+
</div>
65+
<?php endif; ?>
66+
67+
<?php if (count($minorProblems)): ?>
68+
<div class="panel panel-warning">
69+
<div class="panel-heading">
70+
<h3 class="panel-title">
71+
<i class="fa fa-exclamation-triangle"></i>
72+
Fix these problems to improve your experience
73+
</h3>
74+
</div>
75+
<div class="panel-body">
76+
<p>These <strong>optional requirements</strong> should be fixed to improve your experience running Symfony applications:</p>
77+
78+
<ol>
79+
<?php foreach ($minorProblems as $problem): ?>
80+
<li><?php echo $problem->getHelpHtml() ?></li>
81+
<?php endforeach; ?>
82+
</ol>
83+
</div>
84+
</div>
85+
<?php endif; ?>
86+
87+
<?php if ($symfonyRequirements->hasPhpIniConfigIssue()): ?>
88+
<p id="phpini">*
89+
<?php if ($symfonyRequirements->getPhpIniConfigPath()): ?>
90+
Changes to the <strong>php.ini</strong> file must be done in the "<strong><?php echo $symfonyRequirements->getPhpIniConfigPath() ?></strong>" file.
91+
<?php else: ?>
92+
To change settings, create a "<strong>php.ini</strong>".
93+
<?php endif; ?>
94+
</p>
95+
<?php endif; ?>
96+
97+
<?php if (!count($majorProblems) && !count($minorProblems)): ?>
98+
<div class="panel panel-success">
99+
<div class="panel-heading">
100+
<h3 class="panel-title">
101+
<i class="fa fa-check"></i>
102+
All checks passed successfully
103+
</h3>
104+
</div>
105+
<div class="panel-body">
106+
<p>Your configuration looks good to run the Symfony Demo application.</p>
107+
</div>
108+
</div>
109+
<?php endif; ?>
110+
</div>
111+
</div>
112+
113+
<div id="sidebar" class="col-sm-3">
114+
<div class="section about">
115+
<div class="well well-lg">
116+
<p>
117+
This script checks whether your system meets the
118+
technical requirements for running Symfony
119+
applications.
120+
</p>
121+
<p>
122+
For more information, check out the
123+
<a href="http://symfony.com/doc/current/reference/requirements.html">requirements list</a>
124+
at the Symfony documentation.
125+
</p>
126+
</div>
127+
</div>
128+
129+
</div>
130+
</div>
131+
</div>
132+
133+
<footer>
134+
<div class="container">
135+
<div class="row">
136+
<div id="footer-copyright" class="col-md-6">
137+
<p>&copy; 2015 - The Symfony Project</p>
138+
<p>MIT License</p>
139+
</div>
140+
<div id="footer-resources" class="col-md-6">
141+
<p>
142+
<a href="https://twitter.com/symfony"><i class="fa fa-twitter"></i></a>
143+
<a href="https://www.facebook.com/SensioLabs"><i class="fa fa-facebook"></i></a>
144+
<a href="http://symfony.com/blog"><i class="fa fa-rss"></i></a>
145+
</p>
146+
</div>
147+
</div>
148+
</div>
149+
</footer>
150+
</body>
151+
</html>

web/css/app.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)