Addressed github review

This commit is contained in:
Romain Neutron
2013-05-13 15:35:56 +02:00
parent 09e28f493e
commit 0080aa79ca
13 changed files with 113 additions and 126 deletions

View File

@@ -40,8 +40,8 @@ rewrite ^/prod/export/.*$ /index.php last;
rewrite ^/prod/record/preview/.*$ /index.php last;
rewrite ^/prod/notifications/.*$ /index.php last;
rewrite ^/prod/share/.*$ /index.php last;
rewrite ^/setup/$ /index.php last;
rewrite ^/setup/.*$ /index.php last;
rewrite ^/setup/$ /index.php last;
rewrite ^/user/preferences/.*$ /index.php last;
rewrite ^/user/notifications/.*$ /index.php last;

View File

@@ -24,7 +24,7 @@ return call_user_func(function($environment = null) {
$app->before(function (Request $request) use ($app) {
if (0 === strpos($request->getPathInfo(), '/setup')) {
if (!$app['phraseanet.configuration-tester']->isBlank()) {
return $app->redirect('/login/');
return $app->redirect($app->path('homepage'));
}
} else {
$app['firewall']->requireSetup();

View File

@@ -27,8 +27,7 @@ class CheckEnvironment extends Command
{
parent::__construct($name);
$this
->setDescription("Check environment");
$this->setDescription("Check environment");
return $this;
}
@@ -52,7 +51,6 @@ class CheckEnvironment extends Command
$output->writeln('');
foreach ($collection->getRequirements() as $requirement) {
$result = $requirement->isFulfilled() ? '<info>OK </info>' : ($requirement->isOptional() ? '<comment>WARNING</comment> ' : '<error>ERROR</error> ');
$output->write(' ' . $result);
@@ -69,7 +67,6 @@ class CheckEnvironment extends Command
$output->writeln('');
foreach ($collection->getRecommendations() as $requirement) {
$result = $requirement->isFulfilled() ? '<info>OK </info>' : ($requirement->isOptional() ? '<comment>WARNING</comment> ' : '<error>ERROR</error> ');
$output->write(' ' . $result);

View File

@@ -22,7 +22,6 @@ use Silex\ControllerProviderInterface;
use Silex\Application as SilexApplication;
use Symfony\Component\HttpFoundation\Request;
class Setup implements ControllerProviderInterface
{
public function connect(SilexApplication $app)
@@ -51,7 +50,7 @@ class Setup implements ControllerProviderInterface
return $app['twig']->render('/setup/index.html.twig', array(
'locale' => $app['locale'],
'available_locales' => \Alchemy\Phrasea\Application::getAvailableLanguages(),
'available_locales' => Application::getAvailableLanguages(),
'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/',
'requirementsCollection' => $requirementsCollection,
));
@@ -87,17 +86,15 @@ class Setup implements ControllerProviderInterface
$warnings[] = _('It is not recommended to install Phraseanet without HTTPS support');
}
return $app['twig']->render(
'/setup/step2.html.twig'
, array(
'locale' => $app['locale']
, 'available_locales' => Application::getAvailableLanguages()
, 'available_templates' => array('en', 'fr')
, 'warnings' => $warnings
, 'error' => $request->query->get('error')
, 'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/'
, 'discovered_binaries' => \setup::discover_binaries()
, 'rootpath' => dirname(dirname(dirname(dirname(__DIR__)))) . '/'
return $app['twig']->render('/setup/step2.html.twig', array(
'locale' => $app['locale'],
'available_locales' => Application::getAvailableLanguages(),
'available_templates' => array('en', 'fr'),
'warnings' => $warnings,
'error' => $request->query->get('error'),
'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/',
'discovered_binaries' => \setup::discover_binaries(),
'rootpath' => realpath(__DIR__ . '/../../../../'),
));
}
@@ -165,9 +162,10 @@ class Setup implements ControllerProviderInterface
$app->openAccount(new \Session_Authentication_None($user));
$redirection = '/admin/?section=taskmanager&notice=install_success';
return $app->redirect($redirection);
return $app->redirect($app->path('admin', array(
'section' => 'taskmanager',
'notice' => 'install_success',
)));
} catch (\Exception $e) {
}

View File

@@ -17,8 +17,6 @@ use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
// check ***::***
class Thesaurus implements ControllerProviderInterface
{
public function connect(Application $app)
@@ -499,10 +497,10 @@ class Thesaurus implements ControllerProviderInterface
}
}
}
if (! $query) {
if (!$query) {
$query = $query0;
}
if (! $label) {
if (!$label) {
$label = $label0;
}

View File

@@ -31,9 +31,6 @@ class ConfigurationTester
private $requirements;
private $versionProbes;
const PROD_ENV = 'prod';
const DEV_ENV = 'dev';
public function __construct(Application $app)
{
$this->app = $app;

View File

@@ -16,8 +16,6 @@ use Alchemy\Phrasea\Setup\Requirements\BinariesRequirements;
class BinariesProbe extends BinariesRequirements implements ProbeInterface
{
const REQUIRED_PHP_VERSION = '5.3.3';
public function __construct(\registryInterface $registry)
{
parent::__construct(array_filter(array(

View File

@@ -26,6 +26,11 @@ class SearchEngineProbe extends RequirementCollection implements ProbeInterface
}
}
/**
* {@inheritdoc}
*
* @return SearchEngineProbe
*/
public static function create(Application $app)
{
return new static($app['phraseanet.SE']);

View File

@@ -16,8 +16,6 @@ use Symfony\Component\Process\ExecutableFinder;
class BinariesRequirements extends RequirementCollection
{
const REQUIRED_PHP_VERSION = '5.3.3';
public function __construct($binaries = array())
{
$this->setName('Binaries');

View File

@@ -4,7 +4,6 @@
{% if requirements.getRequirements() is not empty %}
<li><strong>{% trans 'Requirements' %}</strong></li>
{% for requirement in requirements.getRequirements() %}
<li class="{% if not requirement.isFulfilled() %}{% if not requirement.isOptional() %}blocker{% else %}non-blocker{% endif %}{% else %}good-enough{% endif %}">
{{ requirement.getTestMessage }}
@@ -19,7 +18,6 @@
{% if requirements.getRecommendations() is not empty %}
<li><strong>{% trans 'Recommendations' %}</strong></li>
{% for requirement in requirements.getRecommendations() %}
<li class="{% if not requirement.isFulfilled() %}{% if not requirement.isOptional() %}blocker{% else %}non-blocker{% endif %}{% else %}good-enough{% endif %}">
{{ requirement.getTestMessage }}

View File

@@ -14,87 +14,85 @@
{% block content %}
<div class="steps" style="min-height:450px;">
<table style="width:100%;">
<tr>
<td>
<div style="height:400px;overflow:auto;">
<h2>
INSTALL
</h2>
<p>
Please have a look a this recommendations
</p>
<table>
{% for requirements in requirementsCollection %}
<tr>
<td colspan="2">
<h3> {{ requirements.getName() }} requirements </h3>
</td>
</tr>
{% for requirement in requirements.getRequirements() %}
<tr>
<td>
{% if requirement.isFulfilled() %}
<span style="color:green">OK</span>
{% elseif requirement.isOptional() %}
<span style="color:orange">WARNING</span>
{% else %}
<span style="color:red">ERROR</span>
{% endif %}
</td>
<td>
{{ requirement.getTestMessage }}
<table style="width:100%;">
<tr>
<td>
<div style="height:400px;overflow:auto;">
<h2>
INSTALL
</h2>
<p>
Please have a look a this recommendations
</p>
<table>
{% for requirements in requirementsCollection %}
<tr>
<td colspan="2">
<h3> {{ requirements.getName() }} requirements </h3>
</td>
</tr>
{% for requirement in requirements.getRequirements() %}
<tr>
<td>
{% if requirement.isFulfilled() %}
<span style="color:green">OK</span>
{% elseif requirement.isOptional() %}
<span style="color:orange">WARNING</span>
{% else %}
<span style="color:red">ERROR</span>
{% endif %}
</td>
<td>
{{ requirement.getTestMessage }}
{% if not requirement.isFulfilled() %}
{{ requirement.getHelpText() }}
{% endif %}
</td>
</tr>
{% endfor %}
{% if not requirement.isFulfilled() %}
{{ requirement.getHelpText() }}
{% endif %}
</td>
</tr>
{% endfor %}
<tr>
<td colspan="2">
<h3> {{ requirements.getName() }} recommendations </h3>
</td>
</tr>
{% for requirement in requirements.getRecommendations() %}
<tr>
<tr>
<td colspan="2">
<h3> {{ requirements.getName() }} recommendations </h3>
</td>
</tr>
{% for requirement in requirements.getRecommendations() %}
<tr>
<td>
{% if requirement.isFulfilled() %}
<span style="color:green">OK</span>
{% elseif requirement.isOptional() %}
<span style="color:orange">WARNING</span>
{% else %}
<span style="color:red">ERROR</span>
{% endif %}
</td>
<td>
{{ requirement.getTestMessage }}
<td>
{% if requirement.isFulfilled() %}
<span style="color:green">OK</span>
{% elseif requirement.isOptional() %}
<span style="color:orange">WARNING</span>
{% else %}
<span style="color:red">ERROR</span>
{% endif %}
</td>
<td>
{{ requirement.getTestMessage }}
{% if not requirement.isFulfilled() %}
{{ requirement.getHelpText() }}
{% endif %}
</td>
</tr>
{% endfor %}
{% endfor %}
</table>
</div>
<div>
<table style="width:100%;">
<tr>
<td style="text-align:right;">
<a href="{{ path('install_step2') }}">Continue Install</a>
</td>
</tr>
</table>
</div>
</div>
</td>
</tr>
</table>
{% if not requirement.isFulfilled() %}
{{ requirement.getHelpText() }}
{% endif %}
</td>
</tr>
{% endfor %}
{% endfor %}
</table>
</div>
<div>
<table style="width:100%;">
<tr>
<td style="text-align:right;">
<a href="{{ path('install_step2') }}">Continue Install</a>
</td>
</tr>
</table>
</div>
</div>
</td>
</tr>
</table>
</div>
{% endblock %}

View File

@@ -327,19 +327,19 @@
{% endif %}
</td>
</tr>
{% for warning in warnings %}
<tr style='border-top:1px dotted grey;{{ loop.last ? " border-bottom:1px dotted grey;" : " " }}'>
<td class="warning">
{{ warning }}
</td>
</tr>
{% endfor %}
{% for warning in warnings %}
<tr style='border-top:1px dotted grey;{{ loop.last ? " border-bottom:1px dotted grey;" : " " }}'>
<td class="warning">
{{ warning }}
</td>
</tr>
{% endfor %}
{% if warnings is not empty %}
<tr>
<td>
<a href="{{ path('install_root') }}">{% trans 'Review system configuration' %}</a>
</td>
</tr>
<tr>
<td>
<a href="{{ path('install_root') }}">{% trans 'Review system configuration' %}</a>
</td>
</tr>
{% endif %}
</table>
</td>