fix #387 check on servername value not empty, valid & https

This commit is contained in:
Nicolas Le Goff
2012-02-15 19:30:28 +01:00
parent 5bf287539d
commit 19a09baf8f

View File

@@ -134,7 +134,7 @@ class module_console_fileEnsureProductionSetting extends Command
$output->writeln("");
}
}
if(!$nbErrors)
if (!$nbErrors)
{
$output->writeln("<info>Your production settings are setted correctly !</info>");
$output->writeln("");
@@ -223,6 +223,24 @@ class module_console_fileEnsureProductionSetting extends Command
$url = $phraseanet->get("servername");
if(empty($url))
{
throw new \Exception("phraseanet:servername connot be empty");
}
if(!filter_var($url, FILTER_VALIDATE_URL))
{
throw new \Exception(sprintf("%s url is not valid", $url));
}
$parseUrl = parse_url($url);
if($parseUrl["scheme"] !== "https")
{
$output->writeln(sprintf("<comment> /!\ %s url scheme should be https</comment>", $url));
$output->writeln("");
}
if ($phraseanet->get("debug") !== false)
{
throw new \Exception("phraseanet:debug must be initialized to false");