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/record/preview/.*$ /index.php last;
rewrite ^/prod/notifications/.*$ /index.php last; rewrite ^/prod/notifications/.*$ /index.php last;
rewrite ^/prod/share/.*$ /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 ^/setup/$ /index.php last;
rewrite ^/user/preferences/.*$ /index.php last; rewrite ^/user/preferences/.*$ /index.php last;
rewrite ^/user/notifications/.*$ /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) { $app->before(function (Request $request) use ($app) {
if (0 === strpos($request->getPathInfo(), '/setup')) { if (0 === strpos($request->getPathInfo(), '/setup')) {
if (!$app['phraseanet.configuration-tester']->isBlank()) { if (!$app['phraseanet.configuration-tester']->isBlank()) {
return $app->redirect('/login/'); return $app->redirect($app->path('homepage'));
} }
} else { } else {
$app['firewall']->requireSetup(); $app['firewall']->requireSetup();

View File

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

View File

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

View File

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

View File

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

View File

@@ -16,8 +16,6 @@ use Alchemy\Phrasea\Setup\Requirements\BinariesRequirements;
class BinariesProbe extends BinariesRequirements implements ProbeInterface class BinariesProbe extends BinariesRequirements implements ProbeInterface
{ {
const REQUIRED_PHP_VERSION = '5.3.3';
public function __construct(\registryInterface $registry) public function __construct(\registryInterface $registry)
{ {
parent::__construct(array_filter(array( 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) public static function create(Application $app)
{ {
return new static($app['phraseanet.SE']); return new static($app['phraseanet.SE']);

View File

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

View File

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

View File

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

View File

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