Skip to content

Commit

Permalink
feature #81 Add check.php file for access from web (bocharsky-bw, jav…
Browse files Browse the repository at this point in the history
…iereguiluz)

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 #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
  • Loading branch information
javiereguiluz committed Jul 7, 2015
2 parents fa03473 + d88ef7b commit fb3a9e8
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Requirements
* PDO-SQLite PHP extension enabled;
* and the [usual Symfony application requirements](http://symfony.com/doc/current/reference/requirements.html).

If unsure about meeting these requirements, download the demo application and
browse the `http://localhost:8000/check.php` script to get more detailed
information.

Installation
------------

Expand Down
20 changes: 20 additions & 0 deletions app/Resources/assets/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,26 @@ footer {
}
}

//
// Page: 'Technical Requirements Checker'
// --------------------------------------------------
body#requirements_checker {
header h1 {
margin-bottom: 0;
margin-top: 0;

span {
font-size: 120%;
opacity: .7;
padding: 0 5px;
}
}

.panel li {
margin-bottom: 1em;
}
}

//
// Page: 'homepage'
// --------------------------------------------------
Expand Down
151 changes: 151 additions & 0 deletions web/check.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?php

if (!isset($_SERVER['HTTP_HOST'])) {
exit('This script cannot be run from the console. Run it from a browser.');
}

if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1'))) {
header('HTTP/1.0 403 Forbidden');
exit('This script is only accessible from localhost.');
}

require_once dirname(__FILE__).'/../app/SymfonyRequirements.php';

$symfonyRequirements = new SymfonyRequirements();

$majorProblems = $symfonyRequirements->getFailedRequirements();
$minorProblems = $symfonyRequirements->getFailedRecommendations();

?>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Symfony Demo Application</title>
<link rel="stylesheet" href="css/app.css">
<link rel="icon" type="image/x-icon" href="favicon.ico" />
</head>

<body id="requirements_checker">
<header>
<div class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<h1 class="navbar-brand">
Symfony Demo Application <span>/</span> Technical Requirements Checker
</span>
</div>
</div>
</div>
</header>

<div class="container body-container">
<div class="row">
<div id="main" class="col-sm-9">
<div class="row">
<?php if (count($majorProblems)): ?>
<div class="panel panel-danger">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-exclamation-circle"></i>
Fix these problems before continuing
</h3>
</div>
<div class="panel-body">
<p>These <strong>mandatory requirements</strong> must be fixed before running Symfony applications:</p>

<ol>
<?php foreach ($majorProblems as $problem): ?>
<li><?php echo $problem->getHelpHtml() ?></li>
<?php endforeach; ?>
</ol>
</div>
</div>
<?php endif; ?>

<?php if (count($minorProblems)): ?>
<div class="panel panel-warning">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-exclamation-triangle"></i>
Fix these problems to improve your experience
</h3>
</div>
<div class="panel-body">
<p>These <strong>optional requirements</strong> should be fixed to improve your experience running Symfony applications:</p>

<ol>
<?php foreach ($minorProblems as $problem): ?>
<li><?php echo $problem->getHelpHtml() ?></li>
<?php endforeach; ?>
</ol>
</div>
</div>
<?php endif; ?>

<?php if ($symfonyRequirements->hasPhpIniConfigIssue()): ?>
<p id="phpini">*
<?php if ($symfonyRequirements->getPhpIniConfigPath()): ?>
Changes to the <strong>php.ini</strong> file must be done in the "<strong><?php echo $symfonyRequirements->getPhpIniConfigPath() ?></strong>" file.
<?php else: ?>
To change settings, create a "<strong>php.ini</strong>".
<?php endif; ?>
</p>
<?php endif; ?>

<?php if (!count($majorProblems) && !count($minorProblems)): ?>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-check"></i>
All checks passed successfully
</h3>
</div>
<div class="panel-body">
<p>Your configuration looks good to run the Symfony Demo application.</p>
</div>
</div>
<?php endif; ?>
</div>
</div>

<div id="sidebar" class="col-sm-3">
<div class="section about">
<div class="well well-lg">
<p>
This script checks whether your system meets the
technical requirements for running Symfony
applications.
</p>
<p>
For more information, check out the
<a href="http://symfony.com/doc/current/reference/requirements.html">requirements list</a>
at the Symfony documentation.
</p>
</div>
</div>

</div>
</div>
</div>

<footer>
<div class="container">
<div class="row">
<div id="footer-copyright" class="col-md-6">
<p>&copy; 2015 - The Symfony Project</p>
<p>MIT License</p>
</div>
<div id="footer-resources" class="col-md-6">
<p>
<a href="https://twitter.com/symfony"><i class="fa fa-twitter"></i></a>
<a href="https://www.facebook.com/SensioLabs"><i class="fa fa-facebook"></i></a>
<a href="http://symfony.com/blog"><i class="fa fa-rss"></i></a>
</p>
</div>
</div>
</div>
</footer>
</body>
</html>
4 changes: 2 additions & 2 deletions web/css/app.css

Large diffs are not rendered by default.

0 comments on commit fb3a9e8

Please sign in to comment.